chars int64 40 24k | content_type stringclasses 9
values | id stringlengths 13 64 | source stringclasses 5
values | subset stringclasses 31
values | text stringlengths 40 24k |
|---|---|---|---|---|---|
327 | leanexplore_declaration | leanexplore:388380 | leanexplore_sqlite | leanexplore_declarations | /-- If x is neither a free variable of an environment Ns or a term M, then
x is also not a free variable of the multi-substitution of Ns into M -/
lemma multiSubst_preserves_not_fvar (M : Term Var) (E : Env Var) (nmem : x ∉ M.fv ∪ E.fv) :
x ∉ (multiSubst E M).fv := by
induction E with grind [subst_preserve_no... |
223 | leanexplore_declaration | leanexplore:388381 | leanexplore_sqlite | leanexplore_declarations | /-- Multi-substitution propagates recursively through an application -/
lemma multiSubst_app (M N : Term Var) (E : Env Var) :
multiSubst E (app M N) = app (multiSubst E M) (multiSubst E N) := by
induction E with grind |
202 | leanexplore_declaration | leanexplore:388382 | leanexplore_sqlite | leanexplore_declarations | /-- Multi-substitution propagates recursively through an abstraction -/
lemma multiSubst_abs (M : Term Var) (E : Env Var) :
multiSubst E (abs M) = abs (multiSubst E M) := by
induction E with grind |
400 | leanexplore_declaration | leanexplore:388383 | leanexplore_sqlite | leanexplore_declarations | /-- Multi-substitution commutes with opening a term with a fresh variable,
provided that the variable is not in the domain of the environment
and the environment is locally closed -/
lemma multiSubst_open_var [HasFresh Var] (M : Term Var) (E : Env Var) (x : Var)
(h_ndom : x ∉ E.dom) (h_lc : env_LC E) :
mu... |
239 | leanexplore_declaration | leanexplore:388384 | leanexplore_sqlite | leanexplore_declarations | /-- An opening appearing in both sides of an equality of terms can be removed. -/
lemma open_lc_aux (e : Term Var) (j v i u) (neq : i ≠ j) (eq : e⟦j ↝ v⟧ = e⟦j ↝ v⟧⟦i ↝ u⟧) :
e = e ⟦i ↝ u⟧ := by
induction e generalizing j i <;> grind |
241 | leanexplore_declaration | leanexplore:388385 | leanexplore_sqlite | leanexplore_declarations | /-- Opening is associative for nonclashing free variables. -/
lemma swap_open_fvars (k n : ℕ) (x y : Var) (m : Term Var) (neq : k ≠ n) :
m⟦n ↝ fvar y⟧⟦k ↝ fvar x⟧ = m⟦k ↝ fvar x⟧⟦n ↝ fvar y⟧ := by
induction m generalizing k n <;> grind |
197 | leanexplore_declaration | leanexplore:388386 | leanexplore_sqlite | leanexplore_declarations | /-- Substitution of a free variable not present in a term leaves it unchanged. -/
theorem subst_fresh (x : Var) (t sub : Term Var) (nmem : x ∉ t.fv) : t [x := sub] = t := by
induction t <;> grind |
139 | leanexplore_declaration | leanexplore:388387 | leanexplore_sqlite | leanexplore_declarations | lemma open_close (x : Var) (t : Term Var) (k : ℕ) (nmem : x ∉ t.fv) : t = t⟦k ↝ fvar x⟧⟦k ↜ x⟧ := by
induction t generalizing k <;> grind |
168 | leanexplore_declaration | leanexplore:388388 | leanexplore_sqlite | leanexplore_declarations | /-- Specializes `open_close` to the first closing. -/
lemma open_close_var (x : Var) (t : Term Var) (nmem : x ∉ t.fv) : t = (t ^ fvar x) ^* x :=
open_close x t 0 nmem |
220 | leanexplore_declaration | leanexplore:388389 | leanexplore_sqlite | leanexplore_declarations | /-- Opening is injective. -/
lemma open_injective (x : Var) (M M') (free_M : x ∉ M.fv) (free_M' : x ∉ M'.fv)
(eq : M ^ fvar x = M' ^ fvar x) : M = M' := by
grind [open_close x M 0 free_M, open_close x M' 0 free_M'] |
265 | leanexplore_declaration | leanexplore:388390 | leanexplore_sqlite | leanexplore_declarations | /-- Opening and closing are associative for nonclashing free variables. -/
lemma swap_open_fvar_close (k n : ℕ) (x y : Var) (m : Term Var) (neq₁ : k ≠ n) (neq₂ : x ≠ y) :
m⟦n ↝ fvar y⟧⟦k ↜ x⟧ = m⟦k ↜ x⟧⟦n ↝ fvar y⟧ := by
induction m generalizing k n <;> grind |
176 | leanexplore_declaration | leanexplore:388391 | leanexplore_sqlite | leanexplore_declarations | /-- Closing preserves free variables. -/
lemma close_preserve_not_fvar {k x y} (m : Term Var) (nmem : x ∉ m.fv) : x ∉ (m⟦k ↜ y⟧).fv := by
induction m generalizing k <;> grind |
229 | leanexplore_declaration | leanexplore:388392 | leanexplore_sqlite | leanexplore_declarations | /-- Opening to a fresh free variable preserves free variables. -/
lemma open_fresh_preserve_not_fvar {k x y} (m : Term Var) (nmem : x ∉ m.fv) (neq : x ≠ y) :
x ∉ (m⟦k ↝ fvar y⟧).fv := by
induction m generalizing k <;> grind |
201 | leanexplore_declaration | leanexplore:388393 | leanexplore_sqlite | leanexplore_declarations | /-- Opening preserves free variables. -/
lemma open_preserve_not_fvar {k x} (m n : Term Var) (nmem_m : x ∉ m.fv) (nmem_n : x ∉ n.fv) :
x ∉ (m⟦k ↝ n⟧).fv := by
induction m generalizing k <;> grind |
185 | leanexplore_declaration | leanexplore:388394 | leanexplore_sqlite | leanexplore_declarations | /-- Substitution preserves free variables. -/
lemma subst_preserve_not_fvar {x y : Var} (m n : Term Var) (nmem : x ∉ m.fv ∪ n.fv) :
x ∉ (m [y := n]).fv := by
induction m <;> grind |
174 | leanexplore_declaration | leanexplore:388395 | leanexplore_sqlite | leanexplore_declarations | /-- Closing removes a free variable. -/
@[scoped grind ←]
lemma close_var_not_fvar_rec (x) (k) (t : Term Var) : x ∉ (t⟦k ↜ x⟧).fv := by
induction t generalizing k <;> grind |
155 | leanexplore_declaration | leanexplore:388396 | leanexplore_sqlite | leanexplore_declarations | /-- Specializes `close_var_not_fvar_rec` to first closing. -/
lemma close_var_not_fvar (x) (t : Term Var) : x ∉ (t ^* x).fv := close_var_not_fvar_rec x 0 t |
264 | leanexplore_declaration | leanexplore:388397 | leanexplore_sqlite | leanexplore_declarations | /-- A locally closed term is unchanged by opening. -/
@[scoped grind =_]
lemma open_lc (k t) (e : Term Var) (e_lc : e.LC) : e = e⟦k ↝ t⟧ := by
induction e_lc generalizing k with
| abs xs e _ _ => grind [open_lc_aux e 0 (fvar (fresh xs)) (k+1) t]
| _ => grind |
240 | leanexplore_declaration | leanexplore:388398 | leanexplore_sqlite | leanexplore_declarations | lemma open_eq_app {x : Var} {m n : Term Var} (hw_n : x ∉ n.fv) (hw_m : x ∉ m.fv) (lc_m : LC m)
(h : n ^ fvar x = app m (fvar x)) : n = app m (bvar 0) := by
apply open_injective x n _ hw_n (by grind)
grind [open_lc 0 (fvar x) m lc_m] |
273 | leanexplore_declaration | leanexplore:388399 | leanexplore_sqlite | leanexplore_declarations | /-- Substitution of a locally closed term distributes with opening. -/
@[scoped grind =]
lemma subst_openRec (x : Var) (t : Term Var) (k : ℕ) (u e : Term Var) (lc : LC t) :
(e⟦ k ↝ u ⟧)[x := t] = e[x := t]⟦k ↝ u [ x := t ]⟧ := by
induction e generalizing k with grind |
187 | leanexplore_declaration | leanexplore:388400 | leanexplore_sqlite | leanexplore_declarations | /-- Specialize `subst_openRec` to the first opening. -/
lemma subst_open (x : Var) (t : Term Var) (u e : Term Var) (lc : LC t) :
(e ^ u)[x := t] = e[x := t] ^ u [ x := t ] := by grind |
193 | leanexplore_declaration | leanexplore:388401 | leanexplore_sqlite | leanexplore_declarations | /-- Specialize `subst_open` to the free variables. -/
theorem subst_open_var (x y : Var) (u e : Term Var) (neq : y ≠ x) (u_lc : LC u) :
(e ^ fvar x)[y := u] = e[y := u] ^ fvar x := by grind |
256 | leanexplore_declaration | leanexplore:388402 | leanexplore_sqlite | leanexplore_declarations | /-- Substitution of locally closed terms is locally closed. -/
@[scoped grind ←]
theorem subst_lc {x : Var} {e u : Term Var} (e_lc : LC e) (u_lc : LC u) : LC (e [x := u]) := by
induction e_lc
case' abs => apply LC.abs (free_union Var)
all_goals grind |
238 | leanexplore_declaration | leanexplore:388403 | leanexplore_sqlite | leanexplore_declarations | /-- Opening to a term `t` is equivalent to opening to a free variable and substituting for `t`. -/
lemma subst_intro (x : Var) (t e : Term Var) (mem : x ∉ e.fv) (t_lc : LC t) :
e ^ t = (e ^ fvar x) [ x := t ] := by grind [subst_fresh] |
232 | leanexplore_declaration | leanexplore:388404 | leanexplore_sqlite | leanexplore_declarations | /-- Opening of locally closed terms is locally closed. -/
@[scoped grind ←]
theorem beta_lc {M N : Term Var} (m_lc : M.abs.LC) (n_lc : LC N) : LC (M ^ N) := by
cases m_lc with
| abs => grind [fresh_exists <| free_union [fv] Var] |
557 | leanexplore_declaration | leanexplore:388405 | leanexplore_sqlite | leanexplore_declarations | /-- Opening then closing is equivalent to substitution. -/
@[scoped grind =]
lemma open_close_to_subst (m : Term Var) (x y : Var) (k : ℕ) (m_lc : LC m) :
m ⟦k ↜ x⟧⟦k ↝ fvar y⟧ = m [x := fvar y] := by
induction m_lc generalizing k with
| abs xs t =>
have ⟨x', _⟩ := fresh_exists <| free_union [fv] Var
gri... |
387 | leanexplore_declaration | leanexplore:388406 | leanexplore_sqlite | leanexplore_declarations | /-- Closing and opening are inverses. -/
lemma close_open (x : Var) (t : Term Var) (k : ℕ) (t_lc : LC t) : t⟦k ↜ x⟧⟦k ↝ fvar x⟧ = t := by
induction t_lc generalizing k with
| abs _ t _ ih =>
let z := t⟦k + 1 ↜ x⟧⟦k + 1 ↝ fvar x⟧
have ⟨y, _⟩ := fresh_exists <| free_union [fv] Var
grind [ih y ?_ (k+1), op... |
248 | leanexplore_declaration | leanexplore:388407 | leanexplore_sqlite | leanexplore_declarations | /-- A term is strongly normalizing if every reduction sequence terminates at some point.
This is ensured by the following type as inductive data must always be finite. -/
inductive SN {α} : Term α → Prop
| sn t : (∀ t', t ⭢βᶠ t' → SN t') → SN t |
40 | leanexplore_declaration | leanexplore:388408 | leanexplore_sqlite | leanexplore_declarations | | sn t : (∀ t', t ⭢βᶠ t' → SN t') → SN t |
146 | leanexplore_declaration | leanexplore:388409 | leanexplore_sqlite | leanexplore_declarations | /-- A single β-reduction step preserves strong normalization. -/
lemma sn_step (t_st_t' : t ⭢βᶠ t') (sn_t : SN t) : SN t' := by
grind [cases SN] |
174 | leanexplore_declaration | leanexplore:388410 | leanexplore_sqlite | leanexplore_declarations | /-- Multiple β-reduction steps also preserve strong normalization. -/
lemma sn_steps (t_st_t' : t ↠βᶠ t') (sn_t : SN t) : SN t' := by
induction t_st_t' with grind [sn_step] |
131 | leanexplore_declaration | leanexplore:388411 | leanexplore_sqlite | leanexplore_declarations | /-- Free variables are strongly normalizing. -/
lemma sn_fvar {x : Var} : SN (fvar x) := by
grind only [cases Xi, cases Beta, SN] |
763 | leanexplore_declaration | leanexplore:388412 | leanexplore_sqlite | leanexplore_declarations | /-- An application is strongly normalizing if the left and right terms are strongly normalizing,
as well as all possible future top level abstraction application beta reductions -/
lemma sn_app (t s : Term Var) (sn_t : SN t) (sn_s : SN s)
(hβ : ∀ {t' s' : Term Var}, t ↠βᶠ t'.abs → s ↠βᶠ s' → SN (t' ^ s')) : SN ... |
274 | leanexplore_declaration | leanexplore:388413 | leanexplore_sqlite | leanexplore_declarations | /-- The left side of a strongly normalizing application is strongly normalizing. -/
lemma sn_app_left (M N : Term Var) (lc_N : Term.LC N) (sn_MN : SN (M.app N)) :
SN M := by
generalize Heq : M.app N = P
rw [Heq] at sn_MN
induction sn_MN generalizing M N with grind |
276 | leanexplore_declaration | leanexplore:388414 | leanexplore_sqlite | leanexplore_declarations | /-- The right side of a strongly normalizing application is strongly normalizing. -/
lemma sn_app_right (M N : Term Var) (lc_N : Term.LC M) (sn_MN : SN (M.app N)) :
SN N := by
generalize Heq : M.app N = P
rw [Heq] at sn_MN
induction sn_MN generalizing M N with grind |
463 | leanexplore_declaration | leanexplore:388415 | leanexplore_sqlite | leanexplore_declarations | /-- A neutral term is a term of the form v t₁ … t_n where
v is a variable and t₁ … t_n are strongly normalizing terms. -/
@[scoped grind]
inductive Neutral : Term Var → Prop
/-- Just a bound variable is neutral. -/
| bvar : ∀ n, Neutral (bvar n)
/-- Just a free variable is neutral. -/
| fvar : ∀ x, Neutral (fvar x)... |
71 | leanexplore_declaration | leanexplore:388416 | leanexplore_sqlite | leanexplore_declarations | /-- Just a bound variable is neutral. -/
| bvar : ∀ n, Neutral (bvar n) |
70 | leanexplore_declaration | leanexplore:388417 | leanexplore_sqlite | leanexplore_declarations | /-- Just a free variable is neutral. -/
| fvar : ∀ x, Neutral (fvar x) |
142 | leanexplore_declaration | leanexplore:388418 | leanexplore_sqlite | leanexplore_declarations | /-- Applying a strongly normalizing term to a neutral term yields a neutral term. -/
| app : ∀ t1 t2, Neutral t1 → SN t2 → Neutral (app t1 t2) |
228 | leanexplore_declaration | leanexplore:388419 | leanexplore_sqlite | leanexplore_declarations | /-- Neutral terms only reduce to other neutral terms in a single step -/
lemma neutral_step (Hneut : Neutral t) (Hstep : t ⭢βᶠ t') : Neutral t' := by
induction Hneut generalizing t' with grind only [Neutral, cases Xi, sn_step] |
196 | leanexplore_declaration | leanexplore:388420 | leanexplore_sqlite | leanexplore_declarations | /-- Neutral terms only reduce to other neutral terms in multiple steps -/
lemma neutral_steps (Hneut : Neutral t) (Hsteps : t ↠βᶠ t') : Neutral t' := by
induction Hsteps <;> grind [neutral_step] |
197 | leanexplore_declaration | leanexplore:388421 | leanexplore_sqlite | leanexplore_declarations | /-- Neutral terms are strongly normalizing. -/
lemma sn_neutral (Hneut : Neutral t) : SN t := by
induction Hneut with
| app => grind [→ neutral_steps, sn_app]
| _ => grind only [SN, cases Xi] |
441 | leanexplore_declaration | leanexplore:388422 | leanexplore_sqlite | leanexplore_declarations | /-- A lambda abstraction is strongly normalizing if its body is strongly normalizing. -/
lemma sn_abs [DecidableEq Var] [HasFresh Var] {M N : Term Var} (sn_MN : SN (M ^ N)) (lc_N : LC N) :
SN (abs M) := by
generalize h : (M ^ N) = M_open at sn_MN
induction sn_MN generalizing M N with
| sn =>
constructor
... |
1,721 | leanexplore_declaration | leanexplore:388423 | leanexplore_sqlite | leanexplore_declarations | /-- A term of the form λ M N P_1 … P_n is strongly normalizing if
1. N is strongly normalizing,
1. M ^ N P₁ … Pₙ is strongly normalizing,
1. N is locally closed,
1. M ^ N P₁ … Pₙ is locally closed -/
lemma sn_abs_app_multiApp [DecidableEq Var] [HasFresh Var] {Ps} {M N : Term Var}
(sn_N : SN ... |
165 | leanexplore_declaration | leanexplore:388424 | leanexplore_sqlite | leanexplore_declarations | /-- Syntax of terms. -/
inductive Term (Var : Type u) : Type u where
| var (x : Var)
| abs (x : Var) (m : Term Var)
| app (m n : Term Var)
deriving DecidableEq |
148 | leanexplore_declaration | leanexplore:388430 | leanexplore_sqlite | leanexplore_declarations | /-- Free variables. -/
def Term.fv [DecidableEq Var] : Term Var → Finset Var
| var x => {x}
| abs x m => m.fv.erase x
| app m n => m.fv ∪ n.fv |
178 | leanexplore_declaration | leanexplore:388431 | leanexplore_sqlite | leanexplore_declarations | /-- Bound variables. -/
def Term.bv [DecidableEq Var] : Term Var → Finset Var
| var _ => ∅
| abs x m => m.bv ∪ {x} -- Could also be `insert x m.bv`
| app m n => m.bv ∪ n.bv |
126 | leanexplore_declaration | leanexplore:388432 | leanexplore_sqlite | leanexplore_declarations | /-- Variable names (free and bound) in a term. -/
def Term.vars [DecidableEq Var] (m : Term Var) : Finset Var :=
m.fv ∪ m.bv |
434 | leanexplore_declaration | leanexplore:388433 | leanexplore_sqlite | leanexplore_declarations | /-- Capture-avoiding substitution, as an inference system. -/
inductive Term.Subst [DecidableEq Var] : Term Var → Var → Term Var → Term Var → Prop where
| varHit : (var x).Subst x r r
| varMiss : x ≠ y → (var y).Subst x r (var y)
| absShadow : (abs x m).Subst x r (abs x m)
| absIn : x ≠ y → y ∉ r.fv → m.Subst x... |
45 | leanexplore_declaration | leanexplore:388435 | leanexplore_sqlite | leanexplore_declarations | | varMiss : x ≠ y → (var y).Subst x r (var y) |
43 | leanexplore_declaration | leanexplore:388436 | leanexplore_sqlite | leanexplore_declarations | | absShadow : (abs x m).Subst x r (abs x m) |
76 | leanexplore_declaration | leanexplore:388437 | leanexplore_sqlite | leanexplore_declarations | | absIn : x ≠ y → y ∉ r.fv → m.Subst x r m' → (abs y m).Subst x r (abs y m') |
73 | leanexplore_declaration | leanexplore:388438 | leanexplore_sqlite | leanexplore_declarations | | app : m.Subst x r m' → n.Subst x r n' → (app m n).Subst x r (app m' n') |
382 | leanexplore_declaration | leanexplore:388439 | leanexplore_sqlite | leanexplore_declarations | /-- Renaming, or variable substitution. `m.rename x y` renames `x` into `y` in `m`. -/
def Term.rename [DecidableEq Var] (m : Term Var) (x y : Var) : Term Var :=
match m with
| var z => if z = x then (var y) else (var z)
| abs z m' =>
if z = x then
-- Shadowing
abs z m'
else
abs z (m'.re... |
206 | leanexplore_declaration | leanexplore:388440 | leanexplore_sqlite | leanexplore_declarations | /-- Renaming preserves size. -/
@[simp]
theorem Term.rename.eq_sizeOf {m : Term Var} {x y : Var} [DecidableEq Var] :
sizeOf (m.rename x y) = sizeOf m := by
induction m <;> aesop (add simp [Term.rename]) |
630 | leanexplore_declaration | leanexplore:388441 | leanexplore_sqlite | leanexplore_declarations | /-- Capture-avoiding substitution. `m.subst x r` replaces the free occurrences of variable `x`
in `m` with `r`. -/
def Term.subst [DecidableEq Var] [HasFresh Var] (m : Term Var) (x : Var) (r : Term Var) :
Term Var :=
match m with
| var y => if y = x then r else var y
| abs y m' =>
if y = x then
abs y ... |
234 | leanexplore_declaration | leanexplore:388442 | leanexplore_sqlite | leanexplore_declarations | /-- `Term.subst` is a substitution for λ-terms. Gives access to the notation `m[x := n]`. -/
instance instHasSubstitutionTerm [DecidableEq Var] [HasFresh Var] :
HasSubstitution (Term Var) Var (Term Var) where
subst := Term.subst |
214 | leanexplore_declaration | leanexplore:388443 | leanexplore_sqlite | leanexplore_declarations | /-- Contexts. -/
inductive Context (Var : Type u) : Type u where
| hole
| abs (x : Var) (c : Context Var)
| appL (c : Context Var) (m : Term Var)
| appR (m : Term Var) (c : Context Var)
deriving DecidableEq |
260 | leanexplore_declaration | leanexplore:388450 | leanexplore_sqlite | leanexplore_declarations | /-- Replaces the hole in a `Context` with a `Term`. -/
def Context.fill (c : Context Var) (m : Term Var) : Term Var :=
match c with
| hole => m
| abs x c => Term.abs x (c.fill m)
| appL c n => Term.app (c.fill m) n
| appR n c => Term.app n (c.fill m) |
503 | leanexplore_declaration | leanexplore:388451 | leanexplore_sqlite | leanexplore_declarations | /-- Any `Term` can be obtained by filling a `Context` with a variable. This proves that `Context`
completely captures the syntax of terms. -/
theorem Context.complete (m : Term Var) :
∃ (c : Context Var) (x : Var), m = (c.fill (Term.var x)) := by
induction m with
| var x => exists hole, x
| abs x n ih =>
... |
478 | leanexplore_declaration | leanexplore:388452 | leanexplore_sqlite | leanexplore_declarations | /-- α-equivalence. -/
inductive Term.AlphaEquiv [DecidableEq Var] : Term Var → Term Var → Prop where
-- The α-axiom
| ax {m : Term Var} {x y : Var} :
y ∉ m.fv → AlphaEquiv (abs x m) (abs y (m.rename x y))
-- Equivalence relation rules
| refl : AlphaEquiv m m
| symm : AlphaEquiv m n → AlphaEquiv n m
| trans : AlphaEqu... |
90 | leanexplore_declaration | leanexplore:388453 | leanexplore_sqlite | leanexplore_declarations | | ax {m : Term Var} {x y : Var} :
y ∉ m.fv → AlphaEquiv (abs x m) (abs y (m.rename x y)) |
40 | leanexplore_declaration | leanexplore:388455 | leanexplore_sqlite | leanexplore_declarations | | symm : AlphaEquiv m n → AlphaEquiv n m |
64 | leanexplore_declaration | leanexplore:388456 | leanexplore_sqlite | leanexplore_declarations | | trans : AlphaEquiv m1 m2 → AlphaEquiv m2 m3 → AlphaEquiv m1 m3 |
92 | leanexplore_declaration | leanexplore:388457 | leanexplore_sqlite | leanexplore_declarations | | ctx {c : Context Var} {m n : Term Var} : AlphaEquiv m n → AlphaEquiv (c.fill m) (c.fill n) |
156 | leanexplore_declaration | leanexplore:388458 | leanexplore_sqlite | leanexplore_declarations | /-- Instance for the notation `m =α n`. -/
instance instHasAlphaEquivTerm [DecidableEq Var] : HasAlphaEquiv (Term Var) where
AlphaEquiv := Term.AlphaEquiv |
256 | leanexplore_declaration | leanexplore:388459 | leanexplore_sqlite | leanexplore_declarations | /-- Propositions. -/
inductive Proposition (Label : Type u) : Type u where
| true
| false
| and (φ₁ φ₂ : Proposition Label)
| or (φ₁ φ₂ : Proposition Label)
| diamond (μ : Label) (φ : Proposition Label)
| box (μ : Label) (φ : Proposition Label) |
45 | leanexplore_declaration | leanexplore:388464 | leanexplore_sqlite | leanexplore_declarations | | diamond (μ : Label) (φ : Proposition Label) |
41 | leanexplore_declaration | leanexplore:388465 | leanexplore_sqlite | leanexplore_declarations | | box (μ : Label) (φ : Proposition Label) |
301 | leanexplore_declaration | leanexplore:388466 | leanexplore_sqlite | leanexplore_declarations | /-- Negation of a proposition. -/
@[simp, scoped grind =]
def Proposition.neg (a : Proposition Label) : Proposition Label :=
match a with
| .true => .false
| .false => .true
| and a b => or a.neg b.neg
| or a b => and a.neg b.neg
| diamond μ a => box μ a.neg
| box μ a => diamond μ a.neg |
174 | leanexplore_declaration | leanexplore:388467 | leanexplore_sqlite | leanexplore_declarations | /-- Finite conjunction of propositions. -/
@[simp, scoped grind =]
def Proposition.finiteAnd (as : List (Proposition Label)) : Proposition Label :=
List.foldr .and .true as |
173 | leanexplore_declaration | leanexplore:388468 | leanexplore_sqlite | leanexplore_declarations | /-- Finite disjunction of propositions. -/
@[simp, scoped grind =]
def Proposition.finiteOr (as : List (Proposition Label)) : Proposition Label :=
List.foldr .or .false as |
877 | leanexplore_declaration | leanexplore:388469 | leanexplore_sqlite | leanexplore_declarations | /-- Satisfaction relation. `Satisfies lts s a` means that, in the LTS `lts`, the state `s` satisfies
the proposition `a`. -/
@[scoped grind]
inductive Satisfies (lts : LTS State Label) : State → Proposition Label → Prop where
| true {s : State} : Satisfies lts s .true
| and {s : State} {a b : Proposition Label} :
... |
42 | leanexplore_declaration | leanexplore:388470 | leanexplore_sqlite | leanexplore_declarations | | true {s : State} : Satisfies lts s .true |
120 | leanexplore_declaration | leanexplore:388471 | leanexplore_sqlite | leanexplore_declarations | | and {s : State} {a b : Proposition Label} :
Satisfies lts s a → Satisfies lts s b →
Satisfies lts s (.and a b) |
95 | leanexplore_declaration | leanexplore:388472 | leanexplore_sqlite | leanexplore_declarations | | or₁ {s : State} {a b : Proposition Label} :
Satisfies lts s a → Satisfies lts s (.or a b) |
95 | leanexplore_declaration | leanexplore:388473 | leanexplore_sqlite | leanexplore_declarations | | or₂ {s : State} {a b : Proposition Label} :
Satisfies lts s b → Satisfies lts s (.or a b) |
145 | leanexplore_declaration | leanexplore:388474 | leanexplore_sqlite | leanexplore_declarations | | diamond {s s' : State} {μ : Label} {a : Proposition Label}
(htr : lts.Tr s μ s') (hs : Satisfies lts s' a) : Satisfies lts s (.diamond μ a) |
137 | leanexplore_declaration | leanexplore:388475 | leanexplore_sqlite | leanexplore_declarations | | box {s : State} {μ : Label} {a : Proposition Label}
(h : ∀ s', lts.Tr s μ s' → Satisfies lts s' a) :
Satisfies lts s (.box μ a) |
445 | leanexplore_declaration | leanexplore:388476 | leanexplore_sqlite | leanexplore_declarations | /-- Denotation of a proposition. -/
@[simp, scoped grind =]
def Proposition.denotation (a : Proposition Label) (lts : LTS State Label)
: Set State :=
match a with
| .true => Set.univ
| .false => ∅
| .and a b => a.denotation lts ∩ b.denotation lts
| .or a b => a.denotation lts ∪ b.denotation lts
| .diamo... |
182 | leanexplore_declaration | leanexplore:388477 | leanexplore_sqlite | leanexplore_declarations | /-- The theory of a state is the set of all propositions that it satifies. -/
abbrev theory (lts : LTS State Label) (s : State) : Set (Proposition Label) :=
{a | Satisfies lts s a} |
181 | leanexplore_declaration | leanexplore:388478 | leanexplore_sqlite | leanexplore_declarations | /-- Two states are theory-equivalent (for a specific LTS) if they have the same theory. -/
abbrev TheoryEq (lts : LTS State Label) (s1 s2 : State) :=
theory lts s1 = theory lts s2 |
230 | leanexplore_declaration | leanexplore:388479 | leanexplore_sqlite | leanexplore_declarations | /-- Characterisation theorem for the denotational semantics. -/
@[scoped grind =]
theorem satisfies_mem_denotation {lts : LTS State Label} :
Satisfies lts s a ↔ s ∈ a.denotation lts := by
induction a generalizing s <;> grind |
259 | leanexplore_declaration | leanexplore:388480 | leanexplore_sqlite | leanexplore_declarations | /-- A state satisfies a proposition iff it does not satisfy the negation of the proposition. -/
@[simp, scoped grind =]
theorem neg_satisfies {lts : LTS State Label} :
¬Satisfies lts s a.neg ↔ Satisfies lts s a := by
induction a generalizing s <;> grind |
308 | leanexplore_declaration | leanexplore:388481 | leanexplore_sqlite | leanexplore_declarations | /-- A state is in the denotation of a proposition iff it is not in the denotation of the negation
of the proposition. -/
@[scoped grind =]
theorem neg_denotation {lts : LTS State Label} (a : Proposition Label) :
s ∉ a.neg.denotation lts ↔ s ∈ a.denotation lts := by
grind [_=_ satisfies_mem_denotation] |
305 | leanexplore_declaration | leanexplore:388482 | leanexplore_sqlite | leanexplore_declarations | /-- A state satisfies a finite conjunction iff it satisfies all conjuncts. -/
@[scoped grind =]
theorem satisfies_finiteAnd {lts : LTS State Label} {s : State}
{as : List (Proposition Label)} :
Satisfies lts s (Proposition.finiteAnd as) ↔ ∀ a ∈ as, Satisfies lts s a := by
induction as <;> grind |
303 | leanexplore_declaration | leanexplore:388483 | leanexplore_sqlite | leanexplore_declarations | /-- A state satisfies a finite disjunction iff it satisfies some disjunct. -/
@[scoped grind =]
theorem satisfies_finiteOr {lts : LTS State Label} {s : State}
{as : List (Proposition Label)} :
Satisfies lts s (Proposition.finiteOr as) ↔ ∃ a ∈ as, Satisfies lts s a := by
induction as <;> grind |
99 | leanexplore_declaration | leanexplore:388484 | leanexplore_sqlite | leanexplore_declarations | @[scoped grind →]
theorem satisfies_theory (h : Satisfies lts s a) : a ∈ theory lts s := by
grind |
283 | leanexplore_declaration | leanexplore:388485 | leanexplore_sqlite | leanexplore_declarations | /-- Two states are theory-equivalent iff they are denotationally equivalent. -/
theorem theoryEq_denotation_eq {lts : LTS State Label} :
TheoryEq lts s1 s2 ↔
(∀ a : Proposition Label, s1 ∈ a.denotation lts ↔ s2 ∈ a.denotation lts) := by
grind [_=_ satisfies_mem_denotation] |
233 | leanexplore_declaration | leanexplore:388486 | leanexplore_sqlite | leanexplore_declarations | /-- If two states are not theory equivalent, there exists a distinguishing proposition. -/
lemma not_theoryEq_satisfies (h : ¬ TheoryEq lts s1 s2) :
∃ a, (Satisfies lts s1 a ∧ ¬Satisfies lts s2 a) := by
grind [=_ neg_satisfies] |
314 | leanexplore_declaration | leanexplore:388487 | leanexplore_sqlite | leanexplore_declarations | /-- If two states are theory equivalent and the former satisfies a proposition, the latter does as
well. -/
theorem theoryEq_satisfies {lts : LTS State Label} (h : TheoryEq lts s1 s2)
(hs : Satisfies lts s1 a) : Satisfies lts s2 a := by
unfold TheoryEq theory at h
rw [Set.ext_iff] at h
exact (h a).mp hs |
156 | leanexplore_declaration | leanexplore:388488 | leanexplore_sqlite | leanexplore_declarations | /-- The list of propositions over finite μ-derivatives. -/
noncomputable def propositions : List (Proposition Label) :=
finImage.elems.toList.map stateMap |
173 | leanexplore_declaration | leanexplore:388489 | leanexplore_sqlite | leanexplore_declarations | theorem propositions_complete (s' : lts.image s μ) : stateMap s' ∈ propositions stateMap := by
apply List.mem_map.mpr
use s', Finset.mem_toList.mpr (Fintype.complete s') |
323 | leanexplore_declaration | leanexplore:388490 | leanexplore_sqlite | leanexplore_declarations | theorem propositions_satisfies_conjunction (htr : lts.Tr s1 μ s1')
(hdist_spec : ∀ s2', Satisfies lts s1' (stateMap s2')) :
Satisfies lts s1 (.diamond μ <| Proposition.finiteAnd (propositions stateMap)) := by
apply Satisfies.diamond htr
rw [satisfies_finiteAnd]
intro a ha_mem
grind [List.mem_map.mp ha_m... |
1,564 | leanexplore_declaration | leanexplore:388491 | leanexplore_sqlite | leanexplore_declarations | /-- Theory equivalence is a bisimulation. -/
@[scoped grind ⇒]
theorem theoryEq_isBisimulation (lts : LTS State Label)
[image_finite : ∀ s μ, Finite (lts.image s μ)] :
lts.IsHomBisimulation (TheoryEq lts) := by
intro s1 s2 h μ
let (s : State) := @Fintype.ofFinite (lts.image s μ) (image_finite s μ)
constru... |
445 | leanexplore_declaration | leanexplore:388492 | leanexplore_sqlite | leanexplore_declarations | /-- If two states are in a bisimulation and the former satisfies a proposition, the latter does as
well. -/
@[scoped grind ⇒]
lemma bisimulation_satisfies {lts : LTS State Label}
{hrb : lts.IsHomBisimulation r}
(hr : r s1 s2) (a : Proposition Label) (hs : Satisfies lts s1 a) :
Satisfies lts s2 a := by
ind... |
199 | leanexplore_declaration | leanexplore:388493 | leanexplore_sqlite | leanexplore_declarations | lemma bisimulation_TheoryEq {lts : LTS State Label}
{hrb : lts.IsHomBisimulation r}
(hr : r s1 s2) :
TheoryEq lts s1 s2 := by
have : s2 ~[lts] s1 := by grind [Bisimilarity.symm]
grind |
383 | leanexplore_declaration | leanexplore:388494 | leanexplore_sqlite | leanexplore_declarations | /-- Theory equivalence and bisimilarity coincide for image-finite LTSs. -/
theorem theoryEq_eq_bisimilarity (lts : LTS State Label)
[image_finite : ∀ s μ, Finite (lts.image s μ)] :
TheoryEq lts = HomBisimilarity lts := by
ext s1 s2
apply Iff.intro <;> intro h
· exists TheoryEq lts
grind
· obtain ⟨r,... |
203 | leanexplore_declaration | leanexplore:388495 | leanexplore_sqlite | leanexplore_declarations | /-- Logical equivalence for HML propositions. -/
def Proposition.Equiv {State : Type u} {Label : Type v} (a b : Proposition Label) : Prop :=
∀ lts : LTS State Label, a.denotation lts = b.denotation lts |
219 | leanexplore_declaration | leanexplore:388496 | leanexplore_sqlite | leanexplore_declarations | @[scoped grind =]
theorem Proposition.equiv_def {State : Type u} {Label : Type v} (a b : Proposition Label) :
Equiv (State := State) a b ↔
(∀ lts : LTS State Label, a.denotation lts = b.denotation lts) := by rfl |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.