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. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.