id
int64
1
500
thm_name
stringlengths
5
86
thm_stmt
stringlengths
30
2.63k
lean_root
stringclasses
23 values
rel_path
stringlengths
13
61
imports
listlengths
0
35
used_lib_defs
listlengths
1
144
used_repo_defs
listlengths
1
251
lib_lemmas
listlengths
1
172
repo_lemmas
listlengths
1
148
used_local_defs
listlengths
0
85
used_local_lemmas
listlengths
0
57
local_ctx
stringlengths
35
30.7k
target_theorem
stringlengths
33
1.57k
ground_truth_proof
stringlengths
6
26.5k
nesting_depth
int64
1
27
transitive_dep_count
int64
1
480
subset_aristotle
bool
2 classes
category
stringclasses
5 values
401
evalExact_frame
lemma evalExact_frame (h1 h2 : state) t (Q : val β†’ hProp) : evalExact h1 t (ofhProp Q) β†’ Finmap.Disjoint h1 h2 β†’ evalExact (h1 βˆͺ h2) t (Q βˆ— (tohProp (fun h ↦ h = h2)))
splean
SPLean/Theories/SepLog.lean
[ "import SPLean.Theories.Lang", "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "syntax \"fun\" ident+ \" => \" lang : lang", "content": "syntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" <= \" : bop\n\nsyntax \" >= \" : bop\n\nsyntax \"not\" : uop\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\...
[ { "name": "Finmap.insert_union", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.Disjoint.symm_iff", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.disjoint_union_left", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.mem_iff", "module": "Mathlib.Data.Finm...
[ { "name": "in_read_union_l", "content": "lemma in_read_union_l (h1 h2 : state) (x : loc) :\n x ∈ h1 β†’ read_state x (h1 βˆͺ h2) = read_state x h1" }, { "name": "disjoint_insert_l", "content": "lemma disjoint_insert_l (h1 h2 : state) (x : loc) (v : val) :\n Finmap.Disjoint h1 h2 β†’\n x ∈ h1 β†’\n F...
[ { "name": "tohProp", "content": "abbrev tohProp (h : heap -> Prop) : hProp := h" }, { "name": "ofhProp", "content": "abbrev ofhProp (h : val -> hProp) : val -> heap -> Prop := h" } ]
[ { "name": "frame_eq_rw", "content": "lemma frame_eq_rw :\n s.Disjoint h2 β†’\n (fun v' s' ↦ v' = v ∧ s' = s βˆͺ h2) =\n (qstar (fun v' s' ↦ v' = v ∧ s' = s) (tohProp (fun h ↦ h = h2)))" }, { "name": "evalExact_frame_val", "content": "lemma evalExact_frame_val (v : val) (s h2 : state) :\n s.Disjo...
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim notation "funloc" p "↦" H => fun (r : val) ↦ hexists (fun p ↦ ⌜r = val_loc p⌝ βˆ— H) se...
lemma evalExact_frame (h1 h2 : state) t (Q : val β†’ hProp) : evalExact h1 t (ofhProp Q) β†’ Finmap.Disjoint h1 h2 β†’ evalExact (h1 βˆͺ h2) t (Q βˆ— (tohProp (fun h ↦ h = h2))) :=
:= by simp [ofhProp] move=> /== heval elim: heval h2 { move=> > * sby apply evalExact_frame_val } { move=> > * sby apply evalExact_frame_val } { move=> > * sby apply evalExact_frame_val } { move=> ???????? ih1 ?? /ih1 ? ; constructor=>// sby move=> ?? ![] } { move=> ???????? ih1 ?? /ih1 ...
6
82
false
Framework
402
Theories.eval_like_trm_apps_funs_pre
lemma eval_like_trm_apps_funs_pre (heqv0 : v0 = trm_funs xs t1) : eval_like t (trm_apps (val_funs xs t1) ts) ∧ -- NOTE: this part do not require `xs.Nodup`, but anyway eval_like (isubst (xs.mkAlist vs) t1) t
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import SPLean.Theories.Lang", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lea...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "AList", "module": "Mathlib.Data.List.AList" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"fun\" ident+ \" => \" lang : lang", "content": "syntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term \"⟩\" : lang\n\nsyntax \"⟨\" term \":\" term \"⟩\" : lang\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \...
[ { "name": "AList.keys_nodup", "module": "Mathlib.Data.List.AList" }, { "name": "List.dlookup_dedupKeys", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.lookup_ext", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.perm_dlookup", "module": "Mathlib.Data.List....
[ { "name": "eval_app_arg1'", "content": "lemma eval_app_arg1' s1 t1 t2 Q1 Q :\n eval s1 t1 Q1 ->\n (forall v1 s2, Q1 v1 s2 -> eval s2 (trm_app v1 t2) Q) ->\n eval s1 (trm_app t1 t2) Q" } ]
[ { "name": "Theories.trms_to_vals", "content": "@[simp]\ndef trms_to_vals (ts:List trm) : Option (List val) := do\n match ts with\n | [] => return []\n | (trm_val v) :: ts' => v :: (<- trms_to_vals ts')\n | _ => failure" }, { "name": "Theories.ctx", "content": "abbrev ctx := AList (fun _ : va...
[ { "name": "Theories.trms_to_vals_some_equiv", "content": "lemma trms_to_vals_some_equiv ts vs : trms_to_vals ts = some vs β†’ ts = vs.map trm_val" }, { "name": "Theories.List.toAList_perm", "content": "lemma List.toAList_perm {Ξ± : Type u} {Ξ² : Ξ± β†’ Type v} [DecidableEq Ξ±]\n (es es' : List (Sigma Ξ²...
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma eval_like_trm_apps_funs_pre (heqv0 : v0 = trm_funs xs t1) : eval_like t (trm_apps (val_funs xs t1) ts) ∧ -- NOTE: this part do not require `xs.Nodup`, but anyway eval_like (isubst (xs.mkAlist vs) t1) t :=
:= by apply trms_to_vals_some_equiv at hconv ; subst_eqs move: hform=> /== hnodup hlen hnotempty move: hnodup vs hlen t1 induction xs using List.list_reverse_induction with | base => sdone | ind xs x ih => move=> { hnotempty } /(List.nodup_middle (lβ‚‚ := [])) /== hnotin hnodup vs hlen t1 by_cases hvs...
5
102
false
Framework
403
eval_frame
lemma eval_frame (h1 h2 : state) t (Q : val -> hProp) : eval h1 t (ofhProp Q) β†’ Finmap.Disjoint h1 h2 β†’ eval (h1 βˆͺ h2) t (Q βˆ— (tohProp (fun h ↦ h = h2)))
splean
SPLean/Theories/SepLog.lean
[ "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "syntax \"fun\" ident+ \" => \" lang : lang", "content": "syntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term \"⟩\" : lang\n\nsyntax \"⟨\" term \":\" term \"⟩\" : lang" }, { "name": "macro_rules", "content": "macro_rules\n | `([lang| ()]) => `(trm_val...
[ { "name": "Finmap.disjoint_union_left", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.insert_union", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.union_assoc", "module": "Mathlib.Data.Finmap" } ]
[ { "name": "union_diff_disjoint_r", "content": "lemma union_diff_disjoint_r (h₁ hβ‚‚ h₃ : state) :\n hβ‚‚.Disjoint h₃ β†’\n (h₁ βˆͺ hβ‚‚) \\ h₃ = (h₁ \\ h₃) βˆͺ hβ‚‚" }, { "name": "lookup_diff", "content": "lemma lookup_diff (h₁ hβ‚‚ : state) :\n p βˆ‰ hβ‚‚ β†’\n (h₁ \\ hβ‚‚).lookup p = h₁.lookup p" }, { "na...
[ { "name": "tohProp", "content": "abbrev tohProp (h : heap -> Prop) : hProp := h" }, { "name": "ofhProp", "content": "abbrev ofhProp (h : val -> hProp) : val -> heap -> Prop := h" } ]
[ { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eval s t Q2" } ]
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim notation "funloc" p "↦" H => fun (r : val) ↦ hexists (fun p ↦ ⌜r = val_loc p⌝ βˆ— H) se...
lemma eval_frame (h1 h2 : state) t (Q : val -> hProp) : eval h1 t (ofhProp Q) β†’ Finmap.Disjoint h1 h2 β†’ eval (h1 βˆͺ h2) t (Q βˆ— (tohProp (fun h ↦ h = h2))) :=
:= by unfold ofhProp tohProp; elim=> // { move=> > ?? _ ih' *; apply eval.eval_app_arg1=> // move=> > ![] ?? ? -> ? ->; aesop } { move=> *; apply eval.eval_app_arg2=> // move=> > ![] ?? ? -> ? ->; aesop } { move=> *; apply eval.eval_app_fun=> // } { move=> *; apply eval.eval_app_fix=> // } { move=> ...
6
55
false
Framework
404
evalExact_WellAlloc
lemma evalExact_WellAlloc : evalExact s t Q β†’ Q v s' β†’ s'.keys = s.keys
splean
SPLean/Theories/SepLog.lean
[ "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finm...
[ { "name": "syntax \"fun\" ident+ \" => \" lang : lang", "content": "syntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" <= \" : bop\n\nsyntax \" >= \" : bop\n\nsyntax \"not\" : uop\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\...
[ { "name": "Finmap.mem_keys", "module": "Mathlib.Data.Finmap" }, { "name": "Finset.le_max_of_eq", "module": "Mathlib.Data.Finset.Max" }, { "name": "Finset.max_of_nonempty", "module": "Mathlib.Data.Finset.Max" }, { "name": "Finset.nonempty_iff_ne_empty", "module": "Mathlib....
[ { "name": "non_mem_union", "content": "lemma non_mem_union (h1 h2 : state) :\n a βˆ‰ h1 βˆͺ h2 ↔ a βˆ‰ h1 ∧ a βˆ‰ h2" }, { "name": "insert_mem_keys", "content": "lemma insert_mem_keys (s : state) :\n p ∈ s β†’\n (s.insert p v).keys = s.keys" }, { "name": "insert_same", "content": "lemma ins...
[]
[ { "name": "finite_state", "content": "lemma finite_state (s : state) :\n βˆƒ p, p βˆ‰ s" }, { "name": "conseq_ind", "content": "lemma conseq_ind (n : β„•) (v : val) (p : loc) :\n x ∈ conseq (make_list n v) p β†’ x β‰₯ p" }, { "name": "finite_state'", "content": "lemma finite_state' n (s : st...
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim notation "funloc" p "↦" H => fun (r : val) ↦ hexists (fun p ↦ ⌜r = val_loc p⌝ βˆ— H) se...
lemma evalExact_WellAlloc : evalExact s t Q β†’ Q v s' β†’ s'.keys = s.keys :=
:= by move=> hev elim: hev s' v { sby move=> > [] } { sby move=> > [] } { sby move=> > [] } { move=> > _ /evalExact_sat ![>] /[dup] hQ1 /[swap] _ /[swap] /[apply] heq move: hQ1=> /[swap] /[apply] /[apply] sby srw heq=> {}heq > /heq } { move=> > _ /evalExact_sat ![>] /[dup] hQ1 /[swap] _ /[swap] /[...
6
62
false
Framework
405
evalExact_post
lemma evalExact_post : eval s t Q β†’ evalExact s t Q' β†’ Q' ===> Q
splean
SPLean/Theories/SepLog.lean
[ "import SPLean.Theories.Lang", "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "syntax \"fun\" ident+ \" => \" lang : lang", "content": "syntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" <= \" : bop\n\nsyntax \" >= \" : bop\n\nsyntax \"not\" : uop\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\...
[ { "name": "Finmap.mem_keys", "module": "Mathlib.Data.Finmap" }, { "name": "Finset.le_max_of_eq", "module": "Mathlib.Data.Finset.Max" }, { "name": "Finset.max_of_nonempty", "module": "Mathlib.Data.Finset.Max" }, { "name": "Finset.nonempty_iff_ne_empty", "module": "Mathlib....
[ { "name": "non_mem_union", "content": "lemma non_mem_union (h1 h2 : state) :\n a βˆ‰ h1 βˆͺ h2 ↔ a βˆ‰ h1 ∧ a βˆ‰ h2" }, { "name": "evalbinop_unique", "content": "lemma evalbinop_unique :\n evalbinop op v1 v2 P β†’ evalbinop op v1 v2 P' β†’ P = P'" }, { "name": "insert_delete_id", "content": "...
[]
[ { "name": "finite_state", "content": "lemma finite_state (s : state) :\n βˆƒ p, p βˆ‰ s" }, { "name": "conseq_ind", "content": "lemma conseq_ind (n : β„•) (v : val) (p : loc) :\n x ∈ conseq (make_list n v) p β†’ x β‰₯ p" }, { "name": "finite_state'", "content": "lemma finite_state' n (s : st...
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim notation "funloc" p "↦" H => fun (r : val) ↦ hexists (fun p ↦ ⌜r = val_loc p⌝ βˆ— H) se...
lemma evalExact_post : eval s t Q β†’ evalExact s t Q' β†’ Q' ===> Q :=
:= by move=> H elim: H Q'=> > -- elim=> > { sby move=> ? > [] v h /== } { sby move=> ? > [] v h /== } { sby move=> ? > [] v h /== } { move=> ??? ih1 ih2 > [] // > { move=> > _ /[dup] h h' apply evalExact_sat in h=> ![] v s' /[dup] hQ1_1 hQ1_1' apply ih1 in h'=> himp hev apply himp in...
6
72
false
Framework
406
qwand_equiv
lemma qwand_equiv H A (Q1 Q2 : A β†’ hProp) : H ==> (Q1 -βˆ— Q2) ↔ (Q1 βˆ— H) ===> Q2
splean
SPLean/Theories/HProp.lean
[ "import Mathlib.Data.Finmap", "import SPLean.Common.Heap", "import SPLean.Theories.Lang", "import SPLean.Common.Util", "import Mathlib.Algebra.BigOperators.Group.Finset" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "syntax \"sdo\" num tactic : tactic", "content": "syntax \"sdo\" num tactic : tactic" }, { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"emp\" => hempty\n\nsyntax \"fun\" ident+ \" => \" lang : lang" }, { "name": "notation:max \"⌜\" P \"⌝\" => hpure P", ...
[ { "name": "Finmap.union_comm_of_disjoint", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.disjoint_union_left", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.disjoint_union_right", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.union_assoc", "module": "...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "hProp", "content": "def hProp := heap -> Prop" }, { "name": "himpl", "content": "abbrev himpl (H1 H2 : hProp) : Prop :=\n forall h, H1 h -> H2 h" }, { "name": "qimpl", "content": "def qimpl {A} (Q1 Q2 : A β†’ hProp) : Prop :=\n forall (v:A), Q1 v ==> Q2 v" }, { "na...
[ { "name": "himpl_trans", "content": "lemma himpl_trans H2 H1 H3 :\n (H1 ==> H2) β†’ (H2 ==> H3) β†’ (H1 ==> H3)" }, { "name": "himpl_antisym", "content": "lemma himpl_antisym H1 H2:\n (H1 ==> H2) β†’ (H2 ==> H1) β†’ (H1 = H2)" }, { "name": "hprop_op_comm", "content": "lemma hprop_op_comm (...
import Mathlib.Data.Finmap import Mathlib.Algebra.BigOperators.Group.Finset import SPLean.Common.Heap import SPLean.Common.Util import SPLean.Theories.Lang open Classical def hProp := heap -> Prop abbrev himpl (H1 H2 : hProp) : Prop := forall h, H1 h -> H2 h infixr:51 " ==> " => himpl def qimpl {A} (Q1 Q2 : ...
lemma qwand_equiv H A (Q1 Q2 : A β†’ hProp) : H ==> (Q1 -βˆ— Q2) ↔ (Q1 βˆ— H) ===> Q2 :=
:= by srw qwandE ; apply Iff.intro { move=> ? x srw qstarE hstar_comm apply (himpl_hstar_trans_l H (hforall fun x' ↦ Q1 x' -βˆ— Q2 x'))=>// apply (himpl_trans (hforall fun x0 ↦ ((Q1 x0 -βˆ— Q2 x0) βˆ— Q1 x))) apply hstar_hforall ; apply himpl_hforall_l rw [hstar_comm] ; apply hwand_cancel } srw qimp...
7
63
false
Framework
407
Theories.xwp_lemma_funs
lemma xwp_lemma_funs (xs : List _) (vs : List val) : t = trm_apps v0 ts -> v0 = val_funs xs t1 -> trms_to_vals ts = vs -> var_funs xs vs.length -> H ==> wpgen (isubst (xs.mkAlist vs) t1) Q -> triple t H Q
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import SPLean.Theories.Lang", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lea...
[ { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "AList", "module": "Mathlib.Data.List.AList" }, { "name": "Bool", "module": "Init.Prelude" }, { "name":...
[ { "name": "syntax \" != \" : bop", "content": "syntax \" != \" : bop\n\nsyntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term \"⟩\" : lang\n\nsyntax \"⟨\" term \":\" term \"⟩\" : lang\n\nsyntax \" := \" : bop" }, { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"em...
[ { "name": "AList.keys_nodup", "module": "Mathlib.Data.List.AList" }, { "name": "List.dlookup_dedupKeys", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.lookup_ext", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.perm_dlookup", "module": "Mathlib.Data.List....
[ { "name": "eval_app_arg1'", "content": "lemma eval_app_arg1' s1 t1 t2 Q1 Q :\n eval s1 t1 Q1 ->\n (forall v1 s2, Q1 v1 s2 -> eval s2 (trm_app v1 t2) Q) ->\n eval s1 (trm_app t1 t2) Q" }, { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eva...
[ { "name": "Theories.wp", "content": "def wp (t : trm) (Q : val β†’ hProp) : hProp :=\n fun s ↦ eval s t Q" }, { "name": "Theories.formula", "content": "abbrev formula := (val β†’ hProp) β†’ hProp" }, { "name": "Theories.mkstruct", "content": "def mkstruct (F : formula) :=\n fun (Q : val ...
[ { "name": "Theories.wp_equiv", "content": "lemma wp_equiv t H Q :\n (H ==> wp t Q) ↔ triple t H Q" }, { "name": "Theories.wp_conseq", "content": "lemma wp_conseq t Q1 Q2 :\n Q1 ===> Q2 β†’\n wp t Q1 ==> wp t Q2" }, { "name": "Theories.wp_frame", "content": "lemma wp_frame t H Q :\n ...
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma xwp_lemma_funs (xs : List _) (vs : List val) : t = trm_apps v0 ts -> v0 = val_funs xs t1 -> trms_to_vals ts = vs -> var_funs xs vs.length -> H ==> wpgen (isubst (xs.mkAlist vs) t1) Q -> triple t H Q :=
:= by move=> -> -> ?? h srw -wp_equiv ; apply himpl_trans ; apply (wp_of_wpgen h) apply wp_eval_like apply eval_like_trm_apps_funs=> //
11
228
false
Framework
408
Theories.xapp_simpl_lemma
lemma xapp_simpl_lemma (F : formula) : H ==> F Q -> H ==> F Q βˆ— (Q -βˆ— protect Q)
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lean", "import SPLean.Theories.WPU...
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "macro \"xsimp\" : tactic =>", "content": "macro \"xsimp\" : tactic =>\n `(tactic| (\n xsimp_start\n repeat xsimp_step\n try rev_pure\n try hide_mvars\n try hsimp\n rotate_left\n\n ))" }, { "name": "hProp", "content": "def hProp := heap -> Prop" }, { "name":...
[ { "name": "...", "module": "" } ]
[ { "name": "himpl_trans", "content": "lemma himpl_trans H2 H1 H3 :\n (H1 ==> H2) β†’ (H2 ==> H3) β†’ (H1 ==> H3)" }, { "name": "himpl_hempty_hwand_same", "content": "lemma himpl_hempty_hwand_same H :\n emp ==> (H -βˆ— H)" } ]
[ { "name": "Theories.formula", "content": "abbrev formula := (val β†’ hProp) β†’ hProp" } ]
[]
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma xapp_simpl_lemma (F : formula) : H ==> F Q -> H ==> F Q βˆ— (Q -βˆ— protect Q) :=
:= by move=> hh; apply himpl_trans ; apply hh ; xsimp
7
20
false
Framework
409
hseg_focus_relative
lemma hseg_focus_relative (k : Nat) L p j (v : 0 <= k ∧ k < L.length): hseg L p j ==> hcell L[k]! p (j + k) βˆ— (hβˆ€ w, hcell w p (j + k) -βˆ— hseg (L.set k w) p j)
splean
SPLean/Theories/Arrays.lean
[ "import SPLean.Theories.XChange", "import SPLean.Theories.Lang", "import SPLean.Theories.WP1", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"emp\" => hempty\n\nsyntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \" >= \" : bop" }, { "name": "notation:max \"⌜\" P \"⌝\" => hpure P", "content": "notation:max \"⌜\" P \"⌝\" => hpure P\n\nsyntax \"if \" lang \"then \" ...
[ { "name": "add_assoc", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "add_comm", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "List.concat_append", "module": "Init.Data.List.Lemmas" } ]
[ { "name": "hstar_comm_assoc", "content": "lemma hstar_comm_assoc (H1 H2 H3 : hProp) :\n H1 βˆ— H2 βˆ— H3 = H2 βˆ— H1 βˆ— H3" }, { "name": "himpl_frame_r", "content": "lemma himpl_frame_r H1 H2 H2' :\n H2 ==> H2' β†’\n (H1 βˆ— H2) ==> (H1 βˆ— H2')" }, { "name": "himpl_hforall_r", "content": "lem...
[]
[ { "name": "hseg_cons", "content": "lemma hseg_cons v p j L :\n hseg (v :: L) p j = hcell v p j βˆ— hseg L p (j + 1)" }, { "name": "hseg_app", "content": "lemma hseg_app L1 L2 p j :\n hseg (L1 ++ L2) p j =\n hseg L1 p j βˆ— hseg L2 p (j + L1.length)" }, { "name": "list_cons_length", "c...
import SPLean.Common.State import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Common.Util import SPLean.Theories.SepLog import SPLean.Theories.WP1 import SPLean.Theories.Lang open val trm prim open Theories
lemma hseg_focus_relative (k : Nat) L p j (v : 0 <= k ∧ k < L.length): hseg L p j ==> hcell L[k]! p (j + k) βˆ— (hβˆ€ w, hcell w p (j + k) -βˆ— hseg (L.set k w) p j) :=
:= by move: v=> [] ? /list_middle_inv ![> ?] hlen move: (Eq.symm hlen) => /nth_middle hmid subst L ; srw (hmid _ w_2 w) hseg_app hseg_cons hlen -hstar_comm_assoc apply himpl_frame_r apply himpl_hforall_r => ? move: (Eq.symm hlen) => /(update_middle val _ k w_1 w_2 w) hset srw hset ?List.concat_append ?hse...
9
49
false
Framework
410
triple_ref
lemma triple_ref (v : val) : (forall (p : loc), triple (subst x p t2) (H βˆ— (p ~~> v)) (Q βˆ— βˆƒΚ° v, p ~~> v)) β†’ triple (trm_ref x (trm_val v) t2) H Q
splean
SPLean/Theories/SepLog.lean
[ "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "syntax \"if \" lang \"then \" lang \"end \" : lang", "content": "syntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\" ppDedent(ppLine lang) : lang\n\nsyntax \"fun\" ident+ \" => \" lang : lang" }, { "name": "macro \"βˆƒΚ°\"...
[ { "name": "...", "module": "" } ]
[ { "name": "disjoint_single", "content": "lemma disjoint_single (h : state) :\n p βˆ‰ h β†’\n h.Disjoint (Finmap.singleton p v)" }, { "name": "hsingl_inv", "content": "lemma hsingl_inv p v h :\n (p ~~> v) h β†’\n h = Finmap.singleton p v" }, { "name": "union_singleton_eq_erase", "conten...
[ { "name": "triple", "content": "abbrev triple (t : trm) (H : hProp) (Q : val β†’ hProp) : Prop :=\n forall s, H s β†’ eval s t Q" } ]
[ { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eval s t Q2" }, { "name": "triple_conseq", "content": "lemma triple_conseq t H' Q' H Q :\n triple t H' Q' β†’\n H ==> H'β†’\n Q' ===> Q β†’\n triple t H Q" } ]
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim abbrev triple (t : trm) (H : hProp) (Q : val β†’ hProp) : Prop := forall s, H s β†’ eval s...
lemma triple_ref (v : val) : (forall (p : loc), triple (subst x p t2) (H βˆ— (p ~~> v)) (Q βˆ— βˆƒΚ° v, p ~~> v)) β†’ triple (trm_ref x (trm_val v) t2) H Q :=
:= by move=> htriple h ? apply eval.eval_ref { sby apply (eval.eval_val h v (fun v' h' ↦ v' = v ∧ h' = h)) } move=> > [->->] > ? move: (htriple p)=> /triple_conseq {}htriple have eqn:(triple (subst x p t2) (H βˆ— p ~~> v) fun v s ↦ Q v (s.erase p)) := by apply htriple=> // move=> > h /= ![>] ? /hexist...
5
48
false
Framework
411
triple_alloc
lemma triple_alloc (n : Int) : n β‰₯ 0 β†’ (βˆ€ (p : loc), triple (subst x p t) (H βˆ— ⌜p β‰  null⌝ βˆ— hrange (make_list n.natAbs val_uninit) p) (Q βˆ— ⌜p β‰  null⌝ βˆ— βˆƒΚ° L, ⌜L.length = n⌝ βˆ— hrange L p) ) β†’ triple (trm_alloc x n t) H Q
splean
SPLean/Theories/SepLog.lean
[ "import SPLean.Theories.Lang", "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"emp\" => hempty\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\" ppDedent(ppLine lang) : lang\n\nsyntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term ...
[ { "name": "Finmap.mem_keys", "module": "Mathlib.Data.Finmap" }, { "name": "Finset.ext_iff", "module": "Mathlib.Data.Finset.Defs" }, { "name": "Finmap.Disjoint.symm_iff", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.union_comm_of_disjoint", "module": "Mathlib.Data....
[ { "name": "hempty_inv", "content": "lemma hempty_inv h :\n emp h β†’ h = βˆ…" }, { "name": "hsingl_inv", "content": "lemma hsingl_inv p v h :\n (p ~~> v) h β†’\n h = Finmap.singleton p v" }, { "name": "hstar_intro", "content": "lemma hstar_intro (H1 H2 : hProp) h1 h2 :\n H1 h1 β†’\n H2 ...
[ { "name": "triple", "content": "abbrev triple (t : trm) (H : hProp) (Q : val β†’ hProp) : Prop :=\n forall s, H s β†’ eval s t Q" }, { "name": "hrange", "content": "def hrange (L : List val) (p : loc) : hProp :=\n match L with\n | [] => emp\n | x :: L' => (p ~~> x) βˆ— (hrange L' (p + 1))" ...
[ { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eval s t Q2" }, { "name": "triple_conseq", "content": "lemma triple_conseq t H' Q' H Q :\n triple t H' Q' β†’\n H ==> H'β†’\n Q' ===> Q β†’\n triple t H Q" }, { "name": "hrange_intro", ...
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim abbrev triple (t : trm) (H : hProp) (Q : val β†’ hProp) : Prop := forall s, H s β†’ eval s...
lemma triple_alloc (n : Int) : n β‰₯ 0 β†’ (βˆ€ (p : loc), triple (subst x p t) (H βˆ— ⌜p β‰  null⌝ βˆ— hrange (make_list n.natAbs val_uninit) p) (Q βˆ— ⌜p β‰  null⌝ βˆ— βˆƒΚ° L, ⌜L.length = n⌝ βˆ— hrange L p) ) β†’ triple (trm_alloc x n t) H Q :=
:= by move=> ? htriple h ? apply eval.eval_alloc=> // > * move: (htriple p)=> /triple_conseq {}htriple specialize (htriple (H βˆ— ⌜p β‰  null⌝ βˆ— hrange (make_list n.natAbs val_uninit) p)) specialize (htriple (fun v s ↦ Q v (s \ sb))) have eqn:(triple (subst x p t) (H βˆ— ⌜p β‰  null⌝ βˆ— hrange (make_list n.natAb...
8
72
false
Framework
412
Theories.wp_alloc
lemma wp_alloc x (n : β„€) t Q : n β‰₯ 0 β†’ (hβˆ€ p, (hrange (make_list n.natAbs val_uninit) p) -βˆ— wp (subst x p t) (Q βˆ— ⌜p β‰  null⌝ βˆ— βˆƒΚ° L, ⌜L.length = n⌝ βˆ— hrange L p)) ==> wp (trm_alloc x n t) Q
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lean", "import SPLean.Theories.WPU...
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"emp\" => hempty\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\" ppDedent(ppLine lang) : lang\n\nsyntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term ...
[ { "name": "Finmap.Disjoint.symm_iff", "module": "Mathlib.Data.Finmap" } ]
[ { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eval s t Q2" }, { "name": "hpure_inv", "content": "lemma hpure_inv P h :\n ⌜P⌝ h β†’\n P ∧ h = βˆ…" }, { "name": "hwand_inv", "content": "lemma hwand_inv h1 h2 H1 H2 :\n (H1 -βˆ— H2) h...
[ { "name": "Theories.wp", "content": "def wp (t : trm) (Q : val β†’ hProp) : hProp :=\n fun s ↦ eval s t Q" } ]
[ { "name": "Theories.mem_conseq", "content": "lemma mem_conseq :\n x ∈ conseq L p β†’ p ≀ x" }, { "name": "Theories.hrange_of_conseq", "content": "lemma hrange_of_conseq :\n (hrange L p) (conseq L p)" } ]
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma wp_alloc x (n : β„€) t Q : n β‰₯ 0 β†’ (hβˆ€ p, (hrange (make_list n.natAbs val_uninit) p) -βˆ— wp (subst x p t) (Q βˆ— ⌜p β‰  null⌝ βˆ— βˆƒΚ° L, ⌜L.length = n⌝ βˆ— hrange L p)) ==> wp (trm_alloc x n t) Q :=
:= by move=> ? h /hforall_inv hwp apply eval.eval_alloc=> // > * apply (eval_conseq _ _ (Q βˆ— ⌜p β‰  null⌝ βˆ— βˆƒΚ° L, βŒœβ†‘L.length = n⌝ βˆ— hrange L p)) { move: (hwp p)=> /(hwand_inv sb) srw Finmap.Disjoint.symm_iff=> {}hwp apply hwp=> // ; subst sb apply hrange_of_conseq } move=> > s ![>] ? ![>] /hpure_inv...
5
65
false
Framework
413
xfor_lemma
lemma xfor_lemma (z n : β„€) (x : var) (I : β„€ -> hProp) : z <= n -> (H ==> H' βˆ— I z) -> (βˆ€ i, z <= i -> i < n -> I i ==> wp (subst x i F1) (fun _ => I (i + 1))) -> ((fun _ => I n βˆ— H') ===> Q) -> H ==> wp (trm_for x z n F1) Q
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lean", "import SPLean.Theories.WPU...
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "syntax \"if \" lang \"then \" lang \"end \" : lang", "content": "syntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\" ppDedent(ppLine lang) : lang\n\nsyntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term \"⟩\" : lang\n...
[ { "name": "Int.le_induction_down", "module": "Mathlib.Data.Int.Init" }, { "name": "if_pos", "module": "Init.Core" } ]
[ { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eval s t Q2" }, { "name": "qstarE", "content": "lemma qstarE Ξ± (Q1 : Ξ± β†’ hProp) (H : hProp):\n Q1 βˆ— H = fun x => Q1 x βˆ— H" }, { "name": "eval_frame", "content": "lemma eval_frame ...
[ { "name": "Theories.wp", "content": "def wp (t : trm) (Q : val β†’ hProp) : hProp :=\n fun s ↦ eval s t Q" } ]
[ { "name": "Theories.wp_conseq", "content": "lemma wp_conseq t Q1 Q2 :\n Q1 ===> Q2 β†’\n wp t Q1 ==> wp t Q2" }, { "name": "Theories.wp_frame", "content": "lemma wp_frame t H Q :\n (wp t Q) βˆ— H ==> wp t (Q βˆ— H)" }, { "name": "Theories.wp_ramified", "content": "lemma wp_ramified t (Q...
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma xfor_lemma (z n : β„€) (x : var) (I : β„€ -> hProp) : z <= n -> (H ==> H' βˆ— I z) -> (βˆ€ i, z <= i -> i < n -> I i ==> wp (subst x i F1) (fun _ => I (i + 1))) -> ((fun _ => I n βˆ— H') ===> Q) -> H ==> wp (trm_for x z n F1) Q :=
:= by move=> ? hini hstep hfin xchange hini apply himpl_trans_r; apply wp_conseq_frame=> // xsimp move: z hfin {hini}=> z; apply Int.le_induction_down { move=> ?? ?? constructor=> /==;constructor; aesop } move=> j ? ih step hfin move=> ??; constructor=> /==; srw if_pos; rotate_left; omega constr...
9
90
false
Framework
414
Theories.isubst_insert
lemma isubst_insert (al : ctx) x v t : isubst (al.insert x v) t = subst x v (isubst (al.erase x) t)
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lean", "import SPLean.Theories.WPU...
[ { "name": "AList", "module": "Mathlib.Data.List.AList" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "...
[ { "name": "syntax \"fun\" ident+ \" => \" lang : lang", "content": "syntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"if \" lang \"then \" lang \"end \" : lang\n\nsyntax \" := \" : bop\n\nsyntax \"let\" ident \" := \" lang \" in\" ppDedent(ppLine lang) : lang\n\nsyntax \"⟨\" term \"⟩\" : lang\n\nsyntax...
[ { "name": "List.kerase_cons_ne", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.kerase_kerase", "module": "Mathlib.Data.List.Sigma" }, { "name": "AList.perm_erase", "module": "Mathlib.Data.List.AList" }, { "name": "AList.perm_lookup", "module": "Mathlib.Data.List....
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Theories.ctx", "content": "abbrev ctx := AList (fun _ : var ↦ val)" }, { "name": "Theories.isubst", "content": "def isubst (E : ctx) (t : trm) : trm :=\n match t with\n | trm_val v =>\n v\n | trm_var x =>\n match lookup x E with\n | none => t\n | some v => v\n...
[ { "name": "Theories.AList.erase_insert_cancel", "content": "lemma AList.erase_insert_cancel {Ξ± : Type u} {Ξ² : Ξ± β†’ Type v} [DecidableEq Ξ±] (a : Ξ±) (b : Ξ² a) (l : AList Ξ²) :\n (AList.erase a (AList.insert a b l)).entries.Perm (AList.erase a l).entries" }, { "name": "Theories.AList.erase_insert_swap...
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma isubst_insert (al : ctx) x v t : isubst (al.insert x v) t = subst x v (isubst (al.erase x) t) :=
:= by move: al induction t using (subst.induct x v)=> > all_goals (simp [isubst, subst]=> //) all_goals (split_ands=> //) all_goals ((try split_ifs=> //) <;> (try subst_eqs)) all_goals (try srw (fun t => isubst_perm t (AList.erase_twice x al))) all_goals (try srw (fun v t => isubst_perm t (AList.erase_ins...
5
42
false
Framework
415
Perm.kmerge
theorem Perm.kmerge {l₁ lβ‚‚ l₃ lβ‚„ : List (Sigma (fun _ : loc => val))} (nd₁ : l₁.NodupKeys) /- nd₁ is necessary -/ (nd₃ : l₃.NodupKeys) (p₁₂ : l₁.Perm lβ‚‚) (p₃₄ : l₃.Perm lβ‚„) : (kmerge l₁ l₃).Perm $ kmerge lβ‚‚ lβ‚„
splean
SPLean/Common/Heap.lean
[ "import Mathlib.Algebra.BigOperators.Group.Finset", "import Mathlib.Algebra.BigOperators.Intervals", "import Mathlib.Algebra.Group.Basic", "import Ssreflect.Lang", "import Mathlib.Data.Finmap", "import Mathlib.Order.Interval.Finset.Basic", "import Mathlib.Data.Int.Interval", "import Lean", "import B...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "List.NodupKeys", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.Perm", "module": "Init.Data.List.Basic" }, { "name": "List.keys", "module": "Mathlib.D...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.NodupKeys.kerase", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.kerase_cons_eq", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.kerase_cons_ne", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.mem_keys_of_mem", "module": "Mathlib.D...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "loc", "content": "abbrev loc := Nat" }, { "name": "kmerge1", "content": "private def kmerge1 (l : loc) (v : val) (lβ‚‚ : List (Sigma (fun _ : loc => val))) : val :=\n match lβ‚‚.dlookup l with\n | .some v' => v + v'\n | _ => v" }, { "name": "kmerge", "content": "@[simp]\nde...
[ { "name": "List.kerase_noterased", "content": "lemma List.kerase_noterased {Ξ± : Type u} {Ξ² : Ξ± β†’ Type v} [DecidableEq Ξ±] (l : List (Sigma Ξ²))\n (a a' : Ξ±) (hneq : a β‰  a') (b : Ξ² a) : ⟨a, b⟩ ∈ l ↔ ⟨a, b⟩ ∈ List.kerase a' l" }, { "name": "kmerge_mem2", "content": "lemma kmerge_mem2 (l₁ lβ‚‚ : List ...
import Lean import Mathlib.Data.Finmap import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Data.Int.Interval import Mathlib.Order.Interval.Finset.Basic import Batteries.Data.List.Perm import Ssreflect.Lang open Classic...
theorem Perm.kmerge {l₁ lβ‚‚ l₃ lβ‚„ : List (Sigma (fun _ : loc => val))} (nd₁ : l₁.NodupKeys) /- nd₁ is necessary -/ (nd₃ : l₃.NodupKeys) (p₁₂ : l₁.Perm lβ‚‚) (p₃₄ : l₃.Perm lβ‚„) : (kmerge l₁ l₃).Perm $ kmerge lβ‚‚ lβ‚„ :=
:= by have ndβ‚‚ := nd₁ rw [List.perm_nodupKeys p₁₂] at ndβ‚‚ have ndβ‚„ := nd₃ rw [List.perm_nodupKeys p₃₄] at ndβ‚„ rw [List.perm_ext_iff_of_nodup] <;> try (apply List.NodupKeys.nodup ; apply kmerge_NodupKeys=> //) move=> [] l v srw !kmerge_mem2 // (List.perm_dlookup _ nd₁ ndβ‚‚ p₁₂) // (List.perm_dlookup _ nd₃ n...
3
30
false
Framework
416
validInter_hop_distr_l
lemma validInter_hop_distr_l (h₁ hβ‚‚ h₃ : heap) : (h₁ +Κ° hβ‚‚) βŠ₯Κ° h₃ -> (h₁ βŠ₯Κ° h₃ ∧ hβ‚‚ βŠ₯Κ° h₃)
splean
SPLean/Common/Heap.lean
[ "import Mathlib.Algebra.BigOperators.Group.Finset", "import Mathlib.Algebra.BigOperators.Intervals", "import Mathlib.Algebra.Group.Basic", "import SPLean/Theories/HProp.lean", "import Ssreflect.Lang", "import Mathlib.Data.Finmap", "import Mathlib.Order.Interval.Finset.Basic", "import Mathlib.Data.Int....
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Sigma", "module": "Init.Core" }, { "name": "AList", "module": "Mathlib.Data.List.AList" }, { "name": "scase", "module": "Ssreflect.Elim" }, { "name": ...
[ { "name": "heap", "content": "abbrev heap := Heap.heap val\n\n inductive val : Type where\n | val_unit : val\n | val_bool : Bool β†’ val\n | val_int : Int β†’ val\n | val_real : ℝ β†’ val\n | val_loc : loc β†’ val\n | val_prim : prim β†’ val\n | val_fun : var -> trm -> val\n ...
[ { "name": "Finmap.mem_iff", "module": "Mathlib.Data.Finmap" }, { "name": "add_assoc", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "add_comm", "module": "Mathlib.Algebra.Group.Defs" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "loc", "content": "abbrev loc := Nat" }, { "name": "var", "content": "abbrev var := String" }, { "name": "Heap.heap", "content": "abbrev Heap.heap (val : Type) := Finmap (Ξ» _ : loc ↦ val)" }, { "name": "PartialCommMonoid", "content": "class PartialCommMonoid (Ξ± ...
[]
import Lean import Mathlib.Data.Finmap import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Data.Int.Interval import Mathlib.Order.Interval.Finset.Basic import Batteries.Data.List.Perm import Ssreflect.Lang open Classic...
lemma validInter_hop_distr_l (h₁ hβ‚‚ h₃ : heap) : (h₁ +Κ° hβ‚‚) βŠ₯Κ° h₃ -> (h₁ βŠ₯Κ° h₃ ∧ hβ‚‚ βŠ₯Κ° h₃) :=
:= by simp [validInter] move=> h ⟨|⟩ l /[tac (specialize h l)]-- | [] h1 h2 l [] /[tac (specialize h1 l; specialize h2 l)] ⟩ all_goals (move=> /[dup] hin1 /[swap] /[dup] hin2) all_goals (srw [1]Finmap.mem_iff=> []v3 hv3 ; srw Finmap.mem_iff=> []v hv) all_goals (srw hv hv3 at h ⊒) all_goals (dsimp [Option.me...
6
31
false
Framework
417
xwhile_inv_basic_lemma
lemma xwhile_inv_basic_lemma (I : Bool -> Ξ± -> hProp) R -- (F1 F2 : formula) : WellFounded R -> -- structural F1 -> -- structural F2 -> (H ==> H' βˆ— βˆƒΚ° b a, I b a) -> (βˆ€ b X, I b X ==> wp F1 (fun bv => I b X βˆ— ⌜bv = b⌝)) -> (βˆ€ X, I true X ==> wp F2 (fun _ => βˆƒΚ° b X', ⌜R X' X⌝ βˆ— I b X')) -> H ==> wp (tr...
splean
SPLean/Theories/WP1.lean
[ "import SPLean.Theories.XChange", "import Mathlib.Data.List.Indexes", "import SPLean.Theories.XSimp", "import SPLean.Theories.SepLog", "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Lean", "import SPLean.Theories.WPU...
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"emp\" => hempty\n\nsyntax \"fun\" ident+ \" => \" lang : lang\n\nsyntax \"⟨\" term \"⟩\" : lang\n\nsyntax \"⟨\" term \":\" term \"⟩\" : lang" }, { "name": "macro \"xsimp\" : tactic =>", "content": "macro \"xsimp\" : tactic =>...
[ { "name": "...", "module": "" } ]
[ { "name": "eval_conseq", "content": "lemma eval_conseq s t Q1 Q2 :\n eval s t Q1 β†’\n Q1 ===> Q2 β†’\n eval s t Q2" }, { "name": "qstarE", "content": "lemma qstarE Ξ± (Q1 : Ξ± β†’ hProp) (H : hProp):\n Q1 βˆ— H = fun x => Q1 x βˆ— H" }, { "name": "eval_frame", "content": "lemma eval_frame ...
[ { "name": "Theories.wp", "content": "def wp (t : trm) (Q : val β†’ hProp) : hProp :=\n fun s ↦ eval s t Q" } ]
[ { "name": "Theories.wp_conseq", "content": "lemma wp_conseq t Q1 Q2 :\n Q1 ===> Q2 β†’\n wp t Q1 ==> wp t Q2" }, { "name": "Theories.wp_frame", "content": "lemma wp_frame t H Q :\n (wp t Q) βˆ— H ==> wp t (Q βˆ— H)" } ]
import Lean import Mathlib.Data.Finmap import Mathlib.Data.List.Indexes import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp import SPLean.Theories.XChange import SPLean.Theories.SepLog import SPLean.Theories.WPUtil open trm val prim namespace Theorie...
lemma xwhile_inv_basic_lemma (I : Bool -> Ξ± -> hProp) R -- (F1 F2 : formula) : WellFounded R -> -- structural F1 -> -- structural F2 -> (H ==> H' βˆ— βˆƒΚ° b a, I b a) -> (βˆ€ b X, I b X ==> wp F1 (fun bv => I b X βˆ— ⌜bv = b⌝)) -> (βˆ€ X, I true X ==> wp F2 (fun _ => βˆƒΚ° b X', ⌜R X' X⌝ βˆ— I b X')) -> H ==> wp (tr...
:= by move=> wf hini hf1 hf2 xchange hini=> b sR move: b apply WellFounded.induction wf sR=> X ih [] -- apply eval.eval_while -- unfold wpgen_while ; unfold_let ; xstruct ; xsimp=> [] sR hstep; rename_i wfR -- frame H' out, using `structural`? { xchange hf1 apply himpl_trans; rotate_left { srw ...
5
52
false
Framework
418
kmerge_assoc_perm
lemma kmerge_assoc_perm (l₁ lβ‚‚ l₃ : List (Sigma (fun _ : loc => val))) (nd₁ : l₁.NodupKeys) (ndβ‚‚ : lβ‚‚.NodupKeys) (nd₃ : l₃.NodupKeys) : (kmerge (kmerge l₁ lβ‚‚) l₃).Perm $ (kmerge l₁ (kmerge lβ‚‚ l₃))
splean
SPLean/Common/Heap.lean
[ "import Mathlib.Algebra.BigOperators.Group.Finset", "import Mathlib.Algebra.BigOperators.Intervals", "import Mathlib.Algebra.Group.Basic", "import Ssreflect.Lang", "import Mathlib.Data.Finmap", "import Mathlib.Order.Interval.Finset.Basic", "import Mathlib.Data.Int.Interval", "import Lean", "import B...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Sigma", "module": "Init.Core" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "move", "module": "Ssreflect.Basic" }, { "name": "srw", ...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.mem_keys_kerase_of_ne", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.kerase_cons_eq", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.kerase_cons_ne", "module": "Mathlib.Data.List.Sigma" }, { "name": "List.NodupKeys.kerase", "module": "Mat...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "loc", "content": "abbrev loc := Nat" }, { "name": "kmerge1", "content": "private def kmerge1 (l : loc) (v : val) (lβ‚‚ : List (Sigma (fun _ : loc => val))) : val :=\n match lβ‚‚.dlookup l with\n | .some v' => v + v'\n | _ => v" }, { "name": "kmerge", "content": "@[simp]\nde...
[ { "name": "List.kerase_noterased", "content": "lemma List.kerase_noterased {Ξ± : Type u} {Ξ² : Ξ± β†’ Type v} [DecidableEq Ξ±] (l : List (Sigma Ξ²))\n (a a' : Ξ±) (hneq : a β‰  a') (b : Ξ² a) : ⟨a, b⟩ ∈ l ↔ ⟨a, b⟩ ∈ List.kerase a' l" }, { "name": "Option.merge_assoc", "content": "lemma Option.merge_assoc ...
import Lean import Mathlib.Data.Finmap import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Data.Int.Interval import Mathlib.Order.Interval.Finset.Basic import Batteries.Data.List.Perm import Ssreflect.Lang open Classic...
lemma kmerge_assoc_perm (l₁ lβ‚‚ l₃ : List (Sigma (fun _ : loc => val))) (nd₁ : l₁.NodupKeys) (ndβ‚‚ : lβ‚‚.NodupKeys) (nd₃ : l₃.NodupKeys) : (kmerge (kmerge l₁ lβ‚‚) l₃).Perm $ (kmerge l₁ (kmerge lβ‚‚ l₃)) :=
:= by apply List.lookup_ext <;> try (repeat'(apply kmerge_NodupKeys=> //)) move=> l v (srw !kmerge_dlookup=> //) <;> try (repeat'(apply kmerge_NodupKeys=> //)) rw [Option.merge_assoc]=> // ; apply add_assoc
4
31
false
Framework
419
validInter_assoc_r
lemma validInter_assoc_r (h₁ hβ‚‚ h₃ : heap) : hβ‚‚ βŠ₯Κ° h₃ -> h₁ βŠ₯Κ° (hβ‚‚ +Κ° h₃) -> (h₁ +Κ° hβ‚‚) βŠ₯Κ° h₃
splean
SPLean/Common/Heap.lean
[ "import Mathlib.Algebra.BigOperators.Group.Finset", "import Mathlib.Algebra.BigOperators.Intervals", "import Mathlib.Algebra.Group.Basic", "import SPLean/Theories/HProp.lean", "import Ssreflect.Lang", "import Mathlib.Data.Finmap", "import Mathlib.Order.Interval.Finset.Basic", "import Mathlib.Data.Int....
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Sigma", "module": "Init.Core" }, { "name": "AList", "module": "Mathlib.Data.List.AList" }, { "name": "scase", "module": "Ssreflect.Elim" }, { "name": ...
[ { "name": "heap", "content": "abbrev heap := Heap.heap val\n\n inductive val : Type where\n | val_unit : val\n | val_bool : Bool β†’ val\n | val_int : Int β†’ val\n | val_real : ℝ β†’ val\n | val_loc : loc β†’ val\n | val_prim : prim β†’ val\n | val_fun : var -> trm -> val\n ...
[ { "name": "Finmap.mem_of_lookup_eq_some", "module": "Mathlib.Data.Finmap" }, { "name": "Or.intro_right", "module": "Init.Prelude" }, { "name": "add_assoc", "module": "Mathlib.Algebra.Group.Defs" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "loc", "content": "abbrev loc := Nat" }, { "name": "var", "content": "abbrev var := String" }, { "name": "Heap.heap", "content": "abbrev Heap.heap (val : Type) := Finmap (Ξ» _ : loc ↦ val)" }, { "name": "PartialCommMonoid", "content": "class PartialCommMonoid (Ξ± ...
[ { "name": "Option.merge_none_l", "content": "lemma Option.merge_none_l (a : Option Ξ±) : Option.merge f none a = a" }, { "name": "Option.merge_assoc", "content": "lemma Option.merge_assoc (h : Associative f) (a b c : Option Ξ±) :\n Option.merge f (Option.merge f a b) c = Option.merge f a (Option....
import Lean import Mathlib.Data.Finmap import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Data.Int.Interval import Mathlib.Order.Interval.Finset.Basic import Batteries.Data.List.Perm import Ssreflect.Lang open Classic...
lemma validInter_assoc_r (h₁ hβ‚‚ h₃ : heap) : hβ‚‚ βŠ₯Κ° h₃ -> h₁ βŠ₯Κ° (hβ‚‚ +Κ° h₃) -> (h₁ +Κ° hβ‚‚) βŠ₯Κ° h₃ :=
:= by simp [validInter] move=> h1' h2' l /[swap] hin3 /[tac (have h1 := (fun H => h1' _ H hin3) ; have h2 := (fun H => h2' _ H (Or.intro_right _ hin3)) ; clear h1' h2')] [ hin1 | hin2 ] { rw [Option.merge_assoc, h2]=> // apply add_assoc } { rcases h : Finmap.lookup l h₁ { rw [Option.merge_none_l] ; aeso...
6
34
false
Framework
420
hrange_eq_conseq
lemma hrange_eq_conseq (L : List val) (n : β„€) (p : loc) (s : state) : L.length = n β†’ hrange L p s β†’ s.keys = (conseq (make_list n.natAbs val_uninit) p).keys
splean
SPLean/Theories/SepLog.lean
[ "import Mathlib.Data.Finmap", "import SPLean.Common.State", "import SPLean.Theories.HProp", "import SPLean.Common.Util", "import Mathlib.Data.Multiset.Nodup", "import SPLean.Theories.XSimp", "import Mathlib.Data.Finset.Basic" ]
[ { "name": "String", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Finmap", "module": "Mathlib.Data.Finmap" }, { "nam...
[ { "name": "notation:max \"emp\" => hempty", "content": "notation:max \"emp\" => hempty\n\nsyntax \"fun\" ident+ \" => \" lang : lang" }, { "name": "macro_rules", "content": "macro_rules\n | `([lang| ()]) => `(trm_val (val_unit))\n | `([lang| $n:num]) => ...
[ { "name": "Finmap.mem_keys", "module": "Mathlib.Data.Finmap" }, { "name": "Finset.ext_iff", "module": "Mathlib.Data.Finset.Defs" } ]
[ { "name": "hempty_inv", "content": "lemma hempty_inv h :\n emp h β†’ h = βˆ…" }, { "name": "hsingl_inv", "content": "lemma hsingl_inv p v h :\n (p ~~> v) h β†’\n h = Finmap.singleton p v" } ]
[ { "name": "hrange", "content": "def hrange (L : List val) (p : loc) : hProp :=\n match L with\n | [] => emp\n | x :: L' => (p ~~> x) βˆ— (hrange L' (p + 1))" } ]
[ { "name": "int_eq_sub", "content": "lemma int_eq_sub (l m n : β„€) :\n l + m = n β†’ l = n - m" }, { "name": "list_inc_natabs", "content": "lemma list_inc_natabs {Ξ± : Type} (L : List Ξ±) :\n ((L.length : β„€) + 1).natAbs = (L.length : β„€).natAbs + 1" } ]
import Mathlib.Data.Finmap import Mathlib.Data.Finset.Basic import Mathlib.Data.Multiset.Nodup import SPLean.Common.State import SPLean.Common.Util import SPLean.Theories.HProp import SPLean.Theories.XSimp open trm val prim notation "funloc" p "↦" H => fun (r : val) ↦ hexists (fun p ↦ ⌜r = val_loc p⌝ βˆ— H) se...
lemma hrange_eq_conseq (L : List val) (n : β„€) (p : loc) (s : state) : L.length = n β†’ hrange L p s β†’ s.keys = (conseq (make_list n.natAbs val_uninit) p).keys :=
:= by elim: L n p s=> > ; unfold hrange { sby move=> /= <- /= /hempty_inv -> } move=> ih > /== /[dup] /int_eq_sub /[dup] hn /ih {}ih <- srw -hn at ih move: ih=> /= ih {hn} unfold hrange=> ![>] /hsingl_inv ? /ih {}ih ? -> unfold conseq make_list srw list_inc_natabs=> /== > move: ih sby srw ?Finset.e...
8
34
false
Framework
421
validInter_assoc_l
lemma validInter_assoc_l (h₁ hβ‚‚ h₃ : heap) : h₁ βŠ₯Κ° hβ‚‚ -> (h₁ +Κ° hβ‚‚) βŠ₯Κ° h₃ -> h₁ βŠ₯Κ° (hβ‚‚ +Κ° h₃)
splean
SPLean/Common/Heap.lean
[ "import Mathlib.Algebra.BigOperators.Group.Finset", "import Mathlib.Algebra.BigOperators.Intervals", "import Mathlib.Algebra.Group.Basic", "import SPLean/Theories/HProp.lean", "import Ssreflect.Lang", "import Mathlib.Data.Finmap", "import Mathlib.Order.Interval.Finset.Basic", "import Mathlib.Data.Int....
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Sigma", "module": "Init.Core" }, { "name": "AList", "module": "Mathlib.Data.List.AList" }, { "name": "scase", "module": "Ssreflect.Elim" }, { "name": ...
[ { "name": "heap", "content": "abbrev heap := Heap.heap val\n\n inductive val : Type where\n | val_unit : val\n | val_bool : Bool β†’ val\n | val_int : Int β†’ val\n | val_real : ℝ β†’ val\n | val_loc : loc β†’ val\n | val_prim : prim β†’ val\n | val_fun : var -> trm -> val\n ...
[ { "name": "Finmap.mem_of_lookup_eq_some", "module": "Mathlib.Data.Finmap" }, { "name": "Or.intro_left", "module": "Init.Prelude" }, { "name": "add_assoc", "module": "Mathlib.Algebra.Group.Defs" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "loc", "content": "abbrev loc := Nat" }, { "name": "var", "content": "abbrev var := String" }, { "name": "Heap.heap", "content": "abbrev Heap.heap (val : Type) := Finmap (Ξ» _ : loc ↦ val)" }, { "name": "PartialCommMonoid", "content": "class PartialCommMonoid (Ξ± ...
[ { "name": "Option.merge_none_r", "content": "lemma Option.merge_none_r (a : Option Ξ±) : Option.merge f a none = a" }, { "name": "Option.merge_assoc", "content": "lemma Option.merge_assoc (h : Associative f) (a b c : Option Ξ±) :\n Option.merge f (Option.merge f a b) c = Option.merge f a (Option....
import Lean import Mathlib.Data.Finmap import Mathlib.Algebra.Group.Basic import Mathlib.Algebra.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Intervals import Mathlib.Data.Int.Interval import Mathlib.Order.Interval.Finset.Basic import Batteries.Data.List.Perm import Ssreflect.Lang open Classic...
lemma validInter_assoc_l (h₁ hβ‚‚ h₃ : heap) : h₁ βŠ₯Κ° hβ‚‚ -> (h₁ +Κ° hβ‚‚) βŠ₯Κ° h₃ -> h₁ βŠ₯Κ° (hβ‚‚ +Κ° h₃) :=
:= by simp [validInter] move=> h1 h2 l hin1 /[tac (specialize h1 _ hin1 ; specialize h2 _ (Or.intro_left _ hin1))] [ hin2 | hin3 ] { rcases h : Finmap.lookup l h₃ { rw [Option.merge_none_r] ; aesop } { srw h at h2 ; rw [← Option.merge_assoc, h2] ; apply Finmap.mem_of_lookup_eq_some at h=> // apply a...
6
34
false
Framework
422
wtPar
theorem wtPar {Ξ“} {a b A : Term} (r : a β‡’ b) (h : Ξ“ ⊒ a ∢ A) : Ξ“ ⊒ b ∢ A
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.syntactics", "import src.reduction", "import src.typing" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "renameLiftRename", "content": "theorem renameLiftRename ΞΎ a : rename succ (rename ΞΎ a) = rename (lift ΞΎ) (rename succ a)" }, { "name": "liftSucc", "content": "omit lc in\ntheorem liftSucc ΞΎ : βˆ€ x, (lift ΞΎ ∘ succ) x = (succ ∘ ΞΎ) x" }, { "name": "renameComp", "content": "the...
[]
[ { "name": "wtRename", "content": "theorem wtRename {ΞΎ : β„• β†’ β„•} {Ξ“ Ξ”} {a A : Term}\n (hΞΎ : Ξ” ⊒ ΞΎ ∢ Ξ“) (hΞ” : ⊒ Ξ”) (h : Ξ“ ⊒ a ∢ A) :\n Ξ” ⊒ rename ΞΎ a ∢ rename ΞΎ A" }, { "name": "wtWeaken", "content": "theorem wtWeaken {Ξ“ k} {a A B : Term}\n (hΞ“ : ⊒ Ξ“) (hB : Ξ“ ⊒ B ∢ 𝒰 k) (h : Ξ“ ⊒ a ∢ A) :\n Ξ“ ∷...
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ”
theorem wtPar {Ξ“} {a b A : Term} (r : a β‡’ b) (h : Ξ“ ⊒ a ∢ A) : Ξ“ ⊒ b ∢ A :=
:= by induction h generalizing b case var => cases r; constructor <;> assumption case 𝒰 ih => cases r with | 𝒰 r' => exact Wt.𝒰 (ih r') case pi ihA ihB => cases r with | pi ra rb => let ihA' := ihA ra exact Wt.pi ihA' (wtReplace (parEqv ra) ihA' (ihB rb)) case abs B _ _ hPi _ _ ihPi ihA ihb => ...
10
88
false
Type systems
423
wtMorph
theorem wtMorph {Οƒ : β„• β†’ Term} {Ξ“ Ξ”} {a A : Term} (hΟƒ : Ξ” ⊒ Οƒ ∢ Ξ“) (hΞ” : ⊒ Ξ”) (h : Ξ“ ⊒ a ∢ A) : Ξ” ⊒ subst Οƒ a ∢ subst Οƒ A
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.syntactics", "import src.reduction", "import src.typing" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "renameLiftRename", "content": "theorem renameLiftRename ΞΎ a : rename succ (rename ΞΎ a) = rename (lift ΞΎ) (rename succ a)" }, { "name": "liftSucc", "content": "omit lc in\ntheorem liftSucc ΞΎ : βˆ€ x, (lift ΞΎ ∘ succ) x = (succ ∘ ΞΎ) x" }, { "name": "renameComp", "content": "the...
[]
[ { "name": "wtRename", "content": "theorem wtRename {ΞΎ : β„• β†’ β„•} {Ξ“ Ξ”} {a A : Term}\n (hΞΎ : Ξ” ⊒ ΞΎ ∢ Ξ“) (hΞ” : ⊒ Ξ”) (h : Ξ“ ⊒ a ∢ A) :\n Ξ” ⊒ rename ΞΎ a ∢ rename ΞΎ A" }, { "name": "wtWeaken", "content": "theorem wtWeaken {Ξ“ k} {a A B : Term}\n (hΞ“ : ⊒ Ξ“) (hB : Ξ“ ⊒ B ∢ 𝒰 k) (h : Ξ“ ⊒ a ∢ A) :\n Ξ“ ∷...
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ”
theorem wtMorph {Οƒ : β„• β†’ Term} {Ξ“ Ξ”} {a A : Term} (hΟƒ : Ξ” ⊒ Οƒ ∢ Ξ“) (hΞ” : ⊒ Ξ”) (h : Ξ“ ⊒ a ∢ A) : Ξ” ⊒ subst Οƒ a ∢ subst Οƒ A :=
:= by induction h generalizing Οƒ Ξ” case var mem _ => exact hΟƒ _ _ mem case 𝒰 ih => exact Wt.𝒰 (ih hΟƒ hΞ”) case pi ihA ihB => let ihA' := ihA hΟƒ hΞ” refine Wt.pi ihA' ?_ rw [renameUpSubst] exact ihB (wSubstUp ihA' hΟƒ) (Wf.cons hΞ” ihA') case abs ihPi ihA ihb => let ihPi' := ihPi hΟƒ hΞ” le...
8
69
false
Type systems
424
antirenaming
theorem antirenaming {ΞΎ a b'} (r : rename ΞΎ a β‡’ b') : βˆƒ b, b' = rename ΞΎ b ∧ a β‡’ b
TTBFL
src/reduction.lean
[ "import src.syntactics", "import Β«srcΒ».syntactics", "import Β«srcΒ».tactics" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "Term", "content": "inductive Term : Type where\n | var : Nat β†’ Term\n | 𝒰 : Term β†’ Term\n | pi : Term β†’ Term β†’ Term\n | abs : Term β†’ Term β†’ Term\n | app : Term β†’ Term β†’ Term\n | mty : Term\n | exf : Term β†’ Term β†’ Term\n | lvl : Term β†’ Term\n | lof : lc.L β†’ Term" }, { "name": "su...
[ { "name": "...", "module": "" } ]
[ { "name": "liftExt", "content": "theorem liftExt ΞΎ ΞΆ (h : βˆ€ x, ΞΎ x = ΞΆ x) : βˆ€ x, lift ΞΎ x = lift ΞΆ x" }, { "name": "liftId", "content": "theorem liftId ΞΎ (h : βˆ€ x, ΞΎ x = x) : βˆ€ x, lift ΞΎ x = x" }, { "name": "liftSucc", "content": "theorem liftSucc ΞΎ : βˆ€ x, (lift ΞΎ ∘ succ) x = (succ ∘...
[ { "name": "Par", "content": "inductive Par : Term β†’ Term β†’ Prop where\n | Ξ² {b b' a a' c} :\n b β‡’ b' β†’\n a β‡’ a' β†’\n \n app (abs c b) a β‡’ subst (a' +: var) b'\n | var s : var s β‡’ var s\n | 𝒰 {a a'} :\n a β‡’ a' β†’\n \n 𝒰 a β‡’ 𝒰 a'\n | pi {a a' b b'} :\n a β‡’ a' β†’\n b β‡’ b' β†’\n ...
[ { "name": "parRefl", "content": "theorem parRefl a : a β‡’ a" } ]
import Β«srcΒ».tactics import Β«srcΒ».syntactics open Term variable [LevelClass] section inductive Par : Term β†’ Term β†’ Prop where | Ξ² {b b' a a' c} : b β‡’ b' β†’ a β‡’ a' β†’ app (abs c b) a β‡’ subst (a' +: var) b' | var s : var s β‡’ var s | 𝒰 {a a'} : a β‡’ a' β†’ 𝒰 a β‡’ 𝒰 a' | pi {a a' b b...
theorem antirenaming {ΞΎ a b'} (r : rename ΞΎ a β‡’ b') : βˆƒ b, b' = rename ΞΎ b ∧ a β‡’ b :=
:= by generalize e : rename ξ a = a' at r induction r generalizing ξ a all_goals cases a <;> injections; subst_eqs; specialize_rfls case β ihb b _ e _ iha => cases b <;> injections; subst_eqs; specialize_rfls let ⟨a, ea, ra⟩ := iha let ⟨b, eb, rb⟩ := ihb subst ea; subst eb exact ⟨subst (a +:...
4
23
false
Type systems
425
wtRegularity
theorem wtRegularity {Ξ“} {a A : Term} (h : Ξ“ ⊒ a ∢ A) : βˆƒ k, Ξ“ ⊒ A ∢ 𝒰 k
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.syntactics", "import src.reduction", "import src.typing" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Inhabited", "module": "Init.Prelude" }, { ...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "renameLiftRename", "content": "theorem renameLiftRename ΞΎ a : rename succ (rename ΞΎ a) = rename (lift ΞΎ) (rename succ a)" }, { "name": "liftSucc", "content": "omit lc in\ntheorem liftSucc ΞΎ : βˆ€ x, (lift ΞΎ ∘ succ) x = (succ ∘ ΞΎ) x" }, { "name": "renameComp", "content": "the...
[]
[ { "name": "wtRename", "content": "theorem wtRename {ΞΎ : β„• β†’ β„•} {Ξ“ Ξ”} {a A : Term}\n (hΞΎ : Ξ” ⊒ ΞΎ ∢ Ξ“) (hΞ” : ⊒ Ξ”) (h : Ξ“ ⊒ a ∢ A) :\n Ξ” ⊒ rename ΞΎ a ∢ rename ΞΎ A" }, { "name": "wtWeaken", "content": "theorem wtWeaken {Ξ“ k} {a A B : Term}\n (hΞ“ : ⊒ Ξ“) (hB : Ξ“ ⊒ B ∢ 𝒰 k) (h : Ξ“ ⊒ a ∢ A) :\n Ξ“ ∷...
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ”
theorem wtRegularity {Ξ“} {a A : Term} (h : Ξ“ ⊒ a ∢ A) : βˆƒ k, Ξ“ ⊒ A ∢ 𝒰 k :=
:= by induction h case var wf mem _ => exact wtMem mem wf case pi ih _ | trans ih => exact ih case abs h _ _ _ _ _ | exf h _ _ _ | conv h _ _ => exact ⟨_, h⟩ case 𝒰 ih => let ⟨_, ihk⟩ := ih let ⟨l, _, hk, _⟩ := wtfLvlInv ihk exact ⟨l, Wt.𝒰 hk⟩ case app ha ihb _ => let ⟨_, hPi⟩ := ihb l...
10
75
false
Type systems
426
wtProgress
theorem wtProgress {a A : Term} (h : ⬝ ⊒ a ∢ A) : Nonempty (Value a) ∨ βˆƒ b, a β‡’Ξ² b
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.reduction", "import src.typing" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "wtfLvlInv", "content": "theorem wtfLvlInv {Ξ“ a 𝒰'}\n (h : Ξ“ ⊒ lvl a ∢ 𝒰') :\n βˆƒ b k, Ξ“ ⊒ a ∢ lvl b ∧ 𝒰 k β‰ˆ 𝒰'" }, { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" }, { "name": "wtfMtyInv", "content": "theorem wtfMtyInv {Ξ“ 𝒰'}\n (h : Ξ“ ⊒ m...
[ { "name": "Value", "content": "inductive Value : Term β†’ Type where\n | 𝒰 {k} : Value (𝒰 k)\n | pi {a b} : Value (pi a b)\n | abs {a b} : Value (abs a b)\n | mty : Value mty\n | lvl {k} : Value (lvl k)\n | lof {k} : Value (lof k)" }, { "name": "CBN", "content": "inductive CBN : Term β†’ Ter...
[ { "name": "wtValue", "content": "theorem wtValue {Ξ“} {a A B : Term} (h : Ξ“ ⊒ a ∢ A) (e : A β‰ˆ B) : (v : Value a) β†’ valueType B v\n | Value.𝒰 => let ⟨_, eπ’°βŸ©" }, { "name": "wtAbs", "content": "theorem wtAbs {Ξ“} {b A B : Term} (v : Value b) (h : Ξ“ ⊒ b ∢ pi A B) : βˆƒ a' b', b = abs a' b'" } ]
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ” inductive Value : Term β†’ Type where | 𝒰 {k} : Value (𝒰 k) | pi {a b} : Value (pi a b) | abs {a b} : Value (abs a b) | mty : Value mty | lvl {k} : Value (lvl k) | lof {k} : Value (lof k) se...
theorem wtProgress {a A : Term} (h : ⬝ ⊒ a ∢ A) : Nonempty (Value a) ∨ βˆƒ b, a β‡’Ξ² b :=
:= by generalize e : (⬝) = Ξ“ at h induction h all_goals subst e; specialize_rfls case var mem => cases mem case 𝒰 | pi | abs | mty | lvl | lof => repeat constructor case trans ih _ | conv ih _ | sub ih => exact ih case app hb _ ihb _ => cases ihb case inl v => cases v with | intro v => ...
6
40
false
Type systems
427
interpDet'
theorem interpDet' {i I a P Q} (hP : ⟦ a ⟧ i , I β†˜ P) (hQ : ⟦ a ⟧ i , I β†˜ Q) : P = Q
TTBFL
src/candidates.lean
[ "import Β«srcΒ».normal", "import src.reduction", "import src.normal" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P", "content": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P" }, { "name": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P", "content": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "parCong", "content": "theorem parCong {a a' b b'} (ra : a β‡’ a') (rb : b β‡’ b') : subst (a +: var) b β‡’ subst (a' +: var) b'" }, { "name": "parMorphing", "content": "theorem parMorphing {a b} Οƒ Ο„ (h : βˆ€ x, Οƒ x β‡’ Ο„ x) (r : a β‡’ b) : subst Οƒ a β‡’ subst Ο„ b" }, { "name": "parLift", ...
[ { "name": "Interp", "content": "inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where\n | ne a : ne a β†’ Interp i I a wne\n | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) :\n Interp i I a Pa β†’\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’\n (βˆ€ x Pb, Pf x Pb β†’ Interp i I ...
[ { "name": "interpLvlEq", "content": "theorem interpLvlEq {b c} (r : b β‡’ c) :\n (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ b ⇒⋆ lof k) ∨ wne a) =\n (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ c ⇒⋆ lof k) ∨ wne a)" }, { "name": "interpNeInv", "content": "theorem interpNeInv {i I a P} (h : ⟦ a ⟧ i , I β†˜ P) :\n ...
import Β«srcΒ».normal open Term variable [lc : LevelClass] inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where | ne a : ne a β†’ Interp i I a wne | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) : Interp i I a Pa β†’ (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’ (βˆ€ x Pb, Pf x Pb β†’ ...
theorem interpDet' {i I a P Q} (hP : ⟦ a ⟧ i , I β†˜ P) (hQ : ⟦ a ⟧ i , I β†˜ Q) : P = Q :=
:= by induction hP generalizing Q case ne nea => exact symm (interpNeInv hQ nea) case pi Pa Pf _ hPf _ iha ihb => let ⟨Pa', Pf', ha', hPf', hb', e⟩ := interpPiInv hQ subst e; apply funext; intro f apply propext; constructor . intro h x Pb' Pax' PfxPb' have Pax : Pa x := by rw [iha ha']; exac...
8
51
false
Type systems
428
wtMty
theorem wtMty {Ξ“} {b : Term} (v : Value b) (h : Ξ“ ⊒ b ∢ mty) : False
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.reduction", "import src.typing" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "...", "module": "" } ]
[ { "name": "wtfLvlInv", "content": "theorem wtfLvlInv {Ξ“ a 𝒰'}\n (h : Ξ“ ⊒ lvl a ∢ 𝒰') :\n βˆƒ b k, Ξ“ ⊒ a ∢ lvl b ∧ 𝒰 k β‰ˆ 𝒰'" }, { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" }, { "name": "wtfMtyInv", "content": "theorem wtfMtyInv {Ξ“ 𝒰'}\n (h : Ξ“ ⊒ m...
[ { "name": "Value", "content": "inductive Value : Term β†’ Type where\n | 𝒰 {k} : Value (𝒰 k)\n | pi {a b} : Value (pi a b)\n | abs {a b} : Value (abs a b)\n | mty : Value mty\n | lvl {k} : Value (lvl k)\n | lof {k} : Value (lof k)" }, { "name": "valueType", "content": "@[simp] \ndef valueT...
[ { "name": "wtValue", "content": "theorem wtValue {Ξ“} {a A B : Term} (h : Ξ“ ⊒ a ∢ A) (e : A β‰ˆ B) : (v : Value a) β†’ valueType B v\n | Value.𝒰 => let ⟨_, eπ’°βŸ©" } ]
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ” inductive Value : Term β†’ Type where | 𝒰 {k} : Value (𝒰 k) | pi {a b} : Value (pi a b) | abs {a b} : Value (abs a b) | mty : Value mty | lvl {k} : Value (lvl k) | lof {k} : Value (lof k) se...
theorem wtMty {Ξ“} {b : Term} (v : Value b) (h : Ξ“ ⊒ b ∢ mty) : False :=
:= by generalize e : mty = T at h induction h all_goals try first | subst e | injection e case var | app | exf => contradiction case conv h v emty _ _ => let _e := wtValue h emty v cases v <;> let ⟨_, e⟩ := _e case 𝒰 | pi | mty | lvl => cases conv𝒰Mty (eqvConv e) case abs => let ⟨_, e⟩ := e;...
5
36
false
Type systems
429
interpDet'
theorem interpDet' {i I a P Q} (hP : ⟦ a ⟧ i , I β†˜ P) (hQ : ⟦ a ⟧ i , I β†˜ Q) : P = Q
TTBFL
src/semantics.lean
[ "import src.reduction", "import Β«srcΒ».reduction" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P", "content": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P" }, { "name": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P", "content": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "parCong", "content": "theorem parCong {a a' b b'} (ra : a β‡’ a') (rb : b β‡’ b') : subst (a +: var) b β‡’ subst (a' +: var) b'" }, { "name": "parMorphing", "content": "theorem parMorphing {a b} Οƒ Ο„ (h : βˆ€ x, Οƒ x β‡’ Ο„ x) (r : a β‡’ b) : subst Οƒ a β‡’ subst Ο„ b" }, { "name": "parLift", ...
[ { "name": "Interp", "content": "inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where\n | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) :\n Interp i I a Pa β†’\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’\n (βˆ€ x Pb, Pf x Pb β†’ Interp i I (subst (x +: var) b) Pb) β†’\n Inte...
[ { "name": "interpPiInv", "content": "theorem interpPiInv {i I a b P} (h : ⟦ pi a b ⟧ i , I β†˜ P) :\n βˆƒ (Pa : Term β†’ Prop) (Pf : Term β†’ (Term β†’ Prop) β†’ Prop),\n (⟦ a ⟧ i , I β†˜ Pa) ∧\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) ∧\n (βˆ€ x Pb, Pf x Pb β†’ ⟦ subst (x +: var) b ⟧ i, I β†˜ Pb) ∧\n P = (Ξ» f ↦ βˆ€ x Pb, Pa x ...
import Β«srcΒ».reduction open Term variable [lc : LevelClass] inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) : Interp i I a Pa β†’ (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’ (βˆ€ x Pb, Pf x Pb β†’ Interp i I (subst (x +: var) b) ...
theorem interpDet' {i I a P Q} (hP : ⟦ a ⟧ i , I β†˜ P) (hQ : ⟦ a ⟧ i , I β†˜ Q) : P = Q :=
:= by induction hP generalizing Q case pi Pa Pf _ hPf _ iha ihb => let ⟨Pa', Pf', ha', hPf', hb', e⟩ := interpPiInv hQ subst e; apply funext; intro f apply propext; constructor . intro h x Pb' Pax' PfxPb' have Pax : Pa x := by rw [iha ha']; exact Pax' let ⟨Pb, PfxPb⟩ := hPf x Pax r...
8
34
false
Type systems
430
interpFwd
theorem interpFwd {i I a b P} (r : a β‡’ b) (h : ⟦ a ⟧ i , I β†˜ P) : ⟦ b ⟧ i , I β†˜ P
TTBFL
src/candidates.lean
[ "import Β«srcΒ».normal", "import src.reduction", "import src.normal" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P", "content": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P" }, { "name": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P", "content": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "diacon", "content": "theorem diacon {a b c} (r₁ : a ⇒⋆ b) (rβ‚‚ : a β‡’ c) : βˆƒ d, b ⇒⋆ d ∧ c ⇒⋆ d" }, { "name": "diamond", "content": "theorem diamond {a b c} (r₁ : a β‡’ b) (rβ‚‚ : a β‡’ c) : βˆƒ d, b β‡’ d ∧ c β‡’ d" }, { "name": "parTaka", "content": "theorem parTaka {a b} (r : a β‡’ b) ...
[ { "name": "Interp", "content": "inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where\n | ne a : ne a β†’ Interp i I a wne\n | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) :\n Interp i I a Pa β†’\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’\n (βˆ€ x Pb, Pf x Pb β†’ Interp i I ...
[ { "name": "interpLvlEq", "content": "theorem interpLvlEq {b c} (r : b β‡’ c) :\n (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ b ⇒⋆ lof k) ∨ wne a) =\n (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ c ⇒⋆ lof k) ∨ wne a)" } ]
import Β«srcΒ».normal open Term variable [lc : LevelClass] inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where | ne a : ne a β†’ Interp i I a wne | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) : Interp i I a Pa β†’ (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’ (βˆ€ x Pb, Pf x Pb β†’ ...
theorem interpFwd {i I a b P} (r : a β‡’ b) (h : ⟦ a ⟧ i , I β†˜ P) : ⟦ b ⟧ i , I β†˜ P :=
:= by induction h generalizing b case pi iha ihb => cases r; constructor all_goals intros; apply_rules [parCong, parRefl] case ne nea => constructor; exact nePar r nea case 𝒰 => cases r; case 𝒰 r => cases r; constructor case mty => cases r; exact Interp.mty case lvl => cases r; case lvl nfb _ r =>...
11
42
false
Type systems
431
wtReplace
theorem wtReplace {Ξ“} {A B c C k : Term} (e : A β‰ˆ B) (hB : Ξ“ ⊒ B ∢ 𝒰 k) (h : Ξ“ ∷ A ⊒ c ∢ C) : Ξ“ ∷ B ⊒ c ∢ C
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.syntactics", "import src.reduction", "import src.typing" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "renameLiftRename", "content": "theorem renameLiftRename ΞΎ a : rename succ (rename ΞΎ a) = rename (lift ΞΎ) (rename succ a)" }, { "name": "liftSucc", "content": "omit lc in\ntheorem liftSucc ΞΎ : βˆ€ x, (lift ΞΎ ∘ succ) x = (succ ∘ ΞΎ) x" }, { "name": "renameComp", "content": "the...
[]
[ { "name": "wtRename", "content": "theorem wtRename {ΞΎ : β„• β†’ β„•} {Ξ“ Ξ”} {a A : Term}\n (hΞΎ : Ξ” ⊒ ΞΎ ∢ Ξ“) (hΞ” : ⊒ Ξ”) (h : Ξ“ ⊒ a ∢ A) :\n Ξ” ⊒ rename ΞΎ a ∢ rename ΞΎ A" }, { "name": "wtWeaken", "content": "theorem wtWeaken {Ξ“ k} {a A B : Term}\n (hΞ“ : ⊒ Ξ“) (hB : Ξ“ ⊒ B ∢ 𝒰 k) (h : Ξ“ ⊒ a ∢ A) :\n Ξ“ ∷...
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ”
theorem wtReplace {Ξ“} {A B c C k : Term} (e : A β‰ˆ B) (hB : Ξ“ ⊒ B ∢ 𝒰 k) (h : Ξ“ ∷ A ⊒ c ∢ C) : Ξ“ ∷ B ⊒ c ∢ C :=
:= by cases wtWf h with | cons wfΞ“ hA => let wfΞ“B := Wf.cons wfΞ“ hB rw [← substId c, ← substId C] refine wtMorph ?_ wfΞ“B h intro x A mem; rw [substId]; cases mem case here => exact Wt.conv (convEqv (convRename succ (convSym (eqvConv e)))) (Wt.var wfΞ“B In.here) (wtWeaken wfΞ“ hB hA) ca...
9
71
false
Type systems
432
wtAbs
theorem wtAbs {Ξ“} {b A B : Term} (v : Value b) (h : Ξ“ ⊒ b ∢ pi A B) : βˆƒ a' b', b = abs a' b'
TTBFL
src/safety.lean
[ "import Β«srcΒ».typing", "import src.reduction", "import src.typing" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "...", "module": "" } ]
[ { "name": "wtfLvlInv", "content": "theorem wtfLvlInv {Ξ“ a 𝒰'}\n (h : Ξ“ ⊒ lvl a ∢ 𝒰') :\n βˆƒ b k, Ξ“ ⊒ a ∢ lvl b ∧ 𝒰 k β‰ˆ 𝒰'" }, { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" }, { "name": "wtfMtyInv", "content": "theorem wtfMtyInv {Ξ“ 𝒰'}\n (h : Ξ“ ⊒ m...
[ { "name": "Value", "content": "inductive Value : Term β†’ Type where\n | 𝒰 {k} : Value (𝒰 k)\n | pi {a b} : Value (pi a b)\n | abs {a b} : Value (abs a b)\n | mty : Value mty\n | lvl {k} : Value (lvl k)\n | lof {k} : Value (lof k)" }, { "name": "valueType", "content": "@[simp] \ndef valueT...
[ { "name": "wtValue", "content": "theorem wtValue {Ξ“} {a A B : Term} (h : Ξ“ ⊒ a ∢ A) (e : A β‰ˆ B) : (v : Value a) β†’ valueType B v\n | Value.𝒰 => let ⟨_, eπ’°βŸ©" } ]
import Β«srcΒ».typing open Nat open Term variable [LevelClass] notation:40 Ξ”:41 "⊒" Οƒ:41 "∢" Ξ“:41 => wSubst Οƒ Ξ“ Ξ” inductive Value : Term β†’ Type where | 𝒰 {k} : Value (𝒰 k) | pi {a b} : Value (pi a b) | abs {a b} : Value (abs a b) | mty : Value mty | lvl {k} : Value (lvl k) | lof {k} : Value (lof k) se...
theorem wtAbs {Ξ“} {b A B : Term} (v : Value b) (h : Ξ“ ⊒ b ∢ pi A B) : βˆƒ a' b', b = abs a' b' :=
:= by generalize e : pi A B = T at h induction h all_goals try first | subst e | injection e case var | app | exf => contradiction case abs => exact ⟨_, _, rfl⟩ case conv h v epi _ _ => let _e := wtValue h epi v cases v <;> let ⟨_, e⟩ := _e case 𝒰 | pi | mty | lvl => cases conv𝒰Pi (eqvConv e) ...
5
34
false
Type systems
433
interpsBwdsP
theorem interpsBwdsP {i a x y P} (r : x ⇒⋆ y) (h : ⟦ a ⟧ i β†˜ P) : P y β†’ P x
TTBFL
src/candidates.lean
[ "import Β«srcΒ».normal", "import src.reduction", "import src.normal" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P", "content": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P" }, { "name": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P", "content": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "wneBwds", "content": "theorem wneBwds {a b} (r : a ⇒⋆ b) : wne b β†’ wne a" }, { "name": "parsApp", "content": "theorem parsApp {a a' b b'} (rb : b ⇒⋆ b') (ra : a ⇒⋆ a') : app b a ⇒⋆ app b' a'" }, { "name": "parRefl", "content": "theorem parRefl a : a β‡’ a" }, { "name...
[ { "name": "Interp", "content": "inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where\n | ne a : ne a β†’ Interp i I a wne\n | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) :\n Interp i I a Pa β†’\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’\n (βˆ€ x Pb, Pf x Pb β†’ Interp i I ...
[ { "name": "interpsBwd", "content": "theorem interpsBwd {i a b P} (r : a β‡’ b) (h : ⟦ b ⟧ i β†˜ P) : ⟦ a ⟧ i β†˜ P" }, { "name": "interpsBwds", "content": "theorem interpsBwds {i a b P} (r : a ⇒⋆ b) (h : ⟦ b ⟧ i β†˜ P) : ⟦ a ⟧ i β†˜ P" } ]
import Β«srcΒ».normal open Term variable [lc : LevelClass] inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where | ne a : ne a β†’ Interp i I a wne | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) : Interp i I a Pa β†’ (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’ (βˆ€ x Pb, Pf x Pb β†’ ...
theorem interpsBwdsP {i a x y P} (r : x ⇒⋆ y) (h : ⟦ a ⟧ i β†˜ P) : P y β†’ P x :=
:= by unfold Interps at h; induction h generalizing x y case ne => exact wneBwds r case pi ihb => intro h x Pb Pax PfxPb exact ihb x Pb PfxPb (parsApp r (Pars.refl x)) (h x Pb Pax PfxPb) case 𝒰 => exact Ξ» ⟨P, h⟩ ↦ ⟨P, interpsBwds r h⟩ case mty => exact wneBwds r case lvl => intro Py; rcases Py ...
4
27
false
Type systems
434
interpsBwdsP
theorem interpsBwdsP {i a x y P} (r : x ⇒⋆ y) (h : ⟦ a ⟧ i β†˜ P) : P y β†’ P x
TTBFL
src/semantics.lean
[ "import src.reduction", "import Β«srcΒ».reduction" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P", "content": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P" }, { "name": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P", "content": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "parsApp", "content": "theorem parsApp {a a' b b'} (rb : b ⇒⋆ b') (ra : a ⇒⋆ a') : app b a ⇒⋆ app b' a'" }, { "name": "parRefl", "content": "theorem parRefl a : a β‡’ a" }, { "name": "parsTrans", "content": "theorem parsTrans {a b c} (r₁ : a ⇒⋆ b) (rβ‚‚ : b ⇒⋆ c) : a ⇒⋆ c" } ...
[ { "name": "Interp", "content": "inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where\n | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) :\n Interp i I a Pa β†’\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’\n (βˆ€ x Pb, Pf x Pb β†’ Interp i I (subst (x +: var) b) Pb) β†’\n Inte...
[ { "name": "interpsBwd", "content": "theorem interpsBwd {i a b P} (r : a β‡’ b) (h : ⟦ b ⟧ i β†˜ P) : ⟦ a ⟧ i β†˜ P" }, { "name": "interpsBwds", "content": "theorem interpsBwds {i a b P} (r : a ⇒⋆ b) (h : ⟦ b ⟧ i β†˜ P) : ⟦ a ⟧ i β†˜ P" } ]
import Β«srcΒ».reduction open Term variable [lc : LevelClass] inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) : Interp i I a Pa β†’ (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’ (βˆ€ x Pb, Pf x Pb β†’ Interp i I (subst (x +: var) b) ...
theorem interpsBwdsP {i a x y P} (r : x ⇒⋆ y) (h : ⟦ a ⟧ i β†˜ P) : P y β†’ P x :=
:= by unfold Interps at h; induction h generalizing x y case pi ihb => intro h x Pb Pax PfxPb exact ihb x Pb PfxPb (parsApp r (Pars.refl x)) (h x Pb Pax PfxPb) case 𝒰 => exact Ξ» ⟨P, h⟩ ↦ ⟨P, interpsBwds r h⟩ case mty => simp case lvl => intro ⟨j, rβ‚‚, lt⟩ exact ⟨j, parsTrans r rβ‚‚, lt⟩ case s...
3
19
false
Type systems
435
wtfAbsInv
theorem wtfAbsInv {Ξ“ A' b C} (h : Ξ“ ⊒ abs A' b ∢ C) : βˆƒ A B, Ξ“ ∷ A ⊒ b ∢ B ∧ A β‰ˆ A' ∧ pi A B β‰ˆ C
TTBFL
src/typing.lean
[ "import src.reduction", "import Β«srcΒ».reduction" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Nat.sub", "module": "Init.Prelude" }, { "n...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "refl", "module": "Mathlib.Order.Defs.Unbundled" }, { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "conv𝒰", "content": "theorem conv𝒰 {a a'} : a ⇔ a' β†’ 𝒰 a ⇔ 𝒰 a'" }, { "name": "pars𝒰", "content": "theorem pars𝒰 {a a'} (r : a ⇒⋆ a') : 𝒰 a ⇒⋆ 𝒰 a'" }, { "name": "convAbs", "content": "theorem convAbs {a a' b b'} : a ⇔ a' β†’ b ⇔ b' β†’ abs a b ⇔ abs a' b'" }, { ...
[ { "name": "Eqv", "content": "inductive Eqv : Term β†’ Term β†’ Prop where\n | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b\n | 𝒰 {a a'} :\n a β‰ˆ a' β†’\n \n 𝒰 a β‰ˆ 𝒰 a'\n | pi {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’\n \n pi a b β‰ˆ pi a' b'\n | abs {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’...
[ { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" } ]
import Β«srcΒ».reduction open Nat open Term variable [LevelClass] section inductive Eqv : Term β†’ Term β†’ Prop where | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b | 𝒰 {a a'} : a β‰ˆ a' β†’ 𝒰 a β‰ˆ 𝒰 a' | pi {a a' b b'} : a β‰ˆ a' β†’ b β‰ˆ b' β†’ pi a b β‰ˆ pi a' b' | abs {a a' b b'} : ...
theorem wtfAbsInv {Ξ“ A' b C} (h : Ξ“ ⊒ abs A' b ∢ C) : βˆƒ A B, Ξ“ ∷ A ⊒ b ∢ B ∧ A β‰ˆ A' ∧ pi A B β‰ˆ C :=
:= by generalize e : abs A' b = t at h induction h all_goals injections <;> subst_eqs <;> specialize_rfls case abs hb _ => exact ⟨_, _, hb, Eqv.refl, Eqv.refl⟩ case trans ih => let ⟨_, _, _, _, eC⟩ := ih cases convLvlPi (convSym (eqvConv eC)) case conv DC _ _ _ ih => let ⟨A, B, hb, AA', ABD⟩ := ...
13
62
false
Type systems
436
interpLvlInv
theorem interpLvlInv {i I b P} (h : ⟦ lvl b ⟧ i , I β†˜ P) : wnf b ∧ P = (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ b ⇒⋆ lof k) ∨ wne a)
TTBFL
src/candidates.lean
[ "import Β«srcΒ».normal", "import src.reduction", "import src.normal" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P", "content": "notation:40 \"⟦\" a \"⟧\" i \",\" I \"β†˜\" P => Interp i I a P" }, { "name": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P", "content": "notation:40 \"⟦\" a \"⟧\" i \"β†˜\" P => Interps i a P" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "diacon", "content": "theorem diacon {a b c} (r₁ : a ⇒⋆ b) (rβ‚‚ : a β‡’ c) : βˆƒ d, b ⇒⋆ d ∧ c ⇒⋆ d" }, { "name": "diamond", "content": "theorem diamond {a b c} (r₁ : a β‡’ b) (rβ‚‚ : a β‡’ c) : βˆƒ d, b β‡’ d ∧ c β‡’ d" }, { "name": "parTaka", "content": "theorem parTaka {a b} (r : a β‡’ b) ...
[ { "name": "Interp", "content": "inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where\n | ne a : ne a β†’ Interp i I a wne\n | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) :\n Interp i I a Pa β†’\n (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’\n (βˆ€ x Pb, Pf x Pb β†’ Interp i I ...
[ { "name": "interpLvlEq", "content": "theorem interpLvlEq {b c} (r : b β‡’ c) :\n (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ b ⇒⋆ lof k) ∨ wne a) =\n (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ c ⇒⋆ lof k) ∨ wne a)" } ]
import Β«srcΒ».normal open Term variable [lc : LevelClass] inductive Interp (i : lc.L) (I : βˆ€ j, j < i β†’ Term β†’ Prop) : Term β†’ (Term β†’ Prop) β†’ Prop where | ne a : ne a β†’ Interp i I a wne | pi a b Pa (Pf : Term β†’ (Term β†’ Prop) β†’ Prop) : Interp i I a Pa β†’ (βˆ€ x, Pa x β†’ βˆƒ Pb, Pf x Pb) β†’ (βˆ€ x Pb, Pf x Pb β†’ ...
theorem interpLvlInv {i I b P} (h : ⟦ lvl b ⟧ i , I β†˜ P) : wnf b ∧ P = (Ξ» a ↦ (βˆƒ j k, j < k ∧ a ⇒⋆ lof j ∧ b ⇒⋆ lof k) ∨ wne a) :=
:= by generalize e : lvl b = c at h induction h generalizing b case ne => subst e; contradiction case lvl nfb => injection e with e; subst e; exact ⟨nfWnf nfb, rfl⟩ case step r _ ih => subst e; let (Par.lvl r₁) := r let ⟨nfc, e⟩ := ih rfl; subst e rw [interpLvlEq r₁] exact ⟨wnfBwds (parPars r₁...
11
41
false
Type systems
437
wtfLvlInv
theorem wtfLvlInv {Ξ“ a 𝒰'} (h : Ξ“ ⊒ lvl a ∢ 𝒰') : βˆƒ b k, Ξ“ ⊒ a ∢ lvl b ∧ 𝒰 k β‰ˆ 𝒰'
TTBFL
src/typing.lean
[ "import src.reduction", "import Β«srcΒ».reduction" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Nat.sub", "module": "Init.Prelude" }, { "n...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "refl", "module": "Mathlib.Order.Defs.Unbundled" }, { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "conv𝒰", "content": "theorem conv𝒰 {a a'} : a ⇔ a' β†’ 𝒰 a ⇔ 𝒰 a'" }, { "name": "pars𝒰", "content": "theorem pars𝒰 {a a'} (r : a ⇒⋆ a') : 𝒰 a ⇒⋆ 𝒰 a'" }, { "name": "convAbs", "content": "theorem convAbs {a a' b b'} : a ⇔ a' β†’ b ⇔ b' β†’ abs a b ⇔ abs a' b'" }, { ...
[ { "name": "Eqv", "content": "inductive Eqv : Term β†’ Term β†’ Prop where\n | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b\n | 𝒰 {a a'} :\n a β‰ˆ a' β†’\n \n 𝒰 a β‰ˆ 𝒰 a'\n | pi {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’\n \n pi a b β‰ˆ pi a' b'\n | abs {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’...
[ { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" } ]
import Β«srcΒ».reduction open Nat open Term variable [LevelClass] section inductive Eqv : Term β†’ Term β†’ Prop where | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b | 𝒰 {a a'} : a β‰ˆ a' β†’ 𝒰 a β‰ˆ 𝒰 a' | pi {a a' b b'} : a β‰ˆ a' β†’ b β‰ˆ b' β†’ pi a b β‰ˆ pi a' b' | abs {a a' b b'} : ...
theorem wtfLvlInv {Ξ“ a 𝒰'} (h : Ξ“ ⊒ lvl a ∢ 𝒰') : βˆƒ b k, Ξ“ ⊒ a ∢ lvl b ∧ 𝒰 k β‰ˆ 𝒰' :=
:= by generalize e : lvl a = t at h induction h all_goals injections <;> subst_eqs <;> specialize_rfls case lvl ha _ => exact ⟨_, _, ha, Eqv.refl⟩ case trans ih => let ⟨_, _, _, e⟩ := ih cases convLvl𝒰 (convSym (eqvConv e)) case conv e₁ _ _ _ ih => let ⟨b, _, ha, eβ‚‚βŸ© := ih exact ⟨b, _, ha, ...
13
60
false
Type systems
438
wtfMtyInv
theorem wtfMtyInv {Ξ“ 𝒰'} (h : Ξ“ ⊒ mty ∢ 𝒰') : βˆƒ k, 𝒰 k β‰ˆ 𝒰'
TTBFL
src/typing.lean
[ "import src.reduction", "import Β«srcΒ».reduction" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Inhabited", "module": "Init.Prelude" }, { ...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "refl", "module": "Mathlib.Order.Defs.Unbundled" }, { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "conv𝒰", "content": "theorem conv𝒰 {a a'} : a ⇔ a' β†’ 𝒰 a ⇔ 𝒰 a'" }, { "name": "pars𝒰", "content": "theorem pars𝒰 {a a'} (r : a ⇒⋆ a') : 𝒰 a ⇒⋆ 𝒰 a'" }, { "name": "convAbs", "content": "theorem convAbs {a a' b b'} : a ⇔ a' β†’ b ⇔ b' β†’ abs a b ⇔ abs a' b'" }, { ...
[ { "name": "Eqv", "content": "inductive Eqv : Term β†’ Term β†’ Prop where\n | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b\n | 𝒰 {a a'} :\n a β‰ˆ a' β†’\n \n 𝒰 a β‰ˆ 𝒰 a'\n | pi {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’\n \n pi a b β‰ˆ pi a' b'\n | abs {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’...
[ { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" } ]
import Β«srcΒ».reduction open Nat open Term variable [LevelClass] section inductive Eqv : Term β†’ Term β†’ Prop where | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b | 𝒰 {a a'} : a β‰ˆ a' β†’ 𝒰 a β‰ˆ 𝒰 a' | pi {a a' b b'} : a β‰ˆ a' β†’ b β‰ˆ b' β†’ pi a b β‰ˆ pi a' b' | abs {a a' b b'} : ...
theorem wtfMtyInv {Ξ“ 𝒰'} (h : Ξ“ ⊒ mty ∢ 𝒰') : βˆƒ k, 𝒰 k β‰ˆ 𝒰' :=
:= by generalize e : mty = t at h induction h all_goals injections <;> subst_eqs <;> specialize_rfls case mty | sub => exact ⟨_, Eqv.refl⟩ case trans ih => let ⟨_, e⟩ := ih cases convLvl𝒰 (convSym (eqvConv e)) case conv e₁ _ _ _ ih => let ⟨_, eβ‚‚βŸ© := ih exact ⟨_, Eqv.trans eβ‚‚ eβ‚βŸ©
13
59
false
Type systems
439
parsAntirenaming
theorem parsAntirenaming {ΞΎ a b'} (r : rename ΞΎ a ⇒⋆ b') : βˆƒ b, b' = rename ΞΎ b ∧ a ⇒⋆ b
TTBFL
src/reduction.lean
[ "import src.syntactics", "import Β«srcΒ».syntactics", "import Β«srcΒ».tactics" ]
[ { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "String", "module": "Init.Prelude" }, { "name"...
[ { "name": "Term", "content": "inductive Term : Type where\n | var : Nat β†’ Term\n | 𝒰 : Term β†’ Term\n | pi : Term β†’ Term β†’ Term\n | abs : Term β†’ Term β†’ Term\n | app : Term β†’ Term β†’ Term\n | mty : Term\n | exf : Term β†’ Term β†’ Term\n | lvl : Term β†’ Term\n | lof : lc.L β†’ Term" }, { "name": "su...
[ { "name": "...", "module": "" } ]
[ { "name": "renameDist", "content": "theorem renameDist ΞΎ a s : subst (rename ΞΎ a +: var) (rename (lift ΞΎ) s) = rename ΞΎ (subst (a +: var) s)" }, { "name": "substExt", "content": "theorem substExt Οƒ Ο„ (h : βˆ€ x, Οƒ x = Ο„ x) : βˆ€ s, subst Οƒ s = subst Ο„ s" }, { "name": "upExt", "content": ...
[ { "name": "Par", "content": "inductive Par : Term β†’ Term β†’ Prop where\n | Ξ² {b b' a a' c} :\n b β‡’ b' β†’\n a β‡’ a' β†’\n \n app (abs c b) a β‡’ subst (a' +: var) b'\n | var s : var s β‡’ var s\n | 𝒰 {a a'} :\n a β‡’ a' β†’\n \n 𝒰 a β‡’ 𝒰 a'\n | pi {a a' b b'} :\n a β‡’ a' β†’\n b β‡’ b' β†’\n ...
[ { "name": "parRefl", "content": "theorem parRefl a : a β‡’ a" }, { "name": "antirenaming", "content": "theorem antirenaming {ΞΎ a b'} (r : rename ΞΎ a β‡’ b') : βˆƒ b, b' = rename ΞΎ b ∧ a β‡’ b" } ]
import Β«srcΒ».tactics import Β«srcΒ».syntactics open Term variable [LevelClass] section inductive Par : Term β†’ Term β†’ Prop where | Ξ² {b b' a a' c} : b β‡’ b' β†’ a β‡’ a' β†’ app (abs c b) a β‡’ subst (a' +: var) b' | var s : var s β‡’ var s | 𝒰 {a a'} : a β‡’ a' β†’ 𝒰 a β‡’ 𝒰 a' | pi {a a' b b...
theorem parsAntirenaming {ΞΎ a b'} (r : rename ΞΎ a ⇒⋆ b') : βˆƒ b, b' = rename ΞΎ b ∧ a ⇒⋆ b :=
:= by generalize e : rename ξ a = a' at r induction r generalizing ξ a <;> subst e case refl => exact ⟨a, rfl, Pars.refl a⟩ case trans ih ra => let ⟨b, eb, rb⟩ := antirenaming ra; subst eb let ⟨c, ec, rc⟩ := ih rfl exact ⟨c, ec, Pars.trans rb rc⟩
5
25
false
Type systems
440
substUnion
theorem substUnion Οƒ a s : subst (a +: Οƒ) s = subst (a +: var) (subst (⇑ Οƒ) s)
TTBFL
src/syntactics.lean
[ "import Β«srcΒ».level" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Nat.succ", "module": "Init.Prelude" }, { "name": "Nat.zero", "module": "Init.Prelude" } ]
[ { "name": "LevelClass", "content": "class LevelClass where\n L : Type\n lc : LevelClasses L" } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "cons", "content": "@[simp]\ndef cons {A : Type} (x : A) (ΞΎ : Nat β†’ A) : Nat β†’ A\n | 0 => x\n | n + 1 => ΞΎ n" }, { "name": "Term", "content": "inductive Term : Type where\n | var : Nat β†’ Term\n | 𝒰 : Term β†’ Term\n | pi : Term β†’ Term β†’ Term\n | abs : Term β†’ Term β†’ Term\n | app :...
[ { "name": "upExt", "content": "theorem upExt Οƒ Ο„ (h : βˆ€ x, Οƒ x = Ο„ x) : βˆ€ x, (⇑ Οƒ) x = (⇑ Ο„) x" }, { "name": "substExt", "content": "theorem substExt Οƒ Ο„ (h : βˆ€ x, Οƒ x = Ο„ x) : βˆ€ s, subst Οƒ s = subst Ο„ s" }, { "name": "substDropAll", "content": "theorem substDropAll a b : b = subst (...
import Β«srcΒ».level open Nat variable [lc : LevelClass] @[simp] def cons {A : Type} (x : A) (ΞΎ : Nat β†’ A) : Nat β†’ A | 0 => x | n + 1 => ΞΎ n infixr:50 "+:" => cons inductive Term : Type where | var : Nat β†’ Term | 𝒰 : Term β†’ Term | pi : Term β†’ Term β†’ Term | abs : Term β†’ Term β†’ Term | app : Term β†’ Term ...
theorem substUnion Οƒ a s : subst (a +: Οƒ) s = subst (a +: var) (subst (⇑ Οƒ) s) :=
:= by calc subst (a +: Οƒ) s = subst (subst (a +: var) ∘ (var 0 +: (rename succ ∘ Οƒ))) s := by apply substExt; intro n; cases n <;> simp; rw [← substDropAll] _ = subst (a +: var) (subst (⇑ Οƒ) s) := by rw [← substComp]; rfl
4
16
false
Type systems
441
substDist
theorem substDist Οƒ a s : subst (subst Οƒ a +: var) (subst (⇑ Οƒ) s) = subst Οƒ (subst (a +: var) s)
TTBFL
src/syntactics.lean
[ "import Β«srcΒ».level" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Nat.succ", "module": "Init.Prelude" }, { "name": "Nat.zero", "module": "Init.Prelude" } ]
[ { "name": "LevelClass", "content": "class LevelClass where\n L : Type\n lc : LevelClasses L" } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "cons", "content": "@[simp]\ndef cons {A : Type} (x : A) (ΞΎ : Nat β†’ A) : Nat β†’ A\n | 0 => x\n | n + 1 => ΞΎ n" }, { "name": "Term", "content": "inductive Term : Type where\n | var : Nat β†’ Term\n | 𝒰 : Term β†’ Term\n | pi : Term β†’ Term β†’ Term\n | abs : Term β†’ Term β†’ Term\n | app :...
[ { "name": "upExt", "content": "theorem upExt Οƒ Ο„ (h : βˆ€ x, Οƒ x = Ο„ x) : βˆ€ x, (⇑ Οƒ) x = (⇑ Ο„) x" }, { "name": "substExt", "content": "theorem substExt Οƒ Ο„ (h : βˆ€ x, Οƒ x = Ο„ x) : βˆ€ s, subst Οƒ s = subst Ο„ s" }, { "name": "substDropAll", "content": "theorem substDropAll a b : b = subst (...
import Β«srcΒ».level open Nat variable [lc : LevelClass] @[simp] def cons {A : Type} (x : A) (ΞΎ : Nat β†’ A) : Nat β†’ A | 0 => x | n + 1 => ΞΎ n infixr:50 "+:" => cons inductive Term : Type where | var : Nat β†’ Term | 𝒰 : Term β†’ Term | pi : Term β†’ Term β†’ Term | abs : Term β†’ Term β†’ Term | app : Term β†’ Term ...
theorem substDist Οƒ a s : subst (subst Οƒ a +: var) (subst (⇑ Οƒ) s) = subst Οƒ (subst (a +: var) s) :=
:= by calc subst (subst Οƒ a +: var) (subst (⇑ Οƒ) s) = subst (subst Οƒ a +: Οƒ) s := by rw [← substUnion] _ = subst (subst Οƒ ∘ (a +: var)) s := by apply substExt; intro n; cases n <;> rfl _ = (subst Οƒ ∘ subst (a +: var)) s := by rw [← substComp]
4
17
false
Type systems
442
wtfLofInv
theorem wtfLofInv {Ξ“ j 𝒰'} (h : Ξ“ ⊒ lof j ∢ 𝒰') : βˆƒ k, lvl k β‰ˆ 𝒰'
TTBFL
src/typing.lean
[ "import src.reduction", "import Β«srcΒ».reduction" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Lean.ToExpr", "module": "Lean.ToExpr" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Nat.sub", "module": "Init.Prelude" }, { "n...
[ { "name": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”", "content": "notation:40 Ξ”:41 \"⊒\" ΞΎ:41 \"∢\" Ξ“:41 => wRename ΞΎ Ξ“ Ξ”" }, { "name": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“", "content": "notation:40 \"⊒\" Ξ“:40 => Wf Ξ“" }, { "name": "notation:40 Ξ“:41 \"⊒\" a:41 \"∢\" A:41 => Wt ...
[ { "name": "refl", "module": "Mathlib.Order.Defs.Unbundled" }, { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "conv𝒰", "content": "theorem conv𝒰 {a a'} : a ⇔ a' β†’ 𝒰 a ⇔ 𝒰 a'" }, { "name": "pars𝒰", "content": "theorem pars𝒰 {a a'} (r : a ⇒⋆ a') : 𝒰 a ⇒⋆ 𝒰 a'" }, { "name": "convAbs", "content": "theorem convAbs {a a' b b'} : a ⇔ a' β†’ b ⇔ b' β†’ abs a b ⇔ abs a' b'" }, { ...
[ { "name": "Eqv", "content": "inductive Eqv : Term β†’ Term β†’ Prop where\n | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b\n | 𝒰 {a a'} :\n a β‰ˆ a' β†’\n \n 𝒰 a β‰ˆ 𝒰 a'\n | pi {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’\n \n pi a b β‰ˆ pi a' b'\n | abs {a a' b b'} :\n a β‰ˆ a' β†’\n b β‰ˆ b' β†’...
[ { "name": "eqvConv", "content": "theorem eqvConv {a b} (r : a β‰ˆ b) : a ⇔ b" } ]
import Β«srcΒ».reduction open Nat open Term variable [LevelClass] section inductive Eqv : Term β†’ Term β†’ Prop where | Ξ² {b a c} : app (abs c b) a β‰ˆ subst (a +: var) b | 𝒰 {a a'} : a β‰ˆ a' β†’ 𝒰 a β‰ˆ 𝒰 a' | pi {a a' b b'} : a β‰ˆ a' β†’ b β‰ˆ b' β†’ pi a b β‰ˆ pi a' b' | abs {a a' b b'} : ...
theorem wtfLofInv {Ξ“ j 𝒰'} (h : Ξ“ ⊒ lof j ∢ 𝒰') : βˆƒ k, lvl k β‰ˆ 𝒰' :=
:= by generalize e : lof j = t at h induction h all_goals injections <;> subst_eqs <;> specialize_rfls case lof | trans => exact ⟨_, Eqv.refl⟩ case conv e₁ _ _ _ ih => let ⟨_, eβ‚‚βŸ© := ih exact ⟨_, Eqv.trans eβ‚‚ eβ‚βŸ© case sub ih => let ⟨_, e⟩ := ih cases convLvl𝒰 (eqvConv e)
13
60
false
Type systems
443
StateT.set_get
theorem set_get : (do let s ← @StateT.get Οƒ m _; StateT.set s) = pure ⟨⟩
VCV-io
ToMathlib/Control/Lawful/MonadState.lean
[]
[ { "name": "StateT", "module": "Init.Control.State" }, { "name": "StateT.get", "module": "Init.Control.State" }, { "name": "StateT.bind", "module": "Init.Control.State" }, { "name": "StateT.instMonad", "module": "Init.Control.State" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[]
[]
namespace LawfulMonadStateOf variable {Οƒ : Type u} {m : Type u β†’ Type v} variable [Monad m] [LawfulMonad m] [MonadStateOf Οƒ m] [LawfulMonadStateOf Οƒ m] end LawfulMonadStateOf namespace LawfulMonadState variable {Οƒ : Type u} {m : Type u β†’ Type v} [Monad m] [LawfulMonad m] [LawfulMonadState Οƒ m] end LawfulMonadStat...
theorem set_get : (do let s ← @StateT.get Οƒ m _; StateT.set s) = pure ⟨⟩ :=
:= by unfold StateT.get StateT.instMonad StateT.bind StateT.set StateT.pure simp only [bind_pure_comp, map_pure]
1
4
false
Applied verif.
444
triple_forIn_deacreasing
theorem triple_forIn_deacreasing {Ξ²} {measure : Ξ² -> β„•} {init : Ξ²} {f : Ξ² β†’ m (ForInStep Ξ²)} (inv : Ξ² β†’ l) (hstep : βˆ€ b, measure b <= measure init -> triple (inv b) (f b) (fun | .yield b' => inv b' βŠ“ ⌜measure b' < measure b⌝ | .done b' => ⌜ measure b' = 0 ⌝ βŠ“ inv b')) : triple (inv ini...
loom
Loom/MonadAlgebras/WP/Gen.lean
[ "import Loom.MonadAlgebras.WP.Liberal", "import Mathlib.Order.Lattice", "import Mathlib.Order.Basic", "import Loom.MonadAlgebras.WP.DoNames'", "import Mathlib.Order.CompleteBooleanAlgebra", "import Mathlib.Logic.Function.Basic", "import Loom.MonadAlgebras.WP.Basic" ]
[ { "name": "Cont", "module": "Mathlib.Control.Monad.Cont" }, { "name": "liftM", "module": "Init.Prelude" }, { "name": "ForInStep", "module": "Init.Core" }, { "name": "Std.Range", "module": "Init.Data.Range.Basic" }, { "name": "List", "module": "Init.Prelude" ...
[ { "name": "macro \"⌜\" p:term \"⌝\" : term => `(LE.pure $p)", "content": "macro \"⌜\" p:term \"⌝\" : term => `(LE.pure $p)" }, { "name": "Kind", "content": "inductive Kind where\n | regular\n | forIn\n | forInWithReturn\n | nestedBC\n | nestedPR\n | nestedSBC\n | nestedPRBC" }, { ...
[ { "name": "le_trans", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "le_trans'", "module": "Mathlib.Order.Basic" } ]
[ { "name": "wp_cons", "content": "lemma wp_cons (x : m Ξ±) (post post' : Ξ± -> l) :\n (βˆ€ y, post y ≀ post' y) ->\n wp x post ≀ wp x post'" }, { "name": "triple_forIn_range_step1", "content": "theorem triple_forIn_range_step1 {Ξ²}\n {xs : Std.Range} {init : Ξ²} {f : β„• β†’ Ξ² β†’ m (ForInStep Ξ²)}\n (inv...
[]
[]
import Mathlib.Logic.Function.Basic import Mathlib.Order.CompleteBooleanAlgebra import Mathlib.Order.Lattice import Mathlib.Order.Basic import Loom.MonadAlgebras.WP.Basic import Loom.MonadAlgebras.WP.Liberal import Loom.MonadAlgebras.WP.DoNames' open Lean Meta Elab Command Term section variable {m : Type u -> ...
theorem triple_forIn_deacreasing {Ξ²} {measure : Ξ² -> β„•} {init : Ξ²} {f : Ξ² β†’ m (ForInStep Ξ²)} (inv : Ξ² β†’ l) (hstep : βˆ€ b, measure b <= measure init -> triple (inv b) (f b) (fun | .yield b' => inv b' βŠ“ ⌜measure b' < measure b⌝ | .done b' => ⌜ measure b' = 0 ⌝ βŠ“ inv b')) : triple (inv ini...
:= by apply le_trans'; apply wp_cons; rotate_left 2; apply le_trans; rotate_left 1 apply triple_forIn_range_step1 (inv := fun i b => ⌜ measure b + i <= measure init ⌝ βŠ“ inv b) <;> try solve | aesop { simp; intro i b by_cases h : measure b + i ≀ measure init <;> simp [h, triple] apply le_trans; apply h...
6
20
true
Framework
445
OracleComp.evalDist_liftComp
@[simp] lemma evalDist_liftComp [spec.FiniteRange] [superSpec.FiniteRange] (oa : OracleComp spec Ξ±) : evalDist (liftComp oa superSpec) = evalDist oa
VCV-io
VCVio/OracleComp/Coercions/SubSpec.lean
[ "import VCVio.OracleComp.Constructions.UniformSelect", "import VCVio.OracleComp.DistSemantics.EvalDist", "import VCVio.OracleComp.SimSemantics.SimulateQ" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "impl", "module": "Mathlib.Deprecated.MLList.BestFirst" }, { "name": "Bind", "module": "Init.Prelude" }, { "name": "Pure", "module": "Init.Prelude" }, { "name": "OptionT", "module": "Init.Control.Option" ...
[ { "name": "simulateQ", "content": "def simulateQ [AlternativeMonad m] (so : QueryImpl spec m) (oa : OracleComp spec Ξ±) : m Ξ± :=\n do Option.getM (← FreeMonad.mapM oa.run so.impl)" }, { "name": "QueryImpl.Inhabited", "content": "instance QueryImpl.Inhabited [βˆ€ i, Inhabited (spec.range i)] [Pure ...
[ { "name": "Function.comp_apply", "module": "Init.Core" }, { "name": "StateT.run'_eq", "module": "Init.Control.Lawful.Instances" }, { "name": "StateT.run_bind", "module": "Init.Control.Lawful.Instances" }, { "name": "StateT.run_monadLift", "module": "Init.Control.Lawful.In...
[ { "name": "simulateQ_bind", "content": "@[simp] lemma simulateQ_bind (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) :\n simulateQ so (oa >>= ob) = simulateQ so oa >>= (simulateQ so ∘ ob)" }, { "name": "simulateQ_query_bind", "content": "@[simp] lemma simulateQ_query_bind (q : OracleQue...
[ { "name": "OracleSpec.SubSpec", "content": "class SubSpec (spec : OracleSpec.{u,w} ΞΉ) (superSpec : OracleSpec Ο„)\n extends MonadLift (OracleQuery spec) (OracleQuery superSpec) where" }, { "name": "OracleComp.liftComp", "content": "def liftComp (oa : OracleComp spec Ξ±) (superSpec : OracleSpec Ο„)...
[ { "name": "OracleComp.liftComp_pure", "content": "@[simp]\nlemma liftComp_pure (x : Ξ±) : liftComp (pure x : OracleComp spec Ξ±) superSpec = pure x" } ]
import VCVio.OracleComp.SimSemantics.SimulateQ import VCVio.OracleComp.Constructions.UniformSelect open OracleSpec OracleComp BigOperators ENNReal variable {ΞΉ : Type u} {Ο„ : Type v} {spec : OracleSpec ΞΉ} {superSpec : OracleSpec Ο„} {Ξ± Ξ² Ξ³ : Type w} namespace OracleSpec infix : 50 " βŠ‚β‚’ " => SubSpec namespace SubS...
@[simp] lemma evalDist_liftComp [spec.FiniteRange] [superSpec.FiniteRange] (oa : OracleComp spec Ξ±) : evalDist (liftComp oa superSpec) = evalDist oa :=
:= by induction oa using OracleComp.inductionOn with | pure x => simp [liftComp_pure] | query_bind i t oa hoa => simp only [liftComp, simulateQ_bind, simulateQ_query, StateT.run'_eq, StateT.run_bind, StateT.run_monadLift, SubSpec.liftM_query_eq_liftM_liftM, bind_pure_comp, Function.comp_appl...
6
46
true
Applied verif.
446
OracleComp.pure_eq_bind_iff
@[simp] lemma pure_eq_bind_iff (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) (y : Ξ²) : pure y = oa >>= ob ↔ βˆƒ x : Ξ±, oa = pure x ∧ ob x = pure y
VCV-io
VCVio/OracleComp/OracleComp.lean
[ "import ToMathlib.Control.AlternativeMonad", "import ToMathlib.Control.Monad.Free", "import VCVio.OracleComp.OracleSpec", "import ToMathlib.Control.WriterT", "import Mathlib.Control.Lawful", "import ToMathlib.Control.OptionT" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prelude" } ]
[ { "name": "domain", "content": "@[inline, reducible]\nprotected def domain (spec : OracleSpec ΞΉ) (i : ΞΉ) : Type v := (spec i).1" }, { "name": "OracleSpec", "content": "def OracleSpec (ΞΉ : Type u) : Type (max u (v + 1)) :=\n (i : ΞΉ) β†’ Type v Γ— Type v" }, { "name": "range", "content":...
[ { "name": "eq_comm", "module": "Init.Core" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "OracleSpec.OracleQuery", "content": "inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max u v)\n | query (i : ΞΉ) (t : spec.domain i) : OracleQuery spec (spec.range i)" }, { "name": "OracleComp", "content": "def OracleComp {ΞΉ : Type u} (spec : OracleSpec...
[ { "name": "OracleComp.bind_eq_pure_iff", "content": "@[simp]\nlemma bind_eq_pure_iff (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) (y : Ξ²) :\n oa >>= ob = pure y ↔ βˆƒ x : Ξ±, oa = pure x ∧ ob x = pure y" } ]
import ToMathlib.Control.Monad.Free import ToMathlib.Control.WriterT import ToMathlib.Control.AlternativeMonad import ToMathlib.Control.OptionT import Mathlib.Control.Lawful import VCVio.OracleComp.OracleSpec namespace OracleSpec inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max...
@[simp] lemma pure_eq_bind_iff (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) (y : Ξ²) : pure y = oa >>= ob ↔ βˆƒ x : Ξ±, oa = pure x ∧ ob x = pure y :=
:= by apply eq_comm.trans (bind_eq_pure_iff oa ob y) alias ⟨_, bind_eq_pure⟩ := bind_eq_pure_iff alias ⟨_, pure_eq_bind⟩ := pure_eq_bind_iff
4
13
true
Applied verif.
447
OracleComp.evalDist_uniformSelectFinset
@[simp] lemma evalDist_uniformSelectFinset [DecidableEq Ξ±] (s : Finset Ξ±) : evalDist ($ s) = if hs : s.Nonempty then OptionT.lift (PMF.uniformOfFinset s hs) else failure
VCV-io
VCVio/OracleComp/Constructions/UniformSelect.lean
[ "import Batteries.Control.OptionT", "import VCVio.OracleComp.DistSemantics.Prod", "import VCVio.OracleComp.DistSemantics.EvalDist", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "Finset", "module": "Mathlib.Data.Finset.Defs" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "OptionT.lift", "module": "Init.Control.Option" }, { "name": "PMF", "module": "Mathlib.Pr...
[ { "name": "probFailure", "content": "notation \"[βŠ₯\" \"|\" oa \"]\" => probFailure oa" }, { "name": "emptySpec", "content": "notation \"[]β‚’\" => emptySpec" }, { "name": "uniformFin", "content": "notation \"$[0..\" n \"]\" => uniformFin n" }, { "name": "notation:50 \"$[\" n \"...
[ { "name": "Finset.nonempty_iff_ne_empty", "module": "Mathlib.Data.Finset.Empty" }, { "name": "div_eq_mul_inv", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "eq_comm", "module": "Init.Core" }, { "name": "Finset.mem_toList", "module": "Mathlib.Data.Finset.Dedup" },...
[ { "name": "probOutput_map_eq_sum_fintype_ite", "content": "lemma probOutput_map_eq_sum_fintype_ite [Fintype Ξ±] [DecidableEq Ξ²] (y : Ξ²) :\n [= y | f <$> oa] = βˆ‘ x : Ξ±, if y = f x then [= x | oa] else 0" }, { "name": "probOutput_map_eq_tsum_ite", "content": "lemma probOutput_map_eq_tsum_ite [De...
[]
[ { "name": "OracleComp.uniformSelectList_cons", "content": "lemma uniformSelectList_cons (x : Ξ±) (xs : List Ξ±) :\n ($ x :: xs : ProbComp Ξ±) = ((x :: xs)[Β·]) <$> $[0..xs.length]" }, { "name": "OracleComp.probOutput_uniformSelectList", "content": "@[simp] lemma probOutput_uniformSelectList [Deci...
import VCVio.OracleComp.DistSemantics.Prod import Batteries.Control.OptionT open OracleSpec BigOperators ENNReal namespace OracleComp section uniformSelect prefix : 50 "$" => uniformSelect _ variable {cont Ξ² : Type} [h : HasUniformSelect cont Ξ²] end uniformSelect section uniformSelectList variable {Ξ± : Type} ...
@[simp] lemma evalDist_uniformSelectFinset [DecidableEq Ξ±] (s : Finset Ξ±) : evalDist ($ s) = if hs : s.Nonempty then OptionT.lift (PMF.uniformOfFinset s hs) else failure :=
:= by refine PMF.ext Ξ» x ↦ ?_ by_cases hs : s.Nonempty Β· cases x with | none => refine (probFailure_uniformSelectFinset _).trans ?_ simp [hs, OptionT.lift, OptionT.mk] | some x => simp only [hs, ↓reduceDIte] refine (probOutput_uniformSelectFinset _ _).trans ?_ simp ...
7
71
true
Applied verif.
448
OracleComp.query_bind_eq_roll
lemma query_bind_eq_roll (q : OracleQuery spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) : (q : OracleComp spec Ξ±) >>= ob = OptionT.mk (FreeMonad.roll q ob) := rfl
VCV-io
VCVio/OracleComp/OracleComp.lean
[ "import ToMathlib.Control.AlternativeMonad", "import ToMathlib.Control.Monad.Free", "import VCVio.OracleComp.OracleSpec", "import ToMathlib.Control.WriterT", "import Mathlib.Control.Lawful", "import ToMathlib.Control.OptionT" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "OptionT.mk", "module": "Init.Control.Option" } ]
[ { "name": "domain", "content": "@[inline, reducible]\nprotected def domain (spec : OracleSpec ΞΉ) (i : ΞΉ) : Type v := (spec i).1" }, { "name": "OracleSpec", "content": "def OracleSpec (ΞΉ : Type u) : Type (max u (v + 1)) :=\n (i : ΞΉ) β†’ Type v Γ— Type v" }, { "name": "range", "content":...
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "OracleSpec.OracleQuery", "content": "inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max u v)\n | query (i : ΞΉ) (t : spec.domain i) : OracleQuery spec (spec.range i)" }, { "name": "OracleComp", "content": "def OracleComp {ΞΉ : Type u} (spec : OracleSpec...
[]
import ToMathlib.Control.Monad.Free import ToMathlib.Control.WriterT import ToMathlib.Control.AlternativeMonad import ToMathlib.Control.OptionT import Mathlib.Control.Lawful import VCVio.OracleComp.OracleSpec namespace OracleSpec inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max...
lemma query_bind_eq_roll (q : OracleQuery spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) : (q : OracleComp spec Ξ±) >>= ob = OptionT.mk (FreeMonad.roll q ob) :=
:= rfl
3
9
false
Applied verif.
449
OracleComp.queryBind_inj
@[simp] lemma queryBind_inj (q q' : OracleQuery spec Ξ±) (ob ob' : Ξ± β†’ OracleComp spec Ξ²) : (q : OracleComp spec Ξ±) >>= ob = (q' : OracleComp spec Ξ±) >>= ob' ↔ q = q' ∧ ob = ob'
VCV-io
VCVio/OracleComp/OracleComp.lean
[ "import ToMathlib.Control.AlternativeMonad", "import ToMathlib.Control.Monad.Free", "import VCVio.OracleComp.OracleSpec", "import ToMathlib.Control.WriterT", "import Mathlib.Control.Lawful", "import ToMathlib.Control.OptionT" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "OptionT.bind", "module": "Init.Control.Option" }, { "name": "OptionT.lift", "module": "Init.Control.Option" }, { "name": "OptionT.mk", "module": "In...
[ { "name": "domain", "content": "@[inline, reducible]\nprotected def domain (spec : OracleSpec ΞΉ) (i : ΞΉ) : Type v := (spec i).1" }, { "name": "OracleSpec", "content": "def OracleSpec (ΞΉ : Type u) : Type (max u (v + 1)) :=\n (i : ΞΉ) β†’ Type v Γ— Type v" }, { "name": "range", "content":...
[ { "name": "heq_eq_eq", "module": "Init.SimpLemmas" }, { "name": "true_and", "module": "Init.SimpLemmas" } ]
[ { "name": "bind_pure", "content": "@[simp]\nlemma bind_pure (x : Ξ±) (r : Ξ± β†’ FreeMonad f Ξ²) :\n FreeMonad.bind (FreeMonad.pure x) r = r x" }, { "name": "monad_bind_def", "content": "@[simp]\nlemma monad_bind_def (x : FreeMonad f Ξ±) (g : Ξ± β†’ FreeMonad f Ξ²) :\n x >>= g = FreeMonad.bind x g" ...
[ { "name": "OracleSpec.OracleQuery", "content": "inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max u v)\n | query (i : ΞΉ) (t : spec.domain i) : OracleQuery spec (spec.range i)" }, { "name": "OracleComp", "content": "def OracleComp {ΞΉ : Type u} (spec : OracleSpec...
[ { "name": "OracleComp.liftM_def", "content": "protected lemma liftM_def (q : OracleQuery spec Ξ±) :\n (q : OracleComp spec Ξ±) = OptionT.lift (FreeMonad.lift q)" }, { "name": "OracleComp.bind_def", "content": "protected lemma bind_def (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) :\n ...
import ToMathlib.Control.Monad.Free import ToMathlib.Control.WriterT import ToMathlib.Control.AlternativeMonad import ToMathlib.Control.OptionT import Mathlib.Control.Lawful import VCVio.OracleComp.OracleSpec namespace OracleSpec inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max...
@[simp] lemma queryBind_inj (q q' : OracleQuery spec Ξ±) (ob ob' : Ξ± β†’ OracleComp spec Ξ²) : (q : OracleComp spec Ξ±) >>= ob = (q' : OracleComp spec Ξ±) >>= ob' ↔ q = q' ∧ ob = ob' :=
:= by simp only [OracleComp.liftM_def, OptionT.lift, OptionT.mk, FreeMonad.monad_pure_def, FreeMonad.monad_bind_def, FreeMonad.bind_lift, OracleComp.bind_def, OptionT.bind, FreeMonad.bind_roll, FreeMonad.bind_pure] rw [FreeMonad.roll.injEq] simp only [heq_eq_eq, true_and]
3
22
false
Applied verif.
450
OracleComp.probFailure_bind_eq_sub_mul
lemma probFailure_bind_eq_sub_mul {oa : OracleComp spec Ξ±} {ob : Ξ± β†’ OracleComp spec Ξ²} (r : ℝβ‰₯0∞) (h : βˆ€ x, [βŠ₯ | ob x] = r) : [βŠ₯ | oa >>= ob] = 1 - (1 - [βŠ₯ | oa]) * (1 - r)
VCV-io
VCVio/OracleComp/DistSemantics/EvalDist.lean
[ "import Mathlib.Probability.Distributions.Uniform", "import VCVio.OracleComp.SimSemantics.SimulateQ", "import VCVio.OracleComp.Traversal", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "AddLECancellable", "module": "Mathlib.Algebra.Order.Monoid.Unbundled.Basic" }, { "name": "ENNReal", "module": "Mathlib.Data.ENNReal.Basic" }, { "name": ...
[ { "name": "probFailure", "content": "notation \"[βŠ₯\" \"|\" oa \"]\" => probFailure oa" }, { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "HasEvalDist", "content": "class HasEvalDist (m : Type u β†’ Type v) [Monad m] where\n evalDi...
[ { "name": "ENNReal.summable", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas" }, { "name": "symm", "module": "Mathlib.Order.Defs.Unbundled" }, { "name": "le_add_self", "module": "Mathlib.Algebra.Order.Monoid.Canonical.Defs" }, { "name": "le_of_le_of_eq", "module": "...
[ { "name": "tsum_option", "content": "lemma tsum_option {Ξ± Ξ² : Type*} [AddCommMonoid Ξ±] [TopologicalSpace Ξ±]\n [ContinuousAdd Ξ±] [T2Space Ξ±]\n (f : Option Ξ² β†’ Ξ±) (hf : Summable (Function.update f none 0)) :\n βˆ‘' x : Option Ξ², f x = f none + βˆ‘' x : Ξ², f (some x)" } ]
[ { "name": "OracleComp.probOutput", "content": "noncomputable def probOutput (oa : OracleComp spec Ξ±) (x : Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run (some x)" }, { "name": "OracleComp.probFailure", "content": "noncomputable def probFailure (oa : OracleComp spec Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run none" }...
[ { "name": "OracleComp.probOutput_def", "content": "lemma probOutput_def (oa : OracleComp spec Ξ±) (x : Ξ±) :\n [= x | oa] = (evalDist oa).run (some x)" }, { "name": "OracleComp.probFailure_add_tsum_probOutput", "content": "@[simp]\nlemma probFailure_add_tsum_probOutput (oa : OracleComp spec Ξ±) ...
import VCVio.OracleComp.Traversal import VCVio.OracleComp.SimSemantics.SimulateQ import Mathlib.Probability.Distributions.Uniform import ToMathlib.General open OracleSpec Option ENNReal BigOperators namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {ΞΉ' : Type v} {spec' : OracleSpec ΞΉ'} {Ξ± Ξ² Ξ³ : T...
lemma probFailure_bind_eq_sub_mul {oa : OracleComp spec Ξ±} {ob : Ξ± β†’ OracleComp spec Ξ²} (r : ℝβ‰₯0∞) (h : βˆ€ x, [βŠ₯ | ob x] = r) : [βŠ₯ | oa >>= ob] = 1 - (1 - [βŠ₯ | oa]) * (1 - r) :=
:= by rw [probFailure_bind_eq_tsum] rw [← tsum_probOutput_eq_sub] rw [← ENNReal.tsum_mul_right] have hl : βˆ€ x, [=x|oa] * [βŠ₯|ob x] ≀ [=x|oa] := Ξ» x ↦ le_of_le_of_eq (mul_le_mul' le_rfl probFailure_le_one) (mul_one _) calc [βŠ₯ | oa] + βˆ‘' x, [= x | oa] * [βŠ₯ | ob x] _ = 1 - (βˆ‘' x, [= x | oa]) + (βˆ‘' x, [= x...
5
56
true
Applied verif.
451
BindEquiv.map_bind_inv
@[simp] lemma map_bind_inv (f : BindEquiv m n) {Ξ± Ξ² : Type u} (x : n Ξ±) (y : Ξ± β†’ n Ξ²) : f.invFun (x >>= y) = f.invFun x >>= (fun a => f.invFun (y a))
VCV-io
ToMathlib/Control/Monad/Equiv.lean
[ "import Mathlib.Logic.Function.Defs", "import ToMathlib.Control.Monad.Hom" ]
[ { "name": "Function.LeftInverse", "module": "Init.Data.Function" }, { "name": "Function.RightInverse", "module": "Init.Data.Function" }, { "name": "Bind", "module": "Init.Prelude" } ]
[ { "name": "NatHom", "content": "structure NatHom (m : Type u β†’ Type v) (n : Type u β†’ Type w) where\n toFun : {Ξ± : Type u} β†’ m Ξ± β†’ n Ξ±" } ]
[ { "name": "Function.LeftInverse.injective", "module": "Init.Data.Function" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "NatEquiv", "content": "structure NatEquiv (m : Type u β†’ Type v) (n : Type u β†’ Type w) where\n toFun : {Ξ± : Type u} β†’ m Ξ± β†’ n Ξ±\n invFun : {Ξ± : Type u} β†’ n Ξ± β†’ m Ξ±\n left_inv : βˆ€ {Ξ±}, Function.LeftInverse (@invFun Ξ±) (@toFun Ξ±) := by admit /- proof elided -/" }, { "name": "BindEquiv", ...
[]
import ToMathlib.Control.Monad.Hom import Mathlib.Logic.Function.Defs structure NatEquiv (m : Type u β†’ Type v) (n : Type u β†’ Type w) where toFun : {Ξ± : Type u} β†’ m Ξ± β†’ n Ξ± invFun : {Ξ± : Type u} β†’ n Ξ± β†’ m Ξ± left_inv : βˆ€ {Ξ±}, Function.LeftInverse (@invFun Ξ±) (@toFun Ξ±) := by admit /- proof elided -/ namespace Na...
@[simp] lemma map_bind_inv (f : BindEquiv m n) {Ξ± Ξ² : Type u} (x : n Ξ±) (y : Ξ± β†’ n Ξ²) : f.invFun (x >>= y) = f.invFun x >>= (fun a => f.invFun (y a)) :=
:= by -- We'll show f.toFun applied to both sides gives the same result have h1 : f.toFun (f.invFun (x >>= y)) = x >>= y := f.right_inv (x >>= y) have h2 : f.toFun (f.invFun x >>= (fun a => f.invFun (y a))) = f.toFun (f.invFun x) >>= (fun a => f.toFun (f.invFun (y a))) := f.map_bind' _ _ have h3 : f...
2
7
true
Applied verif.
452
OracleComp.mul_le_probEvent_bind
lemma mul_le_probEvent_bind {oa : OracleComp spec Ξ±} {ob : Ξ± β†’ OracleComp spec Ξ²} {p : Ξ± β†’ Prop} {q : Ξ² β†’ Prop} {r r' : ℝβ‰₯0∞} (h : r ≀ [p | oa]) (h' : βˆ€ x ∈ oa.support, p x β†’ r' ≀ [q | ob x]) : r * r' ≀ [q | oa >>= ob]
VCV-io
VCVio/OracleComp/DistSemantics/EvalDist.lean
[ "import Mathlib.Probability.Distributions.Uniform", "import VCVio.OracleComp.SimSemantics.SimulateQ", "import VCVio.OracleComp.Traversal", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Set", "module": "Mathlib.Data.Set.Defs" }, { "name": "Set.univ", "module": "Mathlib.Data.Set.Defs" ...
[ { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "support", "content": "def support (oa : OracleComp spec Ξ±) : Set Ξ± :=\n oa.supportWhen fun _ => Set.univ" }, { "name": "supportWhen", "content": "def supportWhen (oa : OracleComp s...
[ { "name": "ENNReal.summable", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas" }, { "name": "PMF.toOuterMeasure_bind_apply", "module": "Mathlib.Probability.ProbabilityMassFunction.Monad" }, { "name": "PMF.apply_ne_top", "module": "Mathlib.Probability.ProbabilityMassFunction.Basi...
[ { "name": "tsum_option", "content": "lemma tsum_option {Ξ± Ξ² : Type*} [AddCommMonoid Ξ±] [TopologicalSpace Ξ±]\n [ContinuousAdd Ξ±] [T2Space Ξ±]\n (f : Option Ξ² β†’ Ξ±) (hf : Summable (Function.update f none 0)) :\n βˆ‘' x : Option Ξ², f x = f none + βˆ‘' x : Ξ², f (some x)" } ]
[ { "name": "OracleComp.probOutput", "content": "noncomputable def probOutput (oa : OracleComp spec Ξ±) (x : Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run (some x)" } ]
[ { "name": "OracleComp.evalDist_apply_some", "content": "lemma evalDist_apply_some (oa : OracleComp spec Ξ±) (x : Ξ±) :\n (evalDist oa).run (some x) = [= x | oa]" }, { "name": "OracleComp.probEvent_def", "content": "lemma probEvent_def (oa : OracleComp spec Ξ±) (p : Ξ± β†’ Prop) :\n [p | oa] = (e...
import VCVio.OracleComp.Traversal import VCVio.OracleComp.SimSemantics.SimulateQ import Mathlib.Probability.Distributions.Uniform import ToMathlib.General open OracleSpec Option ENNReal BigOperators namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {ΞΉ' : Type v} {spec' : OracleSpec ΞΉ'} {Ξ± Ξ² Ξ³ : T...
lemma mul_le_probEvent_bind {oa : OracleComp spec Ξ±} {ob : Ξ± β†’ OracleComp spec Ξ²} {p : Ξ± β†’ Prop} {q : Ξ² β†’ Prop} {r r' : ℝβ‰₯0∞} (h : r ≀ [p | oa]) (h' : βˆ€ x ∈ oa.support, p x β†’ r' ≀ [q | ob x]) : r * r' ≀ [q | oa >>= ob] :=
:= by rw [probEvent_bind_eq_tsum] refine (mul_le_mul_right' h r').trans ?_ rw [probEvent_eq_tsum_indicator, ← ENNReal.tsum_mul_right] refine ENNReal.tsum_le_tsum fun x => ?_ rw [← Set.indicator_mul_const] by_cases hx : x ∈ oa.support Β· refine Set.indicator_apply_le' (fun h => ?_) (fun _ => zero_le') e...
5
48
true
Applied verif.
453
OracleComp.probEvent_seq_map_eq_mul
lemma probEvent_seq_map_eq_mul {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type v} (f : Ξ± β†’ Ξ² β†’ Ξ³) [spec.FiniteRange] (oa : OracleComp spec Ξ±) (ob : OracleComp spec Ξ²) (p : Ξ³ β†’ Prop) (q1 : Ξ± β†’ Prop) (q2 : Ξ² β†’ Prop) (h : βˆ€ x ∈ oa.support, βˆ€ y ∈ ob.support, p (f x y) ↔ q1 x ∧ q2 y) : [p | f <$> oa <*>...
VCV-io
VCVio/OracleComp/DistSemantics/Seq.lean
[ "import VCVio.OracleComp.DistSemantics.Monad", "import VCVio.OracleComp.DistSemantics.EvalDist", "import VCVio.OracleComp.Support", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Set", "module": "Mathlib.Data.Set.Defs" }, { "name": "Set.univ", "module": "Mathlib.Data.Set.Defs" ...
[ { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "uniformFin", "content": "notation \"$[0..\" n \"]\" => uniformFin n" }, { "name": "notation:50 \"$[\" n \"β‹―\" m \"]\" => uniformFin' n m", "content": "notation:50 \"$[\" n \"β‹―\" m \...
[ { "name": "ENNReal.tsum_mul_left", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas" }, { "name": "map_eq_bind_pure_comp", "module": "Mathlib.Control.Monad.Basic" }, { "name": "mul_assoc", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "seq_eq_bind", "module": "I...
[ { "name": "probOutput_bind_eq_tsum", "content": "lemma probOutput_bind_eq_tsum (y : Ξ²) :\n [= y | oa >>= ob] = βˆ‘' x : Ξ±, [= x | oa] * [= y | ob x]" }, { "name": "probEvent_pure", "content": "@[simp]\nlemma probEvent_pure (p : Ξ± β†’ Prop) [DecidablePred p] :\n [p | (pure x : OracleComp spec Ξ±...
[]
[ { "name": "OracleComp.support_seq", "content": "@[simp low]\nlemma support_seq : (og <*> oa).support = ⋃ g ∈ og.support, g '' oa.support" }, { "name": "OracleComp.support_seq_map_eq_image2", "content": "@[simp low + 1]\nlemma support_seq_map_eq_image2 :\n (f <$> oa <*> ob).support = Set.image...
import VCVio.OracleComp.DistSemantics.Monad namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type v} variable (oa : OracleComp spec Ξ±) (og : OracleComp spec (Ξ± β†’ Ξ²)) section seq_map variable (oa : OracleComp spec Ξ±) (ob : OracleComp spec Ξ²) (f : Ξ± β†’ Ξ² β†’ Ξ³) section swap end swap section ...
lemma probEvent_seq_map_eq_mul {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type v} (f : Ξ± β†’ Ξ² β†’ Ξ³) [spec.FiniteRange] (oa : OracleComp spec Ξ±) (ob : OracleComp spec Ξ²) (p : Ξ³ β†’ Prop) (q1 : Ξ± β†’ Prop) (q2 : Ξ² β†’ Prop) (h : βˆ€ x ∈ oa.support, βˆ€ y ∈ ob.support, p (f x y) ↔ q1 x ∧ q2 y) : [p | f <$> oa <*>...
:= by have : DecidablePred q1 := Classical.decPred q1 have : DecidablePred q2 := Classical.decPred q2 rw [probEvent_seq_map_eq_probEvent] calc [Ξ» z : Ξ± Γ— Ξ² ↦ p (f z.1 z.2) | Prod.mk <$> oa <*> ob] = [Ξ» z ↦ q1 z.1 ∧ q2 z.2 | Prod.mk <$> oa <*> ob] := probEvent_ext <| by simpa using Ξ» x y hx hy ↦ h ...
8
96
true
Applied verif.
454
PMF.probOutput_eq
@[simp] lemma probOutput_eq : probOutput p = p
VCV-io
VCVio/EvalDist/Basic.lean
[ "import ToMathlib.General", "import Mathlib.Probability.ProbabilityMassFunction.Monad" ]
[ { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "PMF", "module": "Mathlib.Probability.ProbabilityMassFunction.Basic" }, { "name": "Monad", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "liftM", "module"...
[ { "name": "probEvent", "content": "notation \"Pr[\" p \"|\" mx \"]\" => probEvent mx p" }, { "name": "probOutput", "content": "notation \"Pr[=\" x \"|\" mx \"]\" => probOutput mx x" }, { "name": "macro_rules (kind := probEventBinding1)", "content": "macro_rules (kind := probEventBind...
[ { "name": "OptionT.run_mk", "module": "Init.Control.Lawful.Instances" }, { "name": "PMF.map_apply", "module": "Mathlib.Probability.ProbabilityMassFunction.Constructions" }, { "name": "PMF.pure_apply", "module": "Mathlib.Probability.ProbabilityMassFunction.Monad" }, { "name": ...
[ { "name": "PMF.monad_pure_eq_pure", "content": "@[simp]\nlemma PMF.monad_pure_eq_pure {Ξ± : Type u} (x : Ξ±) :\n (Pure.pure x : PMF Ξ±) = PMF.pure x" }, { "name": "PMF.monad_bind_eq_bind", "content": "@[simp]\nlemma PMF.monad_bind_eq_bind {Ξ± Ξ² : Type u}\n (p : PMF Ξ±) (q : Ξ± β†’ PMF Ξ²) : p >>=...
[ { "name": "SPMF", "content": "@[reducible] def SPMF : Type u β†’ Type u := OptionT PMF" }, { "name": "HasEvalDist", "content": "class HasEvalDist (m : Type u β†’ Type v) [Monad m] where\n evalDist {Ξ± : Type u} (mx : m Ξ±) : SPMF Ξ±\n evalDist_pure {Ξ± : Type u} (x : Ξ±) : evalDist (pure x : m Ξ±) = pur...
[ { "name": "probOutput_def", "content": "lemma probOutput_def (mx : m Ξ±) (x : Ξ±) : Pr[= x | mx] = (evalDist mx).run (some x)" }, { "name": "PMF.evalDist_eq", "content": "@[simp] lemma evalDist_eq : evalDist p = liftM p" } ]
import Mathlib.Probability.ProbabilityMassFunction.Monad import ToMathlib.General open ENNReal variable {Ξ± Ξ² Ξ³ : Type u} {m : Type u β†’ Type v} [Monad m] @[reducible] def SPMF : Type u β†’ Type u := OptionT PMF namespace SPMF end SPMF class HasEvalDist (m : Type u β†’ Type v) [Monad m] where evalDist {Ξ± : Type u} (...
@[simp] lemma probOutput_eq : probOutput p = p :=
:= by refine funext fun x => ?_ simp only [probOutput_def, evalDist_eq, monad_pure_eq_pure, monad_bind_eq_bind, OptionT.run_mk, pure_apply, Option.some.injEq, mul_ite, mul_one, mul_zero] simp refine (PMF.map_apply _ _ _).trans ?_ refine (tsum_eq_single x ?_).trans ?_ Β· simp refine fun x h h' => ?_ ...
2
20
true
Applied verif.
455
OracleComp.probEvent_congr'
lemma probEvent_congr' {p q : Ξ± β†’ Prop} {oa : OracleComp spec Ξ±} {oa' : OracleComp spec' Ξ±} (h1 : βˆ€ x, x ∈ oa.support β†’ x ∈ oa'.support β†’ (p x ↔ q x)) (h2 : evalDist oa = evalDist oa') : [p | oa] = [q | oa']
VCV-io
VCVio/OracleComp/DistSemantics/EvalDist.lean
[ "import Mathlib.Probability.Distributions.Uniform", "import VCVio.OracleComp.SimSemantics.SimulateQ", "import VCVio.OracleComp.Traversal", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Set", "module": "Mathlib.Data.Set.Defs" }, { "name": "Set.univ", "module": "Mathlib.Data.Set.Defs" ...
[ { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "HasEvalDist", "content": "class HasEvalDist (m : Type u β†’ Type v) [Monad m] where\n evalDist {Ξ± : Type u} (mx : m Ξ±) : SPMF Ξ±\n evalDist_pure {Ξ± : Type u} (x : Ξ±) : evalDist (pure x : m Ξ±) = ...
[ { "name": "PMF.apply_eq_zero_iff", "module": "Mathlib.Probability.ProbabilityMassFunction.Basic" }, { "name": "ne_eq", "module": "Init.SimpLemmas" }, { "name": "ENNReal.summable", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas" }, { "name": "Option.some_injective", ...
[ { "name": "tsum_option", "content": "lemma tsum_option {Ξ± Ξ² : Type*} [AddCommMonoid Ξ±] [TopologicalSpace Ξ±]\n [ContinuousAdd Ξ±] [T2Space Ξ±]\n (f : Option Ξ² β†’ Ξ±) (hf : Summable (Function.update f none 0)) :\n βˆ‘' x : Option Ξ², f x = f none + βˆ‘' x : Ξ², f (some x)" } ]
[ { "name": "OracleComp.probOutput", "content": "noncomputable def probOutput (oa : OracleComp spec Ξ±) (x : Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run (some x)" } ]
[ { "name": "OracleComp.probOutput_def", "content": "lemma probOutput_def (oa : OracleComp spec Ξ±) (x : Ξ±) :\n [= x | oa] = (evalDist oa).run (some x)" }, { "name": "OracleComp.probEvent_def", "content": "lemma probEvent_def (oa : OracleComp spec Ξ±) (p : Ξ± β†’ Prop) :\n [p | oa] = (evalDist oa...
import VCVio.OracleComp.Traversal import VCVio.OracleComp.SimSemantics.SimulateQ import Mathlib.Probability.Distributions.Uniform import ToMathlib.General open OracleSpec Option ENNReal BigOperators namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {ΞΉ' : Type v} {spec' : OracleSpec ΞΉ'} {Ξ± Ξ² Ξ³ : T...
lemma probEvent_congr' {p q : Ξ± β†’ Prop} {oa : OracleComp spec Ξ±} {oa' : OracleComp spec' Ξ±} (h1 : βˆ€ x, x ∈ oa.support β†’ x ∈ oa'.support β†’ (p x ↔ q x)) (h2 : evalDist oa = evalDist oa') : [p | oa] = [q | oa'] :=
:= by have h : βˆ€ x, x ∈ oa.support ↔ x ∈ oa'.support := mem_support_iff_of_evalDist_eq h2 have h' : βˆ€ x, [= x | oa] = [= x | oa'] := Ξ» x ↦ probOutput_congr rfl h2 rw [probEvent_eq_tsum_indicator, probEvent_eq_tsum_indicator] refine tsum_congr Ξ» x ↦ ?_ simp [Set.indicator, h'] by_cases hp : p x Β· by_cases ...
5
48
true
Applied verif.
456
PureEquiv.map_pure_inv
@[simp] lemma map_pure_inv (f : PureEquiv m n) {Ξ± : Type u} (x : Ξ±) : f.invFun (pure x) = (pure x : m Ξ±)
VCV-io
ToMathlib/Control/Monad/Equiv.lean
[ "import Mathlib.Logic.Function.Defs", "import ToMathlib.Control.Monad.Hom" ]
[ { "name": "Function.LeftInverse", "module": "Init.Data.Function" }, { "name": "Function.RightInverse", "module": "Init.Data.Function" }, { "name": "Pure", "module": "Init.Prelude" } ]
[ { "name": "NatHom", "content": "structure NatHom (m : Type u β†’ Type v) (n : Type u β†’ Type w) where\n toFun : {Ξ± : Type u} β†’ m Ξ± β†’ n Ξ±" } ]
[ { "name": "Function.LeftInverse.injective", "module": "Init.Data.Function" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "NatEquiv", "content": "structure NatEquiv (m : Type u β†’ Type v) (n : Type u β†’ Type w) where\n toFun : {Ξ± : Type u} β†’ m Ξ± β†’ n Ξ±\n invFun : {Ξ± : Type u} β†’ n Ξ± β†’ m Ξ±\n left_inv : βˆ€ {Ξ±}, Function.LeftInverse (@invFun Ξ±) (@toFun Ξ±) := by admit /- proof elided -/" }, { "name": "PureEquiv", ...
[]
import ToMathlib.Control.Monad.Hom import Mathlib.Logic.Function.Defs structure NatEquiv (m : Type u β†’ Type v) (n : Type u β†’ Type w) where toFun : {Ξ± : Type u} β†’ m Ξ± β†’ n Ξ± invFun : {Ξ± : Type u} β†’ n Ξ± β†’ m Ξ± left_inv : βˆ€ {Ξ±}, Function.LeftInverse (@invFun Ξ±) (@toFun Ξ±) := by admit /- proof elided -/ namespace Na...
@[simp] lemma map_pure_inv (f : PureEquiv m n) {Ξ± : Type u} (x : Ξ±) : f.invFun (pure x) = (pure x : m Ξ±) :=
:= by have h1 : f.toFun (f.invFun (pure x)) = pure x := f.right_inv (pure x) have h2 : f.toFun (pure x) = pure x := f.map_pure' x have h3 : f.toFun (f.invFun (pure x)) = f.toFun (pure x) := by rw [h1, h2] exact Function.LeftInverse.injective f.left_inv h3
1
7
true
Applied verif.
457
OracleComp.isQueryBound_iff_probEvent
lemma isQueryBound_iff_probEvent [spec.FiniteRange] {oa : OracleComp spec Ξ±} {qb : ΞΉ β†’ β„•} : IsQueryBound oa qb ↔ [(Β· ≀ qb) | snd <$> (simulateQ countingOracle oa).run <|> return 0] = 1
VCV-io
VCVio/OracleComp/QueryBound.lean
[ "import VCVio.OracleComp.DistSemantics.Alternative", "import VCVio.OracleComp.DistSemantics.EvalDist", "import VCVio.OracleComp.QueryTracking.CountingOracle" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "impl", "module": "Mathlib.Deprecated.MLList.BestFirst" }, { "name": "Bind", "module": "Init.Prelude" }, { "name": "Pure", "module": "Init.Prelude" }, { "name": "OptionT", "module": "Init.Control.Option" ...
[ { "name": "probFailure", "content": "notation \"[βŠ₯\" \"|\" oa \"]\" => probFailure oa" }, { "name": "simulateQ", "content": "def simulateQ [AlternativeMonad m] (so : QueryImpl spec m) (oa : OracleComp spec Ξ±) : m Ξ± :=\n do Option.getM (← FreeMonad.mapM oa.run so.impl)" }, { "name": "Que...
[ { "name": "Set.mem_image", "module": "Mathlib.Data.Set.Operations" }, { "name": "Set.mem_insert_iff", "module": "Mathlib.Data.Set.Insert" }, { "name": "exists_eq_right", "module": "Init.PropLemmas" }, { "name": "forall_eq_or_imp", "module": "Init.PropLemmas" }, { ...
[ { "name": "probEvent_eq_one_iff", "content": "@[simp low]\nlemma probEvent_eq_one_iff : [p | oa] = 1 ↔ [βŠ₯ | oa] = 0 ∧ βˆ€ x ∈ oa.support, p x" }, { "name": "support_evalDist", "content": "lemma support_evalDist : (evalDist oa).run.support = if [βŠ₯ | oa] = 0 then\n some '' oa.support else insert ...
[ { "name": "OracleComp.IsQueryBound", "content": "def IsQueryBound (oa : OracleComp spec Ξ±) (qb : ΞΉ β†’ β„•) : Prop :=\n βˆ€ qc ∈ (snd <$> (simulateQ countingOracle oa).run).support, qc ≀ qb" } ]
[ { "name": "OracleComp.isQueryBound_def", "content": "lemma isQueryBound_def (oa : OracleComp spec Ξ±) (qb : QueryCount spec) :\n IsQueryBound oa qb ↔ βˆ€ qc ∈ (snd <$> (simulateQ countingOracle oa).run).support, qc ≀ qb" } ]
import VCVio.OracleComp.QueryTracking.CountingOracle import VCVio.OracleComp.DistSemantics.Alternative open OracleSpec Prod namespace OracleComp section IsQueryBound variable {ΞΉ : Type u} [DecidableEq ΞΉ] {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type u} def IsQueryBound (oa : OracleComp spec Ξ±) (qb : ΞΉ β†’ β„•) : Prop := βˆ€ ...
lemma isQueryBound_iff_probEvent [spec.FiniteRange] {oa : OracleComp spec Ξ±} {qb : ΞΉ β†’ β„•} : IsQueryBound oa qb ↔ [(Β· ≀ qb) | snd <$> (simulateQ countingOracle oa).run <|> return 0] = 1 :=
:= by simp [probEvent_eq_one_iff, isQueryBound_def] apply Iff.intro · intro a x a_1 split at a_1 next h => simp_all only [Set.mem_image, Prod.exists, exists_eq_right] obtain ⟨w, h_1⟩ := a_1 apply a · exact h_1 next h => simp_all only [Set.mem_insert_iff, Set.mem_image, Pr...
6
49
true
Applied verif.
458
OracleComp.probEvent_uniformFin
@[simp] lemma probEvent_uniformFin (p : Fin (n + 1) β†’ Prop) [DecidablePred p] : [p | $[0..n]] = (Finset.univ.filter p).card * (n + 1 : ℝβ‰₯0∞)⁻¹
VCV-io
VCVio/OracleComp/DistSemantics/EvalDist.lean
[ "import Mathlib.Probability.Distributions.Uniform", "import VCVio.OracleComp.SimSemantics.SimulateQ", "import VCVio.OracleComp.Traversal", "import ToMathlib.General", "import VCVio.OracleComp.Support" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "DecidablePred", "module": "Init.Prelude" }, { "na...
[ { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "uniformFin", "content": "notation \"$[0..\" n \"]\" => uniformFin n" }, { "name": "notation:50 \"$[\" n \"β‹―\" m \"]\" => uniformFin' n m", "content": "notation:50 \"$[\" n \"β‹―\" m \...
[ { "name": "Nat.cast_inj", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "PMF.monad_map_eq_map", "module": "Mathlib.Probability.ProbabilityMassFunction.Constructions" }, { "name": "inv_inj", "module": "Mathlib.Algebra.Group.Basic" }, { "name": "not_imp_not", "modu...
[ { "name": "tsum_option", "content": "lemma tsum_option {Ξ± Ξ² : Type*} [AddCommMonoid Ξ±] [TopologicalSpace Ξ±]\n [ContinuousAdd Ξ±] [T2Space Ξ±]\n (f : Option Ξ² β†’ Ξ±) (hf : Summable (Function.update f none 0)) :\n βˆ‘' x : Option Ξ², f x = f none + βˆ‘' x : Ξ², f (some x)" }, { "name": "finSupport_unif...
[ { "name": "OracleComp.probOutput", "content": "noncomputable def probOutput (oa : OracleComp spec Ξ±) (x : Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run (some x)" }, { "name": "OracleComp.probFailure", "content": "noncomputable def probFailure (oa : OracleComp spec Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run none" }...
[ { "name": "OracleComp.probOutput_def", "content": "lemma probOutput_def (oa : OracleComp spec Ξ±) (x : Ξ±) :\n [= x | oa] = (evalDist oa).run (some x)" }, { "name": "OracleComp.probEvent_def", "content": "lemma probEvent_def (oa : OracleComp spec Ξ±) (p : Ξ± β†’ Prop) :\n [p | oa] = (evalDist oa...
import VCVio.OracleComp.Traversal import VCVio.OracleComp.SimSemantics.SimulateQ import Mathlib.Probability.Distributions.Uniform import ToMathlib.General open OracleSpec Option ENNReal BigOperators namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {ΞΉ' : Type v} {spec' : OracleSpec ΞΉ'} {Ξ± Ξ² Ξ³ : T...
@[simp] lemma probEvent_uniformFin (p : Fin (n + 1) β†’ Prop) [DecidablePred p] : [p | $[0..n]] = (Finset.univ.filter p).card * (n + 1 : ℝβ‰₯0∞)⁻¹ :=
:= by simp only [probEvent_eq_sum_filter_finSupport, finSupport_uniformFin, probOutput_uniformFin, Finset.sum_const, nsmul_eq_mul]
6
77
true
Applied verif.
459
OracleComp.probFailure_bind_of_const
lemma probFailure_bind_of_const [Nonempty Ξ±] (r : ℝβ‰₯0∞) (h : βˆ€ x, [βŠ₯ | ob x] = r) : [βŠ₯ | oa >>= ob] = [βŠ₯ | oa] + r - [βŠ₯ | oa] * r
VCV-io
VCVio/OracleComp/DistSemantics/EvalDist.lean
[ "import Mathlib.Probability.Distributions.Uniform", "import VCVio.OracleComp.SimSemantics.SimulateQ", "import VCVio.OracleComp.Traversal", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Nonempty", "module": "Init.Prelude" }, { "name": "AddLECancellable", "module": "Mathlib.Algebra.Order.Monoid.Unbundled.Basic" }, { "name": "Classical.ar...
[ { "name": "probFailure", "content": "notation \"[βŠ₯\" \"|\" oa \"]\" => probFailure oa" }, { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "HasEvalDist", "content": "class HasEvalDist (m : Type u β†’ Type v) [Monad m] where\n evalDi...
[ { "name": "PMF.coe_le_one", "module": "Mathlib.Probability.ProbabilityMassFunction.Basic" }, { "name": "ENNReal.summable", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas" }, { "name": "symm", "module": "Mathlib.Order.Defs.Unbundled" }, { "name": "add_comm", "module"...
[ { "name": "tsum_option", "content": "lemma tsum_option {Ξ± Ξ² : Type*} [AddCommMonoid Ξ±] [TopologicalSpace Ξ±]\n [ContinuousAdd Ξ±] [T2Space Ξ±]\n (f : Option Ξ² β†’ Ξ±) (hf : Summable (Function.update f none 0)) :\n βˆ‘' x : Option Ξ², f x = f none + βˆ‘' x : Ξ², f (some x)" } ]
[ { "name": "OracleComp.probOutput", "content": "noncomputable def probOutput (oa : OracleComp spec Ξ±) (x : Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run (some x)" }, { "name": "OracleComp.probFailure", "content": "noncomputable def probFailure (oa : OracleComp spec Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run none" }...
[ { "name": "OracleComp.probOutput_def", "content": "lemma probOutput_def (oa : OracleComp spec Ξ±) (x : Ξ±) :\n [= x | oa] = (evalDist oa).run (some x)" }, { "name": "OracleComp.probFailure_add_tsum_probOutput", "content": "@[simp]\nlemma probFailure_add_tsum_probOutput (oa : OracleComp spec Ξ±) ...
import VCVio.OracleComp.Traversal import VCVio.OracleComp.SimSemantics.SimulateQ import Mathlib.Probability.Distributions.Uniform import ToMathlib.General open OracleSpec Option ENNReal BigOperators namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {ΞΉ' : Type v} {spec' : OracleSpec ΞΉ'} {Ξ± Ξ² Ξ³ : T...
lemma probFailure_bind_of_const [Nonempty Ξ±] (r : ℝβ‰₯0∞) (h : βˆ€ x, [βŠ₯ | ob x] = r) : [βŠ₯ | oa >>= ob] = [βŠ₯ | oa] + r - [βŠ₯ | oa] * r :=
:= by have : r β‰  ⊀ := Ξ» hr ↦ probFailure_ne_top ((h (Classical.arbitrary Ξ±)).trans hr) simp [probFailure_bind_eq_tsum, h, ENNReal.tsum_mul_right, tsum_probOutput_eq_sub] rw [ENNReal.sub_mul Ξ» _ _ ↦ this, one_mul] refine symm (AddLECancellable.add_tsub_assoc_of_le ?_ ?_ _) Β· refine ENNReal.addLECancellable_iff...
5
48
true
Applied verif.
460
OracleComp.probEvent_seq_map_eq_probEvent_comp_uncurry
lemma probEvent_seq_map_eq_probEvent_comp_uncurry [spec.FiniteRange] (p : Ξ³ β†’ Prop) : [p | f <$> oa <*> ob] = [p ∘ f.uncurry | Prod.mk <$> oa <*> ob]
VCV-io
VCVio/OracleComp/DistSemantics/Seq.lean
[ "import VCVio.OracleComp.DistSemantics.Monad", "import VCVio.OracleComp.DistSemantics.EvalDist", "import VCVio.OracleComp.Support" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "Prod", "module": "Init.Prelude" }, { "name": "Prod.mk", "module": "Init.Prelude" }, { ...
[ { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "HasEvalDist", "content": "class HasEvalDist (m : Type u β†’ Type v) [Monad m] where\n evalDist {Ξ± : Type u} (mx : m Ξ±) : SPMF Ξ±\n evalDist_pure {Ξ± : Type u} (x : Ξ±) : evalDist (pure x : m Ξ±) = ...
[ { "name": "seq_eq_bind_map", "module": "Init.Control.Lawful.Basic" }, { "name": "Set.biUnion_and'", "module": "Mathlib.Data.Set.Lattice" }, { "name": "Set.ext_iff", "module": "Mathlib.Data.Set.Defs" }, { "name": "Set.iUnion_exists", "module": "Mathlib.Data.Set.Lattice" ...
[ { "name": "support_map", "content": "@[simp] lemma support_map (oa : OracleComp spec Ξ±) (f : Ξ± β†’ Ξ²) :\n (f <$> oa).support = f '' oa.support" }, { "name": "support_bind", "content": "@[simp] lemma support_bind (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) :\n (oa >>= ob).support = ...
[]
[ { "name": "OracleComp.support_seq", "content": "@[simp low]\nlemma support_seq : (og <*> oa).support = ⋃ g ∈ og.support, g '' oa.support" }, { "name": "OracleComp.support_seq_map_eq_image2", "content": "@[simp low + 1]\nlemma support_seq_map_eq_image2 :\n (f <$> oa <*> ob).support = Set.image...
import VCVio.OracleComp.DistSemantics.Monad namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type v} variable (oa : OracleComp spec Ξ±) (og : OracleComp spec (Ξ± β†’ Ξ²)) section seq_map variable (oa : OracleComp spec Ξ±) (ob : OracleComp spec Ξ²) (f : Ξ± β†’ Ξ² β†’ Ξ³)
lemma probEvent_seq_map_eq_probEvent_comp_uncurry [spec.FiniteRange] (p : Ξ³ β†’ Prop) : [p | f <$> oa <*> ob] = [p ∘ f.uncurry | Prod.mk <$> oa <*> ob] :=
:= by rw [probEvent_comp] refine probEvent_congr' ?_ (congr_arg evalDist ?_) Β· simp only [support_seq_map_eq_image2, Set.mem_image2, support_map, Set.image2_mk_eq_prod, Set.image_uncurry_prod, implies_true] Β· simp only [map_seq, Function.comp, Functor.map_map, Function.uncurry_apply_pair] rfl
6
60
true
Applied verif.
461
OracleComp.liftM_inj
@[simp] lemma liftM_inj (q q' : OracleQuery spec Ξ±) : (q : OracleComp spec Ξ±) = q' ↔ q = q'
VCV-io
VCVio/OracleComp/OracleComp.lean
[ "import ToMathlib.Control.AlternativeMonad", "import ToMathlib.Control.Monad.Free", "import VCVio.OracleComp.OracleSpec", "import ToMathlib.Control.WriterT", "import Mathlib.Control.Lawful", "import ToMathlib.Control.OptionT" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "OptionT.lift", "module": "Init.Control.Option" }, { "name": "OptionT.mk", "module": "Init.Control.Option" } ]
[ { "name": "domain", "content": "@[inline, reducible]\nprotected def domain (spec : OracleSpec ΞΉ) (i : ΞΉ) : Type v := (spec i).1" }, { "name": "OracleSpec", "content": "def OracleSpec (ΞΉ : Type u) : Type (max u (v + 1)) :=\n (i : ΞΉ) β†’ Type v Γ— Type v" }, { "name": "range", "content":...
[ { "name": "and_true", "module": "Init.SimpLemmas" }, { "name": "heq_eq_eq", "module": "Init.SimpLemmas" }, { "name": "true_and", "module": "Init.SimpLemmas" } ]
[ { "name": "monad_bind_def", "content": "@[simp]\nlemma monad_bind_def (x : FreeMonad f Ξ±) (g : Ξ± β†’ FreeMonad f Ξ²) :\n x >>= g = FreeMonad.bind x g" }, { "name": "bind_lift", "content": "@[simp]\nlemma bind_lift (x : f Ξ±) (r : Ξ± β†’ FreeMonad f Ξ²) :\n FreeMonad.bind (FreeMonad.lift x) r = Fre...
[ { "name": "OracleSpec.OracleQuery", "content": "inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max u v)\n | query (i : ΞΉ) (t : spec.domain i) : OracleQuery spec (spec.range i)" }, { "name": "OracleComp", "content": "def OracleComp {ΞΉ : Type u} (spec : OracleSpec...
[ { "name": "OracleComp.liftM_def", "content": "protected lemma liftM_def (q : OracleQuery spec Ξ±) :\n (q : OracleComp spec Ξ±) = OptionT.lift (FreeMonad.lift q)" } ]
import ToMathlib.Control.Monad.Free import ToMathlib.Control.WriterT import ToMathlib.Control.AlternativeMonad import ToMathlib.Control.OptionT import Mathlib.Control.Lawful import VCVio.OracleComp.OracleSpec namespace OracleSpec inductive OracleQuery {ΞΉ : Type u} (spec : OracleSpec.{u,v} ΞΉ) : Type v β†’ Type (max...
@[simp] lemma liftM_inj (q q' : OracleQuery spec Ξ±) : (q : OracleComp spec Ξ±) = q' ↔ q = q' :=
:= by simp only [OracleComp.liftM_def, OptionT.lift, OptionT.mk, FreeMonad.monad_pure_def, FreeMonad.monad_bind_def, FreeMonad.bind_lift] rw [FreeMonad.roll.injEq] simp only [heq_eq_eq, and_true, true_and]
3
19
false
Applied verif.
462
PFunctor.Lens.prodPair_fst_snd
@[simp] theorem prodPair_fst_snd : Lens.prodPair Lens.fst Lens.snd = Lens.id.{max uA₁ uAβ‚‚, max uB₁ uBβ‚‚} (P * Q)
VCV-io
ToMathlib/PFunctor/Lens/Basic.lean
[ "import ToMathlib.PFunctor.Basic" ]
[ { "name": "PFunctor", "module": "Mathlib.Data.PFunctor.Univariate.Basic" }, { "name": "Sum", "module": "Init.Core" }, { "name": "Sum.elim", "module": "Init.Data.Sum.Basic" }, { "name": "Prod", "module": "Init.Prelude" }, { "name": "Prod.snd", "module": "Init.P...
[ { "name": "prodPair", "content": "notation \"⟨\" l₁ \",\" lβ‚‚ \"βŸ©β‚—\" => prodPair l₁ lβ‚‚" }, { "name": "Lens", "content": "structure Lens (P : PFunctor.{uA₁, uB₁}) (Q : PFunctor.{uAβ‚‚, uBβ‚‚}) where\n toFunA : P.A β†’ Q.A\n toFunB : βˆ€ a, Q.B (toFunA a) β†’ P.B a" }, { "name": "Chart", "conte...
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "PFunctor.Lens.prodPair", "content": "def prodPair {P : PFunctor.{uA₁, uB₁}} {Q : PFunctor.{uAβ‚‚, uBβ‚‚}} {R : PFunctor.{uA₃, uB₃}}\n (l₁ : Lens P Q) (lβ‚‚ : Lens P R) :\n Lens.{uA₁, uB₁, max uAβ‚‚ uA₃, max uBβ‚‚ uB₃} P (Q * R) :=\n (fun p => (l₁.toFunA p, lβ‚‚.toFunA p)) ⇆\n (fun p => Sum.elim (l₁...
[ { "name": "PFunctor.Lens.ext", "content": "@[ext (iff := false)]\ntheorem ext {P : PFunctor.{uA₁, uB₁}} {Q : PFunctor.{uAβ‚‚, uBβ‚‚}} (l₁ lβ‚‚ : Lens P Q)\n (h₁ : βˆ€ a, l₁.toFunA a = lβ‚‚.toFunA a) (hβ‚‚ : βˆ€ a, l₁.toFunB a = (h₁ a) β–Έ lβ‚‚.toFunB a) :\n l₁ = lβ‚‚" } ]
import ToMathlib.PFunctor.Basic section find_home variable {Ξ± : Sort u} {Ξ² : Ξ± β†’ Sort v} {Ξ³ : Ξ± β†’ Sort v} end find_home namespace PFunctor namespace Lens @[inherit_doc] infixl:75 " βˆ˜β‚— " => comp @[inherit_doc] infix:50 " ≃ₗ " => Equiv namespace Equiv end Equiv def prodPair {P : PFunctor.{uA₁, uB₁}} {Q : PFunct...
@[simp] theorem prodPair_fst_snd : Lens.prodPair Lens.fst Lens.snd = Lens.id.{max uA₁ uAβ‚‚, max uB₁ uBβ‚‚} (P * Q) :=
:= by ext a x Β· rfl Β· cases x <;> rfl
2
15
true
Applied verif.
463
OracleSpec.QuerySeed.eq_takeAtIndex_length_iff
lemma eq_takeAtIndex_length_iff (seed seed' : QuerySeed spec) (i : ΞΉ) : seed = seed'.takeAtIndex i (seed i).length ↔ seed' = seed.addValues ((seed' i).drop (seed i).length)
VCV-io
VCVio/OracleComp/QueryTracking/Structures.lean
[ "import VCVio.OracleComp.SimSemantics.SimulateQ" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Function.update", "module": "Mathlib.Logic.Function.Basic" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prel...
[ { "name": "OracleSpec", "content": "def OracleSpec (ΞΉ : Type u) : Type (max u (v + 1)) :=\n (i : ΞΉ) β†’ Type v Γ— Type v" }, { "name": "range", "content": "@[inline, reducible]\nprotected def range (spec : OracleSpec ΞΉ) (i : ΞΉ) : Type w := (spec i).2" }, { "name": "DecidableEq", "conte...
[ { "name": "congr_arg", "module": "Batteries.Logic" }, { "name": "congr_fun", "module": "Batteries.Logic" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "OracleSpec.QuerySeed", "content": "def QuerySeed (spec : OracleSpec ΞΉ) : Type _ :=\n (i : ΞΉ) β†’ List (spec.range i)" } ]
[]
import VCVio.OracleComp.SimSemantics.SimulateQ open OracleSpec OracleComp namespace OracleSpec variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} namespace QueryCache variable [spec.DecidableEq] [DecidableEq ΞΉ] (cache : QueryCache spec) end QueryCache namespace QueryCount end QueryCount namespace QueryLog section ge...
lemma eq_takeAtIndex_length_iff (seed seed' : QuerySeed spec) (i : ΞΉ) : seed = seed'.takeAtIndex i (seed i).length ↔ seed' = seed.addValues ((seed' i).drop (seed i).length) :=
:= by refine ⟨λ h ↦ QuerySeed.ext _ _ (Ξ» j ↦ ?_), Ξ» h ↦ ?_⟩ Β· by_cases hj : j = i Β· induction hj rw [h] suffices (seed j).length ≀ (seed' j).length by simp [this] simpa using congr_arg List.length (congr_fun h j) Β· rw [h] simp [hj] Β· rw [h] simp
4
21
false
Applied verif.
464
OracleComp.allWhen_bind_iff
@[simp] lemma allWhen_bind_iff (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) : (oa >>= ob).allWhen Q F possible_outputs ↔ oa.allWhen Q F possible_outputs ∧ βˆ€ x ∈ oa.supportWhen possible_outputs, (ob x).allWhen Q F possible_outputs
VCV-io
VCVio/OracleComp/Traversal.lean
[ "import VCVio.OracleComp.Support" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Set", "module": "Mathlib.Data.Set.Defs" }, { "name": "Or", "module": "Init.Prelude" } ]
[ { "name": "induction", "content": "@[elab_as_elim]\nprotected def induction {C : OracleComp spec Ξ± β†’ Prop}\n (oa : OracleComp spec Ξ±) (pure : (a : Ξ±) β†’ C (pure a))\n (query_bind : (i : ΞΉ) β†’ (t : spec.domain i) β†’\n (oa : spec.range i β†’ OracleComp spec Ξ±) β†’ (βˆ€ u, C (oa u)) β†’ C (query i t >>= oa))\n...
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "OracleComp.allWhen", "content": "def allWhen (possible_outputs : {Ξ± : Type v} β†’ OracleQuery spec Ξ± β†’ Set Ξ±)\n (oa : OracleComp spec Ξ±) : Prop :=" } ]
[ { "name": "OracleComp.allWhen_query_bind", "content": "@[simp] lemma allWhen_query_bind (q : OracleQuery spec Ξ±) (oa : Ξ± β†’ OracleComp spec Ξ²) :\n ((q : OracleComp spec Ξ±) >>= oa).allWhen Q F possible_outputs ↔\n Q q ∧ βˆ€ x ∈ possible_outputs q, (oa x).allWhen Q F possible_outputs" } ]
import VCVio.OracleComp.Support open OracleSpec namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type v} section When variable (Q : {Ξ± : Type v} β†’ OracleQuery spec Ξ± β†’ Prop) (F : Prop) (oa : OracleComp spec Ξ±) (possible_outputs : {Ξ± : Type v} β†’ OracleQuery spec Ξ± β†’ Set Ξ±) def allW...
@[simp] lemma allWhen_bind_iff (oa : OracleComp spec Ξ±) (ob : Ξ± β†’ OracleComp spec Ξ²) : (oa >>= ob).allWhen Q F possible_outputs ↔ oa.allWhen Q F possible_outputs ∧ βˆ€ x ∈ oa.supportWhen possible_outputs, (ob x).allWhen Q F possible_outputs :=
:= by induction oa using OracleComp.inductionOn with | pure x => { simp [supportWhen] } | failure => { simp [supportWhen] } | query_bind i t oa h => { rw [bind_assoc, allWhen_query_bind] simp [h, supportWhen] grind only [cases Or] }
4
19
false
Applied verif.
465
OracleComp.probFailure_liftM
@[simp] lemma probFailure_liftM (q : OracleQuery spec Ξ±) : [βŠ₯ | (q : OracleComp spec _)] = 0
VCV-io
VCVio/OracleComp/DistSemantics/EvalDist.lean
[ "import Mathlib.Probability.Distributions.Uniform", "import VCVio.OracleComp.SimSemantics.SimulateQ", "import VCVio.OracleComp.Traversal", "import ToMathlib.General" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "ENNReal", "module": "Mathlib.Data.ENNReal.Basic" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "Inhabited", "module": "...
[ { "name": "probFailure", "content": "notation \"[βŠ₯\" \"|\" oa \"]\" => probFailure oa" }, { "name": "HasEvalDist", "content": "class HasEvalDist (m : Type u β†’ Type v) [Monad m] where\n evalDist {Ξ± : Type u} (mx : m Ξ±) : SPMF Ξ±\n evalDist_pure {Ξ± : Type u} (x : Ξ±) : evalDist (pure x : m Ξ±) = pu...
[ { "name": "Nat.cast_inj", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "PMF.uniformOfFintype_apply", "module": "Mathlib.Probability.Distributions.Uniform" }, { "name": "congr_arg", "module": "Batteries.Logic" }, { "name": "inv_inj", "module": "Mathlib.Algebra.Gr...
[ { "name": "simulateQ_query", "content": "@[simp] lemma simulateQ_query (q : OracleQuery spec Ξ±) : simulateQ so q = so.impl q" } ]
[ { "name": "OracleComp.probFailure", "content": "noncomputable def probFailure (oa : OracleComp spec Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run none" } ]
[ { "name": "OracleComp.evalDist_liftM", "content": "@[simp]\nlemma evalDist_liftM [Nonempty Ξ±] [Fintype Ξ±] (q : OracleQuery spec Ξ±) :\n evalDist (q : OracleComp spec Ξ±) = OptionT.lift (PMF.uniformOfFintype Ξ±)" } ]
import VCVio.OracleComp.Traversal import VCVio.OracleComp.SimSemantics.SimulateQ import Mathlib.Probability.Distributions.Uniform import ToMathlib.General open OracleSpec Option ENNReal BigOperators namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {ΞΉ' : Type v} {spec' : OracleSpec ΞΉ'} {Ξ± Ξ² Ξ³ : T...
@[simp] lemma probFailure_liftM (q : OracleQuery spec Ξ±) : [βŠ₯ | (q : OracleComp spec _)] = 0 :=
:= by have : Fintype Ξ± := q.rangeFintype have : Inhabited Ξ± := q.rangeInhabited simp only [probFailure, evalDist_liftM] erw [PMF.bind_apply] simp only [PMF.uniformOfFintype_apply, ENNReal.tsum_eq_zero, mul_eq_zero, ENNReal.inv_eq_zero, natCast_ne_top, false_or] intro i erw [PMF.pure_apply] simp
5
43
false
Applied verif.
466
OracleComp.probOutput_seq_map_eq_mul
lemma probOutput_seq_map_eq_mul [spec.FiniteRange] (x : Ξ±) (y : Ξ²) (z : Ξ³) (h : βˆ€ x' ∈ oa.support, βˆ€ y' ∈ ob.support, z = f x' y' ↔ x' = x ∧ y' = y) : [= z | f <$> oa <*> ob] = [= x | oa] * [= y | ob]
VCV-io
VCVio/OracleComp/DistSemantics/Seq.lean
[ "import VCVio.OracleComp.DistSemantics.Monad", "import VCVio.OracleComp.DistSemantics.EvalDist" ]
[ { "name": "inline", "module": "Init.Core" }, { "name": "OptionT", "module": "Init.Control.Option" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Set", "module": "Mathlib.Data.Set.Defs" }, { "name": "Set.univ", "module": "Mathlib.Data.Set.Defs" ...
[ { "name": "probOutput", "content": "notation \"[=\" x \"|\" oa \"]\" => probOutput oa x" }, { "name": "probOutput", "content": "noncomputable def probOutput (oa : OracleComp spec Ξ±) (x : Ξ±) : ℝβ‰₯0∞ :=\n (evalDist oa).run (some x)" }, { "name": "HasEvalDist", "content": "class HasEval...
[ { "name": "ENNReal.tsum_mul_left", "module": "Mathlib.Topology.Instances.ENNReal.Lemmas" }, { "name": "map_eq_bind_pure_comp", "module": "Mathlib.Control.Monad.Basic" }, { "name": "mul_assoc", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "seq_eq_bind", "module": "I...
[ { "name": "probOutput_bind_eq_tsum", "content": "lemma probOutput_bind_eq_tsum (y : Ξ²) :\n [= y | oa >>= ob] = βˆ‘' x : Ξ±, [= x | oa] * [= y | ob x]" }, { "name": "probOutput_pure", "content": "@[simp]\nlemma probOutput_pure [DecidableEq Ξ±] (y : Ξ±) :\n [= y | (pure x : OracleComp spec Ξ±)] = ...
[]
[ { "name": "OracleComp.probOutput_seq_map_eq_tsum", "content": "lemma probOutput_seq_map_eq_tsum [spec.FiniteRange]\n (z : Ξ³) : [= z | f <$> oa <*> ob] = βˆ‘' (x : Ξ±) (y : Ξ²),\n [= x | oa] * [= y | ob] * [= z | (pure (f x y) : OracleComp spec Ξ³)]" }, { "name": "OracleComp.probOutput_seq_map_eq_...
import VCVio.OracleComp.DistSemantics.Monad namespace OracleComp variable {ΞΉ : Type u} {spec : OracleSpec ΞΉ} {Ξ± Ξ² Ξ³ : Type v} variable (oa : OracleComp spec Ξ±) (og : OracleComp spec (Ξ± β†’ Ξ²)) section seq_map variable (oa : OracleComp spec Ξ±) (ob : OracleComp spec Ξ²) (f : Ξ± β†’ Ξ² β†’ Ξ³) section swap end swap section ...
lemma probOutput_seq_map_eq_mul [spec.FiniteRange] (x : Ξ±) (y : Ξ²) (z : Ξ³) (h : βˆ€ x' ∈ oa.support, βˆ€ y' ∈ ob.support, z = f x' y' ↔ x' = x ∧ y' = y) : [= z | f <$> oa <*> ob] = [= x | oa] * [= y | ob] :=
:= by have : DecidableEq Ξ³ := Classical.decEq Ξ³ rw [probOutput_seq_map_eq_tsum_ite, ← ENNReal.tsum_prod] refine (tsum_eq_single (x, y) (Ξ» (x', y') ↦ ?_)).trans ?_ Β· simp only [ne_eq, Prod.mk.injEq, ite_eq_right_iff, mul_eq_zero, probOutput_eq_zero_iff, ← not_and_or] exact Ξ» h1 h2 h3 ↦ h1 ((h x' h3.1 y...
5
50
true
Applied verif.
467
PFunctor.Lens.sumPair_inl_inr
@[simp] theorem sumPair_inl_inr : Lens.sumPair Lens.inl Lens.inr = Lens.id.{max uA₁ uAβ‚‚, uB₁} (P + Q)
VCV-io
ToMathlib/PFunctor/Lens/Basic.lean
[ "import ToMathlib.PFunctor.Basic" ]
[ { "name": "PFunctor", "module": "Mathlib.Data.PFunctor.Univariate.Basic" }, { "name": "Sum", "module": "Init.Core" }, { "name": "Sum.inl", "module": "Init.Core" }, { "name": "Sum.elim", "module": "Init.Data.Sum.Basic" }, { "name": "Sum.inr", "module": "Init.Co...
[ { "name": "prodPair", "content": "notation \"⟨\" l₁ \",\" lβ‚‚ \"βŸ©β‚—\" => prodPair l₁ lβ‚‚" }, { "name": "Lens", "content": "structure Lens (P : PFunctor.{uA₁, uB₁}) (Q : PFunctor.{uAβ‚‚, uBβ‚‚}) where\n toFunA : P.A β†’ Q.A\n toFunB : βˆ€ a, Q.B (toFunA a) β†’ P.B a" }, { "name": "Chart", "conte...
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "PFunctor.Lens.prodPair", "content": "def prodPair {P : PFunctor.{uA₁, uB₁}} {Q : PFunctor.{uAβ‚‚, uBβ‚‚}} {R : PFunctor.{uA₃, uB₃}}\n (l₁ : Lens P Q) (lβ‚‚ : Lens P R) :\n Lens.{uA₁, uB₁, max uAβ‚‚ uA₃, max uBβ‚‚ uB₃} P (Q * R) :=\n (fun p => (l₁.toFunA p, lβ‚‚.toFunA p)) ⇆\n (fun p => Sum.elim (l₁...
[ { "name": "PFunctor.Lens.ext", "content": "@[ext (iff := false)]\ntheorem ext {P : PFunctor.{uA₁, uB₁}} {Q : PFunctor.{uAβ‚‚, uBβ‚‚}} (l₁ lβ‚‚ : Lens P Q)\n (h₁ : βˆ€ a, l₁.toFunA a = lβ‚‚.toFunA a) (hβ‚‚ : βˆ€ a, l₁.toFunB a = (h₁ a) β–Έ lβ‚‚.toFunB a) :\n l₁ = lβ‚‚" } ]
import ToMathlib.PFunctor.Basic section find_home variable {Ξ± : Sort u} {Ξ² : Ξ± β†’ Sort v} {Ξ³ : Ξ± β†’ Sort v} end find_home namespace PFunctor namespace Lens @[inherit_doc] infixl:75 " βˆ˜β‚— " => comp @[inherit_doc] infix:50 " ≃ₗ " => Equiv namespace Equiv end Equiv def prodPair {P : PFunctor.{uA₁, uB₁}} {Q : PFunct...
@[simp] theorem sumPair_inl_inr : Lens.sumPair Lens.inl Lens.inr = Lens.id.{max uA₁ uAβ‚‚, uB₁} (P + Q) :=
:= by ext a <;> rcases a <;> rfl
2
13
true
Applied verif.
468
Veil.bind_terminates
theorem bind_terminates m (act : Wp m Οƒ ρ) (act' : ρ -> Wp m Οƒ ρ') s [LawfulAction act] : pre s -> act.alwaysSuccessfullyTerminates pre β†’ (act.bind act').alwaysSuccessfullyTerminates pre -> act.toBigStep s r' s' -> (act' r').alwaysSuccessfullyTerminates (Β· = s')
veil
Veil/DSL/Action/Theory.lean
[ "import Veil.DSL.Base" ]
[ { "name": "r", "module": "Test.Playground.WHNFExamples" }, { "name": "BEq", "module": "Init.Prelude" }, { "name": "p", "module": "Smt.Reconstruct.Certified.ModusPonens" }, { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "impl", "module": "Mathlib....
[ { "name": "syntax (name:= assumption) \"assumptionDef\" : attr", "content": "syntax (name:= assumption) \"assumptionDef\" : attr" } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Veil.Mode", "content": "inductive Mode where\n | internal : Mode\n | external : Mode\nderiving BEq" }, { "name": "Veil.SProp", "content": "@[inline] abbrev SProp := Οƒ -> Prop" }, { "name": "Veil.RProp", "content": "@[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ" },...
[ { "name": "Veil.big_step_sound'", "content": "theorem big_step_sound' [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ ρ) :\n act.triple req ens β†’ act.toBigStep.triple req ens" } ]
import Veil.DSL.Base namespace Veil section Veil open Classical section Types inductive Mode where | internal : Mode | external : Mode deriving BEq variable (m : Mode) (Οƒ ρ : Type) @[inline] abbrev SProp := Οƒ -> Prop @[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ abbrev Wp (m : Mode) (Οƒ ρ : Type) := Οƒ ...
theorem bind_terminates m (act : Wp m Οƒ ρ) (act' : ρ -> Wp m Οƒ ρ') s [LawfulAction act] : pre s -> act.alwaysSuccessfullyTerminates pre β†’ (act.bind act').alwaysSuccessfullyTerminates pre -> act.toBigStep s r' s' -> (act' r').alwaysSuccessfullyTerminates (Β· = s') :=
:= by unfold Wp.alwaysSuccessfullyTerminates Wp.toBigStep Wp.toWlp Wp.bind intros hpre actT act'T have actT := actT s hpre have act'T := act'T s hpre have act''T := big_step_sound' (act := act) (req := (Β· = s)) unfold Wp.triple BigStep.triple Wp.toBigStep Wp.toWlp at act''T simp at act''T; s...
3
21
true
Framework
469
Veil.lift_transition_big_step'
theorem lift_transition_big_step' {Οƒ Οƒ'} [IsSubStateOf Οƒ Οƒ'] (m : Mode) (r : Wp m Οƒ ρ) [LawfulAction r] (st : Οƒ') : r.alwaysSuccessfullyTerminates (Β· = getFrom st) β†’ (@Wp.lift _ m Οƒ Οƒ' _ r).toBigStep st = fun r' st' => r.toBigStep (getFrom st) r' (getFrom st') ∧ st' = (setIn (@getFrom Οƒ Οƒ' _ st') st)
veil
Veil/DSL/Action/Theory.lean
[ "import Veil.DSL.Base" ]
[ { "name": "semiOutParam", "module": "Init.Prelude" }, { "name": "BEq", "module": "Init.Prelude" }, { "name": "p", "module": "Smt.Reconstruct.Certified.ModusPonens" }, { "name": "r", "module": "Test.Playground.WHNFExamples" }, { "name": "Unit", "module": "Init....
[ { "name": "syntax (name:= assumption) \"assumptionDef\" : attr", "content": "syntax (name:= assumption) \"assumptionDef\" : attr" } ]
[ { "name": "Classical.not_forall", "module": "Init.Classical" }, { "name": "Decidable.not_not", "module": "Init.PropLemmas" }, { "name": "and_true", "module": "Init.SimpLemmas" }, { "name": "eq_iff_iff", "module": "Init.Core" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Veil.Mode", "content": "inductive Mode where\n | internal : Mode\n | external : Mode\nderiving BEq" }, { "name": "Veil.SProp", "content": "@[inline] abbrev SProp := Οƒ -> Prop" }, { "name": "Veil.RProp", "content": "@[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ" },...
[ { "name": "Veil.lift_transition_big_step", "content": "theorem lift_transition_big_step {Οƒ Οƒ'} [IsSubStateOf Οƒ Οƒ'] (m : Mode) (tr : BigStep Οƒ ρ) :\n (@Wp.lift _ m Οƒ Οƒ' _ tr.toWp).toBigStep =\n fun st r' st' =>\n tr (getFrom st) r' (getFrom st') ∧\n st' = (setIn (@getFrom Οƒ Οƒ' _ st') st)" }, { ...
import Veil.DSL.Base namespace Veil section Veil open Classical section Types inductive Mode where | internal : Mode | external : Mode deriving BEq variable (m : Mode) (Οƒ ρ : Type) @[inline] abbrev SProp := Οƒ -> Prop @[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ @[inline] abbrev TwoState := Οƒ -> Οƒ -> ...
theorem lift_transition_big_step' {Οƒ Οƒ'} [IsSubStateOf Οƒ Οƒ'] (m : Mode) (r : Wp m Οƒ ρ) [LawfulAction r] (st : Οƒ') : r.alwaysSuccessfullyTerminates (Β· = getFrom st) β†’ (@Wp.lift _ m Οƒ Οƒ' _ r).toBigStep st = fun r' st' => r.toBigStep (getFrom st) r' (getFrom st') ∧ st' = (setIn (@getFrom Οƒ Οƒ' _ st') st) :=
:= by intro term have rEq : r.lift.toBigStep st = (r.toBigStep.toWp.lift.toBigStep st) := by { unfold Wp.lift Wp.toBigStep Wp.toWlp; ext; simp rw [big_step_to_wp (act := r) (req := (fun x => x = getFrom st))] <;> try simp [*] unfold Wp.toBigStep Wp.toWlp; simp } rw [rEq, lift_transition_big_step]
5
35
true
Framework
470
Veil.big_step_to_wp
theorem big_step_to_wp (act : Wp m Οƒ ρ) [LawfulAction act] (req : SProp Οƒ) : act.alwaysSuccessfullyTerminates req -> req s -> act s = act.toBigStep.toWp s
veil
Veil/DSL/Action/Theory.lean
[ "import Veil.DSL.Base" ]
[ { "name": "BEq", "module": "Init.Prelude" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "r", "module": "Test.Playground.WHNFExamples" }, { "name": "p", "module": "Smt.Reconstruct.Certified.ModusPonens" }, { "name": "Inhabited", "module": "Init.Pre...
[ { "name": "syntax (name:= assumption) \"assumptionDef\" : attr", "content": "syntax (name:= assumption) \"assumptionDef\" : attr" } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Veil.Mode", "content": "inductive Mode where\n | internal : Mode\n | external : Mode\nderiving BEq" }, { "name": "Veil.SProp", "content": "@[inline] abbrev SProp := Οƒ -> Prop" }, { "name": "Veil.RProp", "content": "@[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ" },...
[ { "name": "Veil.big_step_sound", "content": "theorem big_step_sound [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ ρ) :\n (Β¬ βˆ€ r s, ens r s) ->\n act.toBigStep.triple req ens -> act.triple req ens" }, { "name": "Veil.big_step_sound'", "content": "theorem big_step_sound' [LawfulAction act] (...
import Veil.DSL.Base namespace Veil section Veil open Classical section Types inductive Mode where | internal : Mode | external : Mode deriving BEq variable (m : Mode) (Οƒ ρ : Type) @[inline] abbrev SProp := Οƒ -> Prop @[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ @[inline] abbrev TwoState := Οƒ -> Οƒ -> ...
theorem big_step_to_wp (act : Wp m Οƒ ρ) [LawfulAction act] (req : SProp Οƒ) : act.alwaysSuccessfullyTerminates req -> req s -> act s = act.toBigStep.toWp s :=
:= by intro hterm hreq; ext post; constructor { simp [BigStep.toWp]; intro _ _ _ solve_by_elim [big_step_sound'] } simp [BigStep.toWp] intro h; apply big_step_always_terminating_sound (req := (s = Β·)) <;> try simp { solve_by_elim } intro; simp_all
3
24
false
Framework
471
Veil.big_step_always_terminating_sound
theorem big_step_always_terminating_sound [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ ρ) : act.alwaysSuccessfullyTerminates req -> act.toBigStep.triple req ens -> act.triple req ens
veil
Veil/DSL/Action/Theory.lean
[ "import Veil.DSL.Base" ]
[ { "name": "BEq", "module": "Init.Prelude" }, { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "impl", "module": "Mathlib.Deprecated.MLList.BestFirst" }, { "name": "r", "module": "Test.Playground.WHNFExamples" }, { "name": "t", "module": "Test.Unit....
[ { "name": "...", "content": "..." } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Veil.Mode", "content": "inductive Mode where\n | internal : Mode\n | external : Mode\nderiving BEq" }, { "name": "Veil.SProp", "content": "@[inline] abbrev SProp := Οƒ -> Prop" }, { "name": "Veil.RProp", "content": "@[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ" },...
[ { "name": "Veil.big_step_sound", "content": "theorem big_step_sound [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ ρ) :\n (Β¬ βˆ€ r s, ens r s) ->\n act.toBigStep.triple req ens -> act.triple req ens" } ]
import Veil.DSL.Base namespace Veil section Veil open Classical section Types inductive Mode where | internal : Mode | external : Mode deriving BEq variable (m : Mode) (Οƒ ρ : Type) @[inline] abbrev SProp := Οƒ -> Prop @[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ abbrev Wp (m : Mode) (Οƒ ρ : Type) := Οƒ ...
theorem big_step_always_terminating_sound [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ ρ) : act.alwaysSuccessfullyTerminates req -> act.toBigStep.triple req ens -> act.triple req ens :=
:= by intro ensTaut htriple s hreq by_cases h: (Β¬ βˆ€ r s, ens r s) { solve_by_elim [big_step_sound] } apply LawfulAction.impl (post := fun _ _ => True) <;> try simp_all
4
11
true
Framework
472
Veil.TwoState_sound'_ret_unit
theorem TwoState_sound'_ret_unit [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ PUnit) : act.triple req ens β†’ act.toTwoState.triple req (ens () Β·)
veil
Veil/DSL/Action/Theory.lean
[ "import Veil.DSL.Base" ]
[ { "name": "BEq", "module": "Init.Prelude" }, { "name": "Inhabited", "module": "Init.Prelude" }, { "name": "impl", "module": "Mathlib.Deprecated.MLList.BestFirst" }, { "name": "r", "module": "Test.Playground.WHNFExamples" }, { "name": "t", "module": "Test.Unit....
[ { "name": "syntax (name:= assumption) \"assumptionDef\" : attr", "content": "syntax (name:= assumption) \"assumptionDef\" : attr" } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Veil.Mode", "content": "inductive Mode where\n | internal : Mode\n | external : Mode\nderiving BEq" }, { "name": "Veil.SProp", "content": "@[inline] abbrev SProp := Οƒ -> Prop" }, { "name": "Veil.RProp", "content": "@[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ" },...
[ { "name": "Veil.TwoState_sound'", "content": "theorem TwoState_sound' [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ ρ) :\n act.triple req ens β†’ act.toTwoState.triple req (βˆƒ r, ens r Β·)" }, { "name": "Veil.exists_over_PUnit", "content": "theorem exists_over_PUnit (p : PUnit β†’ Prop) : (βˆƒ (u :...
import Veil.DSL.Base namespace Veil section Veil open Classical section Types inductive Mode where | internal : Mode | external : Mode deriving BEq variable (m : Mode) (Οƒ ρ : Type) @[inline] abbrev SProp := Οƒ -> Prop @[inline] abbrev RProp (ρ : Type u) := ρ β†’ SProp Οƒ abbrev Wp (m : Mode) (Οƒ ρ : Type) := Οƒ ...
theorem TwoState_sound'_ret_unit [LawfulAction act] (req : SProp Οƒ) (ens : RProp Οƒ PUnit) : act.triple req ens β†’ act.toTwoState.triple req (ens () Β·) :=
:= by have heq : (ens () Β·) = (βˆƒ r, ens r Β·) := by ext ; rw [exists_over_PUnit] rw [heq] ; apply TwoState_sound'
4
15
true
Framework
473
FBA.slice_blocks_ne
theorem slice_blocks_ne : βˆ€ n S I, intact (inst := inst) I β†’ n ∈ I β†’ blocks_slices S n β†’ S ∩ I β‰  βˆ…
veil
Examples/StellarConsensus/SCPTheory.lean
[ "import Mathlib.Data.Set.Basic" ]
[ { "name": "Set", "module": "Mathlib.Data.Set.Defs" }, { "name": "p", "module": "Smt.Reconstruct.Certified.ModusPonens" } ]
[ { "name": "syntax (name:= assumption) \"assumptionDef\" : attr", "content": "syntax (name:= assumption) \"assumptionDef\" : attr" } ]
[ { "name": "Set.nonempty_iff_ne_empty", "module": "Mathlib.Data.Set.Basic" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "FBA.project", "content": "def project {Ξ± Ξ² : Type} (slices : Ξ² β†’ Set (Set Ξ±)) (S : Set Ξ±) : Ξ² β†’ Set (Set Ξ±) :=\n fun n => { Sl ∩ S | Sl ∈ slices n }" }, { "name": "FBA.System", "content": "class System (Node : Type) where\n \n W : Set Node\n slices : Node β†’ Set (Set Node)\n \n ...
[ { "name": "Set.ne_empty_iff_exists_mem", "content": "theorem Set.ne_empty_iff_exists_mem {Ξ± : Type u} {s : Set Ξ±} : s β‰  βˆ… ↔ βˆƒ a, a ∈ s" }, { "name": "FBA.intact_implies_intertwined", "content": "theorem intact_implies_intertwined : βˆ€ I, intact (inst := inst) I β†’ intertwined I" }, { "name...
import Mathlib.Data.Set.Basic namespace FBA def project {Ξ± Ξ² : Type} (slices : Ξ² β†’ Set (Set Ξ±)) (S : Set Ξ±) : Ξ² β†’ Set (Set Ξ±) := fun n => { Sl ∩ S | Sl ∈ slices n } class System (Node : Type) where W : Set Node slices : Node β†’ Set (Set Node) slices_ne : βˆ€ p ∈ W, slices p β‰  βˆ… variable {Node : Type} ...
theorem slice_blocks_ne : βˆ€ n S I, intact (inst := inst) I β†’ n ∈ I β†’ blocks_slices S n β†’ S ∩ I β‰  βˆ… :=
:= by intro n S I hI hin hblock unfold blocks_slices at hblock have h := hI.q_avail ; unfold quorum at h simp at h ; specialize h _ hin (intact_node_is_well_behaved _ _ hI hin) rcases h with ⟨Sl, hSl, h⟩ ; specialize hblock _ hSl rw [Set.ne_empty_iff_exists_mem] at hblock ⊒ ; simp at hblock ⊒ aesop
3
14
true
Framework
474
Term.lower_ite_hEquiv
theorem lower_ite_hEquiv {cond : Term .bool} {pos neg : Term Ο„} (hc : cond β‰ˆ lower cond) (hp : pos β‰ˆ lower pos) (hn : neg β‰ˆ lower neg) : ite cond pos neg β‰ˆ lower (ite cond pos neg)
verified-compiler
VerifiedCompiler.lean
[]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "bool", "module": "Init.Control.Basic" }, { "name": "cond...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.cons_append", "module": "Init.Data.List.Basic" }, { "name": "List.append_nil", "module": "Init.Data.List.Basic" }, { "name": "List.append_assoc", "module": "Init.Data.List.Basic" }, { "name": "List.length_append", "module": "Init.Data.List.Basic" }, { ...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ty", "content": "inductive Ty\n | bool\n | nat" }, { "name": "Value", "content": "inductive Value : Ty β†’ Type\n | bool : Bool β†’ Value .bool\n | nat : Nat β†’ Value .nat" }, { "name": "Term", "content": "inductive Term : Ty β†’ Type\n | val (v : Value Ο„) ...
[ { "name": "Instruction.jmp_def", "content": "@[simp]\ntheorem jmp_def (offset s) : exec (.jmp offset) s = some ⟨s, offset⟩" }, { "name": "Instruction.jez_zero", "content": "@[simp]\ntheorem jez_zero (offset s) : exec (.jez offset) (0 :: s) = some ⟨s, offset⟩" }, { "name": "Instruction.je...
inductive Ty | bool | nat inductive Value : Ty β†’ Type | bool : Bool β†’ Value .bool | nat : Nat β†’ Value .nat inductive Term : Ty β†’ Type | val (v : Value Ο„) : Term Ο„ | ite (cond : Term .bool) (pos neg : Term Ο„) : Term Ο„ | and (lhs rhs : Term .bool) : Term .bool n...
theorem lower_ite_hEquiv {cond : Term .bool} {pos neg : Term Ο„} (hc : cond β‰ˆ lower cond) (hp : pos β‰ˆ lower pos) (hn : neg β‰ˆ lower neg) : ite cond pos neg β‰ˆ lower (ite cond pos neg) :=
:= by rw [HEquiv, lower, append_assoc, append_assoc, append_assoc] at * -- Give names to terms needed later. let pl := pos.lower.length + 1 let nl := neg.lower.length let prog₃ := [.jmp nl] ++ neg.lower let progβ‚‚ := pos.lower ++ prog₃ let prog₁ := [.jez pl] ++ progβ‚‚ -- Peel off the leading `lower ...
3
39
false
Compiler
475
Term.lower_and_hEquiv
theorem lower_and_hEquiv (hl : lhs β‰ˆ lower lhs) (hr : rhs β‰ˆ lower rhs) : and lhs rhs β‰ˆ lower (and lhs rhs)
verified-compiler
VerifiedCompiler.lean
[]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "bool", "module": "Init.Control.Basic" }, { "name": "cond...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.cons_append", "module": "Init.Data.List.Basic" }, { "name": "List.nil_append", "module": "Init.Data.List.Basic" }, { "name": "List.singleton_append", "module": "Init.Data.List.Lemmas" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ty", "content": "inductive Ty\n | bool\n | nat" }, { "name": "Value", "content": "inductive Value : Ty β†’ Type\n | bool : Bool β†’ Value .bool\n | nat : Nat β†’ Value .nat" }, { "name": "Term", "content": "inductive Term : Ty β†’ Type\n | val (v : Value Ο„) ...
[ { "name": "Instruction.exec_stack_mono", "content": "@[simp]\ntheorem exec_stack_mono (s : Stack) (h : exec inst s₁ = some ⟨sβ‚‚, o⟩) :\n exec inst (s₁ ++ s) = some ⟨sβ‚‚ ++ s, o⟩" }, { "name": "Program.goto_mono", "content": "theorem goto_mono (progβ‚‚ : Program) (h : goto prog₁ offset = some prog...
inductive Ty | bool | nat inductive Value : Ty β†’ Type | bool : Bool β†’ Value .bool | nat : Nat β†’ Value .nat inductive Term : Ty β†’ Type | val (v : Value Ο„) : Term Ο„ | ite (cond : Term .bool) (pos neg : Term Ο„) : Term Ο„ | and (lhs rhs : Term .bool) : Term .bool n...
theorem lower_and_hEquiv (hl : lhs β‰ˆ lower lhs) (hr : rhs β‰ˆ lower rhs) : and lhs rhs β‰ˆ lower (and lhs rhs) :=
:= by have h₁ := exec_prog_mono (lower rhs ++ [.and]) hl have hβ‚‚ := exec_stack_mono [lhs.eval.toNat] hr simp only [nil_append, singleton_append] at hβ‚‚ have h₃ := exec_prog_mono [.and] hβ‚‚ simp [h₁, h₃, HEquiv, lower, exec, goto, Instruction.exec]
4
28
false
Compiler
476
Term.lower_hEquiv
theorem lower_hEquiv (t : Term Ο„) : t β‰ˆ lower t
verified-compiler
VerifiedCompiler.lean
[]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "bool", "module": "Init.Control.Basic" }, { "name": "cond", "module": "Init.Prelude" }, { "name": "Option...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.cons_append", "module": "Init.Data.List.Basic" }, { "name": "List.nil_append", "module": "Init.Data.List.Basic" }, { "name": "List.singleton_append", "module": "Init.Data.List.Lemmas" }, { "name": "List.append_nil", "module": "Init.Data.List.Basic" }, ...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ty", "content": "inductive Ty\n | bool\n | nat" }, { "name": "Value", "content": "inductive Value : Ty β†’ Type\n | bool : Bool β†’ Value .bool\n | nat : Nat β†’ Value .nat" }, { "name": "Term", "content": "inductive Term : Ty β†’ Type\n | val (v : Value Ο„) ...
[ { "name": "Instruction.jmp_def", "content": "@[simp]\ntheorem jmp_def (offset s) : exec (.jmp offset) s = some ⟨s, offset⟩" }, { "name": "Instruction.jez_zero", "content": "@[simp]\ntheorem jez_zero (offset s) : exec (.jez offset) (0 :: s) = some ⟨s, offset⟩" }, { "name": "Instruction.je...
inductive Ty | bool | nat inductive Value : Ty β†’ Type | bool : Bool β†’ Value .bool | nat : Nat β†’ Value .nat inductive Term : Ty β†’ Type | val (v : Value Ο„) : Term Ο„ | ite (cond : Term .bool) (pos neg : Term Ο„) : Term Ο„ | and (lhs rhs : Term .bool) : Term .bool n...
theorem lower_hEquiv (t : Term Ο„) : t β‰ˆ lower t :=
:= by induction t case val => exact lower_val_hEquiv _ case and hl hr => exact lower_and_hEquiv hl hr case ite hc hp hn => exact lower_ite_hEquiv hc hp hn
4
44
false
Compiler
477
Term.constFold_equiv
theorem constFold_equiv (t : Term Ο„) : t ~ constFold t
verified-compiler
VerifiedCompiler.lean
[]
[ { "name": "Bool", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "bool", "module": "Init.Control.Basic" }, { "name": "cond", "module": "Init.Prelude" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ty", "content": "inductive Ty\n | bool\n | nat" }, { "name": "Value", "content": "inductive Value : Ty β†’ Type\n | bool : Bool β†’ Value .bool\n | nat : Nat β†’ Value .nat" }, { "name": "Term", "content": "inductive Term : Ty β†’ Type\n | val (v : Value Ο„) ...
[]
inductive Ty | bool | nat inductive Value : Ty β†’ Type | bool : Bool β†’ Value .bool | nat : Nat β†’ Value .nat inductive Term : Ty β†’ Type | val (v : Value Ο„) : Term Ο„ | ite (cond : Term .bool) (pos neg : Term Ο„) : Term Ο„ | and (lhs rhs : Term .bool) : Term .bool n...
theorem constFold_equiv (t : Term Ο„) : t ~ constFold t :=
:= by induction t case val v => rfl case ite hc hp hn => exact Equiv.ite_congr hc hp hn case and lhs rhs hl hr => unfold constFold cases lhs <;> cases rhs case val.val v₁ vβ‚‚ => cases v₁; cases vβ‚‚; cases β€ΉBoolβ€Ί <;> cases β€ΉBoolβ€Ί <;> simp all_goals simp only [Equiv.and_congr hl hr]
3
12
false
Compiler
478
Program.exec_prog_mono
@[simp] theorem exec_prog_mono (progβ‚‚ : Program) (h : exec prog₁ s₁ = some sβ‚‚) : exec (prog₁ ++ progβ‚‚) s₁ = exec progβ‚‚ sβ‚‚
verified-compiler
VerifiedCompiler.lean
[]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "List.next", "module": "Mathlib.Data.List.Cycle" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "List.cons_append", "module": "Init.Data.List.Basic" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Instruction", "content": "inductive Instruction\n | const (n : Nat)\n | and\n | jmp (offset : Nat)\n | jez (offset : Nat)" }, { "name": "Program", "content": "abbrev Program := List Instruction" }, { "name": "Stack", "content": "abbrev Stack := List Nat" }, { "...
[ { "name": "Program.goto_mono", "content": "theorem goto_mono (progβ‚‚ : Program) (h : goto prog₁ offset = some prog₁') :\n goto (prog₁ ++ progβ‚‚) offset = some (prog₁' ++ progβ‚‚)" } ]
namespace Term namespace Equiv infixl:50 " ~ " => Equiv end Equiv end Term open Term (eval) inductive Instruction | const (n : Nat) | and | jmp (offset : Nat) | jez (offset : Nat) abbrev Program := List Instruction abbrev Stack := List Nat def Nat.conj : Nat β†’ Nat β†’ Nat | 0, _ | _, 0 => 0 | _, _ ...
@[simp] theorem exec_prog_mono (progβ‚‚ : Program) (h : exec prog₁ s₁ = some sβ‚‚) : exec (prog₁ ++ progβ‚‚) s₁ = exec progβ‚‚ sβ‚‚ :=
:= by induction prog₁, s₁ using exec.induct <;> try (simp_all [exec]; done) next hh hg => simp only [exec, hh] at h rw [hg] at h contradiction next hh _ hg hi => simp only [exec, hh, List.cons_append] at * rw [hg] at h rw [Program.goto_mono _ hg, ←(hi h)]
3
14
false
Compiler
479
Program.exec_stack_mono
@[simp] theorem exec_stack_mono (s : Stack) (h : exec prog s₁ = some sβ‚‚) : exec prog (s₁ ++ s) = sβ‚‚ ++ s
verified-compiler
VerifiedCompiler.lean
[]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "List.next", "module": "Mathlib.Data.List.Cycle" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "...", "module": "" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Instruction", "content": "inductive Instruction\n | const (n : Nat)\n | and\n | jmp (offset : Nat)\n | jez (offset : Nat)" }, { "name": "Program", "content": "abbrev Program := List Instruction" }, { "name": "Stack", "content": "abbrev Stack := List Nat" }, { "...
[ { "name": "Instruction.exec_stack_mono", "content": "@[simp]\ntheorem exec_stack_mono (s : Stack) (h : exec inst s₁ = some ⟨sβ‚‚, o⟩) :\n exec inst (s₁ ++ s) = some ⟨sβ‚‚ ++ s, o⟩" } ]
namespace Term namespace Equiv infixl:50 " ~ " => Equiv end Equiv end Term open Term (eval) inductive Instruction | const (n : Nat) | and | jmp (offset : Nat) | jez (offset : Nat) abbrev Program := List Instruction abbrev Stack := List Nat def Nat.conj : Nat β†’ Nat β†’ Nat | 0, _ | _, 0 => 0 | _, _ ...
@[simp] theorem exec_stack_mono (s : Stack) (h : exec prog s₁ = some sβ‚‚) : exec prog (s₁ ++ s) = sβ‚‚ ++ s :=
:= by induction prog, s₁ using exec.induct <;> try (simp_all [exec]; done) next hh hg => simp only [exec, hh] at h rw [hg] at h contradiction next hh _ hg hi => simp only [exec, hh, Instruction.exec_stack_mono _ hh] at * rw [hg] at h ⊒ exact hi h
5
13
false
Compiler
480
Intmax.lemma4
lemma lemma4 (h : π₁ ≀ Ο€β‚‚) : Bal π₁ bs ≀ Bal Ο€β‚‚ bs
FVIntmax
FVIntmax/Lemma4.lean
[ "import FVIntmax.Wheels.Dictionary", "import FVIntmax.Wheels", "import FVIntmax.Balance" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Preorder", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Set", "module": "Mathlib.Data.Set...
[ { "name": "local macro:max (priority := high) \"β†ͺ\" b:term : term => `(⟨$", "content": "local macro:max (priority := high) \"β†ͺ\" b:term : term => `(⟨$b, by admit /- proof elided -/\n⟩)" }, { "name": "S", "content": "abbrev S (K₁ Kβ‚‚ V : Type) [PreWithZero V] := { s : S' K₁ Kβ‚‚ V // s.isValid }" ...
[ { "name": "not_and_or", "module": "Mathlib.Logic.Basic" }, { "name": "congr_fun", "module": "Batteries.Logic" }, { "name": "List.ext_get_iff", "module": "Mathlib.Data.List.Basic" }, { "name": "le_isGLB_iff", "module": "Mathlib.Order.Bounds.Basic" }, { "name": "mem...
[ { "name": "le_of_ext_le", "content": "lemma le_of_ext_le {Ξ± : Type} [Preorder Ξ±] {v₁ vβ‚‚ : Vector Ξ± n}\n (h : βˆ€ i : Fin n, v₁.1[i] ≀ vβ‚‚.1[i]) : v₁ ≀ vβ‚‚" }, { "name": "mem_dict_iff_mem_keys", "content": "lemma mem_dict_iff_mem_keys {dict : Dict Ξ± Ο‰} : k ∈ dict ↔ k ∈ dict.keys" }, { "name"...
[ { "name": "Intmax.length_of_TransactionsInBlocks", "content": "private abbrev length_of_TransactionsInBlocks (bs : List (Block K₁ Kβ‚‚ C Sigma V)) :\n { n : β„• // n = (TransactionsInBlocks (Classical.arbitrary _ : BalanceProof K₁ Kβ‚‚ C Pi V) bs).length } :=\n ⟨(TransactionsInBlocks (Classical.arbitrary _ : Ba...
[ { "name": "Intmax.Bal'_eq_Bal", "content": "private lemma Bal'_eq_Bal : Bal' bs Ο€ = Bal Ο€ bs" }, { "name": "Intmax.BalFixed_eq_BalFixed'", "content": "private lemma BalFixed_eq_BalFixed' : BalFixed bs Ο€ = BalFixed' bs Ο€" }, { "name": "Intmax.TransactionsInBlocksFixed_le_of_TransactionsIn...
import FVIntmax.Balance namespace Intmax open Mathlib noncomputable section Lemma4 section HicSuntDracones section variable {Pi C Sigma : Type} {K₁ : Type} [Finite K₁] [LinearOrder K₁] {Kβ‚‚ : Type} [Finite Kβ‚‚] [LinearOrder Kβ‚‚] {V : Type} [AddCommGroup V] [Lattice V] {Ο€...
lemma lemma4 (h : π₁ ≀ Ο€β‚‚) : Bal π₁ bs ≀ Bal Ο€β‚‚ bs :=
:= by simp only [←Bal'_eq_Bal] suffices BalFixed bs π₁ ≀ BalFixed bs Ο€β‚‚ by aesop rw [BalFixed_eq_BalFixed', BalFixed_eq_BalFixed'] exact Monotone.comp monotone_fStarFixed monotone_TransactionsInBlocksFixed h
11
117
false
Applied verif.
481
add_aux1
theorem add_aux1 (x : UInt128) : 4 * (x.cast : F).valMinAbs.natAbs < PRIME
wadray_verification
WadrayVerification/WadraySigned.lean
[ "import WadrayVerification.Aux", "import WadrayVerification.Wadray" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Bool.toSierraBool", "module": "Aegis.Aux.Bool" }, { "name": "Bool.xor", "module": "Init.Data.Bool" }...
[ { "name": "RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "div", "content": "protected def div : SignedRay :=\n⟨Ray.div (w₁.1 : Ray) (wβ‚‚.1 : Ray), Bool.toSierraBool (Bool.xor (SierraBool.toBool w₁.2) (SierraBool.toBool wβ‚‚.2))⟩" }, { "name": "Signe...
[ { "name": "le_of_lt", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "Int.cast_abs", "module": "Mathlib.Algebra.Order.Ring.Cast" }, { "name": "Int.cast_add", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Int.cast_natAbs", "module": "Mathlib.Algebra.Order...
[ { "name": "mul_def", "content": "protected theorem mul_def :\n r * r' = (r.toZMod.val * r'.toZMod.val / RAY_SCALE : UInt128)" }, { "name": "mul_def", "content": "theorem mul_def :\n w₁ * wβ‚‚ = ⟨Ray.mul w₁.1 wβ‚‚.1, Bool.toSierraBool (Bool.xor (SierraBool.toBool w₁.2) (SierraBool.toBool wβ‚‚.2)...
[]
[ { "name": "two_U128_MOD_lt_PRIME", "content": "theorem two_U128_MOD_lt_PRIME : 2 * U128_MOD < PRIME" }, { "name": "four_U128_MOD_lt_PRIME", "content": "theorem four_U128_MOD_lt_PRIME : 4 * U128_MOD < PRIME" }, { "name": "four_U128_MOD_le_PRIME", "content": "theorem four_U128_MOD_le_P...
import WadrayVerification.Aux import WadrayVerification.Wadray open Sierra aegis_spec "wadray::wadray_signed::SignedWadZeroable::zero" := fun _ (ρ : SignedWad) => ρ = 0 aegis_prove "wadray::wadray_signed::SignedWadZeroable::zero" := fun _ (ρ : SignedWad) => by rintro rfl rfl aegis_spec "wadray::wadray_si...
theorem add_aux1 (x : UInt128) : 4 * (x.cast : F).valMinAbs.natAbs < PRIME :=
:= by rw [ZMod.valMinAbs_cast_of_lt_half two_U128_MOD_lt_PRIME, Int.natAbs_ofNat] apply lt_of_lt_of_le _ four_U128_MOD_le_PRIME apply Nat.mul_lt_mul_of_pos_left (ZMod.val_lt _) (by norm_num) aegis_prove "wadray::wadray_signed::SignedWadAdd::add" := fun _ _ (a b : SignedWad) _ (ρ : SignedWad βŠ• _) => by unfold...
3
104
false
Applied verif.
482
RAY_SCALE_val
theorem RAY_SCALE_val : (1000000000000000000000000000 : UInt128).val = 1000000000000000000000000000 := rfl aegis_spec "wadray::wadray::u128_rmul"
wadray_verification
WadrayVerification/Wadray.lean
[ "import WadrayVerification.Load", "import WadrayVerification.Aux", "import CorelibVerification" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "SierraBool.toBool", "module": "Aegis.Aux.Bool" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "Bool.toSierraBool", "module": "Aegis.Aux.Bool" }, { "name": "Int", "module": "Init.Data...
[ { "name": "RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "add", "content": "protected def add : Ray := r.toZMod + r'.toZMod" }, { "name": "toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray", "content": "d...
[ { "name": "Aesop.BuiltinRules.not_intro", "module": "Aesop.BuiltinRules" }, { "name": "Bool.false_eq_true", "module": "Init.Data.Bool" }, { "name": "Int.cast_ofNat", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Int.ofNat_eq_coe", "module": "Init.Data.Int.Basic" ...
[ { "name": "toRat_lt_toRat_of_val_lt_val", "content": "theorem toRat_lt_toRat_of_val_lt_val (h : @ZMod.val U128_MOD r < @ZMod.val U128_MOD r') :\n r.toRat < r'.toRat" }, { "name": "RAY_SCALE_rat_pos", "content": "theorem RAY_SCALE_rat_pos : 0 < (RAY_SCALE : β„š)" }, { "name": "toRat_lt_t...
[]
[ { "name": "Bool.toSierraBool_def", "content": "theorem Bool.toSierraBool_def (b : Bool) : b.toSierraBool = if b then .inr () else .inl ()" } ]
import CorelibVerification import WadrayVerification.Aux import WadrayVerification.Load open Sierra
theorem RAY_SCALE_val : (1000000000000000000000000000 : UInt128).val = 1000000000000000000000000000 :=
:= rfl aegis_spec "wadray::wadray::u128_rmul" := fun _ _ a b _ ρ => (a.val * b.val / Ray.RAY_SCALE < U128_MOD ∧ ρ = .inl (a.val * b.val / Ray.RAY_SCALE)) ∨ (U128_MOD ≀ a.val * b.val / Ray.RAY_SCALE ∧ ρ.isRight) aegis_prove "wadray::wadray::u128_rmul" := fun _ _ a b _ ρ => by unfold Β«spec_wadray::wadray::u12...
3
104
false
Applied verif.
483
Wad.toRat_div
theorem toRat_div (h : w.toZMod.val * WAD_SCALE / w'.toZMod.val < U128_MOD) (h' : w'.toZMod.val β‰  0) : |(w / w').toRat - w.toRat / w'.toRat| < 1 / WAD_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.Basic" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs"...
[ { "name": "Wad.div", "content": "protected def Wad.div : Wad := (w.toZMod.val * WAD_SCALE / w'.toZMod.val : UInt128)" }, { "name": "", "content": "instance : Div Wad := ⟨Wad.div⟩" } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" }, { "name": "Wad.WAD_SCALE_rat_ne_zero", "c...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE
theorem toRat_div (h : w.toZMod.val * WAD_SCALE / w'.toZMod.val < U128_MOD) (h' : w'.toZMod.val β‰  0) : |(w / w').toRat - w.toRat / w'.toRat| < 1 / WAD_SCALE :=
:= by have h'' : 0 < w'.toZMod.val := Nat.pos_of_ne_zero h' have h''' : (0 : β„š) < w'.toZMod.val := Nat.cast_pos.mpr h'' simp only [Wad.toRat, Wad.toZMod, Wad.div_def, ZMod.val_natCast] at * rw [Nat.mod_eq_of_lt h, Rat.nat_cast_div_eq, sub_div, Nat.cast_mul, div_div, mul_div_mul_right _ _ WAD_SCALE_rat_ne_ze...
2
34
false
Applied verif.
484
SignedWad.toRat_mul
theorem toRat_mul (h₁ : w₁.1.val * wβ‚‚.1.val / Wad.WAD_SCALE < U128_MOD ): |SignedWad.toRat (w₁ * wβ‚‚) - SignedWad.toRat w₁ * SignedWad.toRat wβ‚‚| < 1 / Wad.WAD_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.Basic" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs"...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Wad.WAD_SCALE_pos", "content": "theorem WAD_SCALE_pos : 0 < WAD_SCALE" }, { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem ...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE protected def mul : ...
theorem toRat_mul (h₁ : w₁.1.val * wβ‚‚.1.val / Wad.WAD_SCALE < U128_MOD ): |SignedWad.toRat (w₁ * wβ‚‚) - SignedWad.toRat w₁ * SignedWad.toRat wβ‚‚| < 1 / Wad.WAD_SCALE :=
:= by rcases w₁ with ⟨w₁, sβ‚βŸ© rcases wβ‚‚ with ⟨wβ‚‚, sβ‚‚βŸ© rcases s₁ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> rcases sβ‚‚ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> dsimp only at h₁ <;> simp [mul_def, toRat, Wad.mul, Wad.toRat, Wad.toZMod, Nat.mod_eq_of_lt h₁, -one_div] <;> rw [Rat.nat_cast_div_eq, Nat.cast_mul, ZMod.natCast_val, ZMod.natCast_val, m...
2
43
false
Applied verif.
485
SignedRay.toRat_mul
theorem toRat_mul (h₁ : w₁.1.val * wβ‚‚.1.val / Ray.RAY_SCALE < U128_MOD ): |SignedRay.toRat (w₁ * wβ‚‚) - SignedRay.toRat w₁ * SignedRay.toRat wβ‚‚| < 1 / Ray.RAY_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "SierraBool.toBool", "module": "Aegis.Aux.Bool" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.B...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "Ray.toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray.toRat", "content": "protected...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Ray.RAY_SCALE_pos", "content": "theorem RAY_SCALE_pos : 0 < RAY_SCALE" }, { "name": "Ray.RAY_SCALE_rat_pos", "content": "theorem ...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra namespace Wad variable (w w' : Wad) end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r' : Ray) protected def toZMod : UInt128 := r protected def toR...
theorem toRat_mul (h₁ : w₁.1.val * wβ‚‚.1.val / Ray.RAY_SCALE < U128_MOD ): |SignedRay.toRat (w₁ * wβ‚‚) - SignedRay.toRat w₁ * SignedRay.toRat wβ‚‚| < 1 / Ray.RAY_SCALE :=
:= by rcases w₁ with ⟨w₁, sβ‚βŸ© rcases wβ‚‚ with ⟨wβ‚‚, sβ‚‚βŸ© rcases s₁ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> rcases sβ‚‚ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> dsimp only at h₁ <;> simp [mul_def, toRat, Ray.mul, Ray.toRat, Ray.toZMod, Nat.mod_eq_of_lt h₁, -one_div] <;> rw [Rat.nat_cast_div_eq, Nat.cast_mul, ZMod.natCast_val, ZMod.natCast_val, m...
2
43
false
Applied verif.
486
Wad.toRat_mul
theorem toRat_mul (h : w.toZMod.val * w'.toZMod.val / WAD_SCALE < U128_MOD) : |(w * w').toRat - w.toRat * w'.toRat| < 1 / WAD_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Int", "module": "Init.Data.Int.Basic" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.Basic" }...
[ { "name": "Wad.mul", "content": "protected def Wad.mul : Wad := (w.toZMod.val * w'.toZMod.val / WAD_SCALE : UInt128)" }, { "name": "", "content": "instance : Mul Wad := ⟨Wad.mul⟩" } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Wad.WAD_SCALE_pos", "content": "theorem WAD_SCALE_pos : 0 < WAD_SCALE" }, { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem ...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE
theorem toRat_mul (h : w.toZMod.val * w'.toZMod.val / WAD_SCALE < U128_MOD) : |(w * w').toRat - w.toRat * w'.toRat| < 1 / WAD_SCALE :=
:= by simp only [Wad.toRat, Wad.toZMod, Wad.mul_def, Int.natCast_natAbs] at * simp only [ZMod.val_natCast, ZMod.natCast_val] at * rw [Nat.mod_eq_of_lt h, div_mul_div_comm, ← div_div, ← sub_div, abs_div, Nat.abs_cast, div_lt_div_right WAD_SCALE_rat_pos, Rat.nat_cast_div_eq] simp only [Nat.cast_mul, ZMod.natC...
2
34
false
Applied verif.
487
Ray.toRat_mul
theorem toRat_mul (h : r.toZMod.val * r'.toZMod.val / RAY_SCALE < U128_MOD) : |(r * r').toRat - r.toRat * r'.toRat| < 1 / RAY_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.Basic" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs"...
[ { "name": "Ray.mul", "content": "protected def Ray.mul : Ray := (r.toZMod.val * r'.toZMod.val / RAY_SCALE : UInt128)" }, { "name": "", "content": "instance : Mul Ray := ⟨Ray.mul⟩" } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "Ray.toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray.toRat", "content": "protected...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Ray.RAY_SCALE_pos", "content": "theorem RAY_SCALE_pos : 0 < RAY_SCALE" }, { "name": "Ray.RAY_SCALE_rat_pos", "content": "theorem ...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra namespace Wad variable (w w' : Wad) end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r' : Ray) protected def toZMod : UInt128 := r protected def toR...
theorem toRat_mul (h : r.toZMod.val * r'.toZMod.val / RAY_SCALE < U128_MOD) : |(r * r').toRat - r.toRat * r'.toRat| < 1 / RAY_SCALE :=
:= by simp only [Ray.toRat, Ray.toZMod, Ray.mul_def] at * simp only [ZMod.val_natCast] rw [Nat.mod_eq_of_lt h, div_mul_div_comm, ← div_div, ← sub_div, abs_div, Nat.abs_cast, div_lt_div_right RAY_SCALE_rat_pos, Rat.nat_cast_div_eq] simp only [Nat.cast_mul, ZMod.val_natCast, sub_sub_cancel_left, abs_neg] rw...
2
31
false
Applied verif.
488
SignedWad.toRat_div
theorem toRat_div (h₁ : w₁.1.val * Wad.WAD_SCALE / wβ‚‚.1.val < U128_MOD) (hβ‚‚ : wβ‚‚.1.val β‰  0): |SignedWad.toRat (w₁ / wβ‚‚) - SignedWad.toRat w₁ / SignedWad.toRat wβ‚‚| < 1 / Wad.WAD_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.Basic" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs"...
[ { "name": "SignedWad.div", "content": "protected def SignedWad.div : SignedWad :=\n⟨Wad.div (w₁.1 : Wad) (wβ‚‚.1 : Wad), Bool.toSierraBool (Bool.xor (SierraBool.toBool w₁.2) (SierraBool.toBool wβ‚‚.2))⟩" }, { "name": "", "content": "instance : Div SignedWad := ⟨SignedWad.div⟩" } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" }, { "name": "Wad.WAD_SCALE_rat_ne_zero", "c...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE protected def div : ...
theorem toRat_div (h₁ : w₁.1.val * Wad.WAD_SCALE / wβ‚‚.1.val < U128_MOD) (hβ‚‚ : wβ‚‚.1.val β‰  0): |SignedWad.toRat (w₁ / wβ‚‚) - SignedWad.toRat w₁ / SignedWad.toRat wβ‚‚| < 1 / Wad.WAD_SCALE :=
:= by rcases w₁ with ⟨w₁, sβ‚βŸ© rcases wβ‚‚ with ⟨wβ‚‚, sβ‚‚βŸ© rcases s₁ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> rcases sβ‚‚ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> dsimp only at h₁ hβ‚‚ <;> simp [div_def, toRat, Wad.div, Wad.toRat, Wad.toZMod, Nat.mod_eq_of_lt h₁, -one_div] <;> rw [Rat.nat_cast_div_eq, Nat.cast_mul, ZMod.natCast_val, ZMod.natCast_val...
2
49
false
Applied verif.
489
SignedRay.toRat_div
theorem toRat_div (h₁ : w₁.1.val * Ray.RAY_SCALE / wβ‚‚.1.val < U128_MOD) (hβ‚‚ : wβ‚‚.1.val β‰  0): |SignedRay.toRat (w₁ / wβ‚‚) - SignedRay.toRat w₁ / SignedRay.toRat wβ‚‚| < 1 / Ray.RAY_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "SierraBool.toBool", "module": "Aegis.Aux.Bool" }, { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.B...
[ { "name": "SignedRay.div", "content": "protected def SignedRay.div : SignedRay :=\n⟨Ray.div (w₁.1 : Ray) (wβ‚‚.1 : Ray), Bool.toSierraBool (Bool.xor (SierraBool.toBool w₁.2) (SierraBool.toBool wβ‚‚.2))⟩" }, { "name": "", "content": "instance : Div SignedRay := ⟨SignedRay.div⟩" } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "Ray.toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray.toRat", "content": "protected...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Ray.RAY_SCALE_rat_pos", "content": "theorem RAY_SCALE_rat_pos : 0 < (RAY_SCALE : β„š)" }, { "name": "Ray.RAY_SCALE_rat_ne_zero", "c...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra namespace Wad variable (w w' : Wad) end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r' : Ray) protected def toZMod : UInt128 := r protected def toR...
theorem toRat_div (h₁ : w₁.1.val * Ray.RAY_SCALE / wβ‚‚.1.val < U128_MOD) (hβ‚‚ : wβ‚‚.1.val β‰  0): |SignedRay.toRat (w₁ / wβ‚‚) - SignedRay.toRat w₁ / SignedRay.toRat wβ‚‚| < 1 / Ray.RAY_SCALE :=
:= by rcases w₁ with ⟨w₁, sβ‚βŸ© rcases wβ‚‚ with ⟨wβ‚‚, sβ‚‚βŸ© rcases s₁ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> rcases sβ‚‚ with (⟨⟨⟩⟩|⟨⟨⟩⟩) <;> dsimp only at h₁ hβ‚‚ <;> simp [div_def, toRat, Ray.div, Ray.toRat, Ray.toZMod, Nat.mod_eq_of_lt h₁, -one_div] <;> rw [Rat.nat_cast_div_eq, Nat.cast_mul, ZMod.natCast_val, ZMod.natCast_val...
2
49
false
Applied verif.
490
Wad.toRat_nonneg
theorem toRat_nonneg : 0 ≀ w.toRat
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "NeZero", "module": "Init.Data.NeZero" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "ZMod.cast", "module": "Mathlib.Data.ZMod....
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_eq_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "NeZero.ne", "module": "Init.Data.NeZero" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "ZMod.cast_rat_nonneg", "content": "theorem ZMod.cast_rat_nonneg [NeZero n] (a : ZMod n) : 0 ≀ (a.cast : β„š)" }, { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" } ]
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE
theorem toRat_nonneg : 0 ≀ w.toRat :=
:= by simp [Wad.toRat] rw [le_div_iff WAD_SCALE_rat_pos, zero_mul] exact ZMod.cast_rat_nonneg (Wad.toZMod w)
2
14
false
Applied verif.
491
SignedWad.val_eq_of_toRat_eq
theorem val_eq_of_toRat_eq : w₁.toRat = wβ‚‚.toRat β†’ w₁.1 = wβ‚‚.1
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Function.Injective", "module": "Init.Data.Function" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "ZMod.val", "modu...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_lt", "module": "Mathlib.Data.Nat.Cast.Order.Basic" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "le_of_eq", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "ZMod.val_injective", "module": "Mathlib.D...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "ZMod.cast_rat_nonneg", "content": "theorem ZMod.cast_rat_nonneg [NeZero n] (a : ZMod n) : 0 ≀ (a.cast : β„š)" }, { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" }, { "name": "Wad.toRat_lt_toRat_of_val_lt_val", "content": "theor...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE end Wad def Ray : T...
theorem val_eq_of_toRat_eq : w₁.toRat = wβ‚‚.toRat β†’ w₁.1 = wβ‚‚.1 :=
:= by rcases w₁ with ⟨w₁, sβ‚βŸ© rcases wβ‚‚ with ⟨wβ‚‚, sβ‚‚βŸ© intro h cases s₁ <;> cases sβ‚‚ Β· have := Wad.toRat_injective h cases this rfl Β· simp only [toRat, SierraBool_toBool_inl, ite_false, SierraBool_toBool_inr, ite_true] at * have h' : Wad.toRat w₁ = 0 := by apply le_antisymm _ _ Β· rw [...
3
36
false
Applied verif.
492
SignedRay.val_eq_of_toRat_eq
theorem val_eq_of_toRat_eq : w₁.toRat = wβ‚‚.toRat β†’ w₁.1 = wβ‚‚.1
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "SierraBool.toBool", "module": "Aegis.Aux.Bool" }, { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Function.Injective", "module": "Init.Data.Function" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Sierra.U128_MOD...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_lt", "module": "Mathlib.Data.Nat.Cast.Order.Basic" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "le_of_eq", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "ZMod.val_injective", "module": "Mathlib.D...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 100000000000000000...
[ { "name": "ZMod.cast_rat_nonneg", "content": "theorem ZMod.cast_rat_nonneg [NeZero n] (a : ZMod n) : 0 ≀ (a.cast : β„š)" }, { "name": "Ray.RAY_SCALE_rat_pos", "content": "theorem RAY_SCALE_rat_pos : 0 < (RAY_SCALE : β„š)" }, { "name": "Ray.toRat_lt_toRat_of_val_lt_val", "content": "theor...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad variable (w w' : Wad) protected def toZMod : UInt128 := w end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r...
theorem val_eq_of_toRat_eq : w₁.toRat = wβ‚‚.toRat β†’ w₁.1 = wβ‚‚.1 :=
:= by rcases w₁ with ⟨w₁, sβ‚βŸ© rcases wβ‚‚ with ⟨wβ‚‚, sβ‚‚βŸ© intro h cases s₁ <;> cases sβ‚‚ Β· have := Ray.toRat_injective h cases this rfl Β· simp only [toRat, SierraBool_toBool_inl, ite_false, SierraBool_toBool_inr, ite_true] at * have h' : Ray.toRat w₁ = 0 := by apply le_antisymm _ _ Β· rw [...
3
37
false
Applied verif.
493
Ray.toRat_nonneg
theorem toRat_nonneg : 0 ≀ r.toRat
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "NeZero", "module": "Init.Data.NeZero" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "ZMod.cast", "module": "Mathlib.Data.ZMod....
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_eq_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "NeZero.ne", "module": "Init.Data.NeZero" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "Ray.toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray.toRat", "content": "protected...
[ { "name": "ZMod.cast_rat_nonneg", "content": "theorem ZMod.cast_rat_nonneg [NeZero n] (a : ZMod n) : 0 ≀ (a.cast : β„š)" }, { "name": "Ray.RAY_SCALE_rat_pos", "content": "theorem RAY_SCALE_rat_pos : 0 < (RAY_SCALE : β„š)" } ]
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra namespace Wad variable (w w' : Wad) end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r' : Ray) protected def toZMod : UInt128 := r protected def toR...
theorem toRat_nonneg : 0 ≀ r.toRat :=
:= by simp [Ray.toRat] rw [le_div_iff RAY_SCALE_rat_pos, zero_mul] exact ZMod.cast_rat_nonneg (Ray.toZMod r)
2
14
false
Applied verif.
494
Ray.toRat_div
theorem toRat_div (h : r.toZMod.val * RAY_SCALE / r'.toZMod.val < U128_MOD) (h' : r'.toZMod.val β‰  0) : |(r / r').toRat - r.toRat / r'.toRat| < 1 / RAY_SCALE
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Rat", "module": "Init.Data.Rat.Basic" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs"...
[ { "name": "Ray.div", "content": "protected def Ray.div : Ray := (r.toZMod.val * RAY_SCALE / r'.toZMod.val : UInt128)" }, { "name": "", "content": "instance : Div Ray := ⟨Ray.div⟩" } ]
[ { "name": "Nat.cast_div", "module": "Mathlib.Data.Nat.Cast.Field" }, { "name": "Nat.cast_ne_zero", "module": "Mathlib.Algebra.CharZero.Defs" }, { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.div_eq_sub_mod_div", "module": "Init.Data.Na...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "Ray.toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray.toRat", "content": "protected...
[ { "name": "Rat.nat_cast_div_eq", "content": "theorem Rat.nat_cast_div_eq {a b : β„•} :\n ↑(a / b) = (a : β„š) / (b : β„š) - ↑(a % b) / (b : β„š)" }, { "name": "Ray.RAY_SCALE_rat_pos", "content": "theorem RAY_SCALE_rat_pos : 0 < (RAY_SCALE : β„š)" }, { "name": "Ray.RAY_SCALE_rat_ne_zero", "c...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra namespace Wad variable (w w' : Wad) end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r' : Ray) protected def toZMod : UInt128 := r protected def toR...
theorem toRat_div (h : r.toZMod.val * RAY_SCALE / r'.toZMod.val < U128_MOD) (h' : r'.toZMod.val β‰  0) : |(r / r').toRat - r.toRat / r'.toRat| < 1 / RAY_SCALE :=
:= by have h'' : 0 < r'.toZMod.val := Nat.pos_of_ne_zero h' have h''' : (0 : β„š) < r'.toZMod.val := Nat.cast_pos.mpr h'' simp only [Ray.toRat, Ray.toZMod, Ray.div_def, ZMod.val_natCast] at * rw [Nat.mod_eq_of_lt h, Rat.nat_cast_div_eq, sub_div, Nat.cast_mul, div_div, mul_div_mul_right _ _ RAY_SCALE_rat_ne_ze...
2
34
false
Applied verif.
495
SignedWad.toRat_eq_zero_iff
theorem toRat_eq_zero_iff : w.toRat = 0 ↔ w.1 = 0
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "ZMod.cast_rat_eq_zero_iff", "module": "CorelibVerification.Aux.ZMod" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Wad.WAD_SCALE_pos", "content": "theorem WAD_SCALE_pos : 0 < WAD_SCALE" } ]
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE end Wad def Ray : T...
theorem toRat_eq_zero_iff : w.toRat = 0 ↔ w.1 = 0 :=
:= by have := Wad.WAD_SCALE_pos rcases w with ⟨w, (s|s)⟩ <;> cases s <;> simp only [SignedWad.toRat, Wad.toRat, Wad.toZMod] <;> aesop (add simp ZMod.cast_rat_eq_zero_iff)
2
11
false
Applied verif.
496
SignedRay.toRat_eq_zero_iff
theorem toRat_eq_zero_iff : w.toRat = 0 ↔ w.1 = 0
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "SierraBool.toBool", "module": "Aegis.Aux.Bool" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "ZMod.cast_rat_eq_zero_iff", "module": "CorelibVerification.Aux.ZMod" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Ray", "content": "def Ray : Type := UInt128" }, { "name": "Ray.RAY_SCALE", "content": "def RAY_SCALE : β„• := 1000000000000000000000000000" }, { "name": "Ray.toZMod", "content": "protected def toZMod : UInt128 := r" }, { "name": "Ray.toRat", "content": "protected...
[ { "name": "Ray.RAY_SCALE_pos", "content": "theorem RAY_SCALE_pos : 0 < RAY_SCALE" } ]
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra namespace Wad variable (w w' : Wad) end Wad def Ray : Type := UInt128 namespace Ray def RAY_SCALE : β„• := 1000000000000000000000000000 variable (r r' : Ray) protected def toZMod : UInt128 := r protected def toR...
theorem toRat_eq_zero_iff : w.toRat = 0 ↔ w.1 = 0 :=
:= by have := Ray.RAY_SCALE_pos rcases w with ⟨w, (s|s)⟩ <;> cases s <;> simp only [SignedRay.toRat, Ray.toRat, Ray.toZMod] <;> aesop (add simp ZMod.cast_rat_eq_zero_iff)
3
11
false
Applied verif.
497
SignedWad.val_eq_zero_of_toRat_neg
theorem val_eq_zero_of_toRat_neg (x : Wad) (p q : Unit) (h : SignedWad.toRat ((x, .inl p) : SignedWad) = SignedWad.toRat ((x, .inr q) : SignedWad)) : x = 0
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "Function.Injective", "module": "Init.Data.Function" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Sierra.U128_MOD", "module"...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_lt", "module": "Mathlib.Data.Nat.Cast.Order.Basic" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "le_of_eq", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "ZMod.val_injective", "module": "Mathlib.D...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" }, { "name": "Wad.toRat_lt_toRat_of_val_lt_val", "content": "theorem toRat_lt_toRat_of_val_lt_val (h : @ZMod.val U128_MOD w < @ZMod.val U128_MOD w') :\n w.toRat < w'.toRat" }, { "name": "Wa...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE end Wad def Ray : T...
theorem val_eq_zero_of_toRat_neg (x : Wad) (p q : Unit) (h : SignedWad.toRat ((x, .inl p) : SignedWad) = SignedWad.toRat ((x, .inr q) : SignedWad)) : x = 0 :=
:= by simp only [toRat, SierraBool_toBool_inl, ite_false, SierraBool_toBool_inr, ite_true, eq_neg_self_iff] at h rw [← Wad.toRat_zero] at h exact Wad.toRat_injective h
3
26
false
Applied verif.
498
SignedWad.val_eq_zero_of_toRat_neg'
theorem val_eq_zero_of_toRat_neg' (x : Wad) (p q : Unit) (h : SignedWad.toRat ((x, .inr p) : SignedWad) = SignedWad.toRat ((x, .inl q) : SignedWad)) : x = 0
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "Function.Injective", "module": "Init.Data.Function" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Sierra.U128_MOD", "module"...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_lt", "module": "Mathlib.Data.Nat.Cast.Order.Basic" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "le_of_eq", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "ZMod.val_injective", "module": "Mathlib.D...
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" }, { "name": "Wad.toRat_lt_toRat_of_val_lt_val", "content": "theorem toRat_lt_toRat_of_val_lt_val (h : @ZMod.val U128_MOD w < @ZMod.val U128_MOD w') :\n w.toRat < w'.toRat" }, { "name": "Wa...
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE end Wad def Ray : T...
theorem val_eq_zero_of_toRat_neg' (x : Wad) (p q : Unit) (h : SignedWad.toRat ((x, .inr p) : SignedWad) = SignedWad.toRat ((x, .inl q) : SignedWad)) : x = 0 :=
:= by simp only [toRat, SierraBool_toBool_inr, ite_true, SierraBool_toBool_inl, ite_false, neg_eq_self_iff] at h rw [← Wad.toRat_zero] at h exact Wad.toRat_injective h
3
26
false
Applied verif.
499
Wad.toRat_le_toRat_of_val_le_val
theorem toRat_le_toRat_of_val_le_val (h : @ZMod.val U128_MOD w ≀ @ZMod.val U128_MOD w') : w.toRat ≀ w'.toRat
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "ZMod.val", "module": "Mathlib.Data.ZMod.Basic" }, { "name": "Nat", "module": "Init...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_le", "module": "Mathlib.Data.Nat.Cast.Order.Basic" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "le_of_eq", "module": "Mathlib.Order.Defs.PartialOrder" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" } ]
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE
theorem toRat_le_toRat_of_val_le_val (h : @ZMod.val U128_MOD w ≀ @ZMod.val U128_MOD w') : w.toRat ≀ w'.toRat :=
:= by simp only [Wad.toRat] apply div_le_div Β· exact Nat.cast_nonneg (ZMod.val (Wad.toZMod w')) Β· rwa [Nat.cast_le] Β· exact WAD_SCALE_rat_pos Β· apply le_of_eq; rfl
2
12
false
Applied verif.
500
Wad.toRat_lt_toRat_of_val_lt_val
theorem toRat_lt_toRat_of_val_lt_val (h : @ZMod.val U128_MOD w < @ZMod.val U128_MOD w') : w.toRat < w'.toRat
wadray_verification
WadrayVerification/Aux.lean
[ "import Aegis.Aux.Bool", "import CorelibVerification.Aux.ZMod", "import Aegis.Aux.ZMod.DivMod" ]
[ { "name": "Sierra.UInt128", "module": "Aegis.Types" }, { "name": "Sierra.U128_MOD", "module": "Aegis.Types" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "ZMod.val", "module": "Mathlib.Data.ZMod.Basic" }, { "name": "Nat", "module": "Init...
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.cast_lt", "module": "Mathlib.Data.Nat.Cast.Order.Basic" }, { "name": "Nat.cast_nonneg", "module": "Mathlib.Data.Nat.Cast.Order.Ring" }, { "name": "le_of_eq", "module": "Mathlib.Order.Defs.PartialOrder" } ]
[ { "name": "List.getElem_append_left{Ξ±", "content": "theorem List.getElem_append_left{Ξ± : Type u_1} {l₁ lβ‚‚ : List Ξ±} {i : Nat} (hn : i < l₁.length) :\\n(l₁ ++ lβ‚‚)[i] = l₁[i]" } ]
[ { "name": "Wad", "content": "def Wad : Type := UInt128" }, { "name": "Wad.WAD_SCALE", "content": "def WAD_SCALE : β„• := 1000000000000000000" }, { "name": "Wad.toZMod", "content": "protected def toZMod : UInt128 := w" }, { "name": "Wad.toRat", "content": "protected def toRa...
[ { "name": "Wad.WAD_SCALE_rat_pos", "content": "theorem WAD_SCALE_rat_pos : 0 < (WAD_SCALE : β„š)" } ]
import CorelibVerification.Aux.ZMod import Aegis.Aux.Bool import Aegis.Aux.ZMod.DivMod open Sierra def Wad : Type := UInt128 namespace Wad def WAD_SCALE : β„• := 1000000000000000000 variable (w w' : Wad) protected def toZMod : UInt128 := w protected def toRat : β„š := w.toZMod.val / WAD_SCALE
theorem toRat_lt_toRat_of_val_lt_val (h : @ZMod.val U128_MOD w < @ZMod.val U128_MOD w') : w.toRat < w'.toRat :=
:= by simp only [Wad.toRat] apply div_lt_div Β· rwa [Nat.cast_lt, Wad.toZMod, Wad.toZMod] Β· apply le_of_eq; rfl Β· apply Nat.cast_nonneg Β· exact WAD_SCALE_rat_pos
2
12
false
Applied verif.