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
101
Capless.SType.trename_id
theorem SType.trename_id {S : SType n m k} : S.trename FinFun.id = S := match S with | SType.top => by simp [SType.trename] | SType.tvar X => by simp [SType.trename, FinFun.id] | SType.forall E1 E2 => by have ih1 := CType.trename_id (T := E1) have ih2 := EType.trename_id (E := E2) simp [SType.tren...
capless-lean
Capless/Type/Basic.lean
[ "import Capless.Basic", "import Capless.Type.Renaming", "import Capless.Type.Core" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "SType", "content": "inductive SType : Nat -> Nat -> Nat -> Type where\n| top : SType n m k\n| tvar : Fin m -> SType n m k\n| forall : CType n m k -> EType (n+1) m k -> SType n m k\n| tforall : SType n m k -> EType n (m+1) k -> SType n m k\n| cforall : CBound n k -> EType n m (k+1) -> SType n m k\...
[ { "name": "...", "module": "" } ]
[ { "name": "FinFun.id_ext", "content": "theorem FinFun.id_ext :\n (FinFun.ext (n := n) id) = id" } ]
[]
[ { "name": "Capless.EType.trename_id", "content": "theorem EType.trename_id {E : EType n m k} :\n E.trename FinFun.id = E" }, { "name": "Capless.CType.trename_id", "content": "theorem CType.trename_id {T : CType n m k} :\n T.trename FinFun.id = T" } ]
import Capless.Type.Core import Capless.Type.Renaming namespace Capless end end end end end end end
theorem SType.trename_id {S : SType n m k} : S.trename FinFun.id = S :=
:= match S with | SType.top => by simp [SType.trename] | SType.tvar X => by simp [SType.trename, FinFun.id] | SType.forall E1 E2 => by have ih1 := CType.trename_id (T := E1) have ih2 := EType.trename_id (E := E2) simp [SType.trename, FinFun.id_ext, ih1, ih2] | SType.tforall S E => by have ih1 ...
4
16
false
Type systems
102
Capless.WellScoped.weaken
theorem WellScoped.weaken (h : WellScoped Γ cont Ct) : WellScoped (Γ.var T) cont.weaken Ct.weaken
capless-lean
Capless/Weakening/TypedCont/Term.lean
[ "import Capless.Type.Basic", "import Capless.Basic", "import Capless.Weakening.Typing", "import Capless.Weakening.Subtyping", "import Capless.CaptureSet", "import Capless.Weakening.Subcapturing", "import Capless.Store" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "CSubtyp.weaken", "content": "theorem CSubtyp.weaken\n (h : CSubtyp Γ E1 E2) :\n CSubtyp (Γ.var T) E1.weaken E2.weaken" }, { "name": "SSubtyp.weaken", "content": "theorem SSubtyp.weaken\n (h : SSubtyp Γ S1 S2) :\n ∀ b, SSubtyp (Γ.var b) S1.weaken S2.weaken" }, { "name": "Su...
[]
[ { "name": "Capless.EType.weaken1_weaken", "content": "theorem EType.weaken1_weaken (E : EType n m k) :\n E.weaken.weaken1 = E.weaken.weaken" }, { "name": "Capless.CaptureSet.weaken1_weaken", "content": "theorem CaptureSet.weaken1_weaken (C : CaptureSet n k) :\n C.weaken.weaken1 = C.weaken.weak...
import Capless.Store import Capless.Weakening.Typing import Capless.Weakening.Subtyping import Capless.Weakening.Subcapturing namespace Capless
theorem WellScoped.weaken (h : WellScoped Γ cont Ct) : WellScoped (Γ.var T) cont.weaken Ct.weaken :=
:= by induction h case empty => simp [CaptureSet.weaken]; constructor case union ih1 ih2 => simp [CaptureSet.weaken] at * apply union <;> aesop case singleton hb _ ih => apply singleton { simp [FinFun.weaken] have hb1 := Context.Bound.there_var (E':=T) hb simp [CType.weaken, CType.re...
6
128
false
Type systems
103
Capless.WellScoped.lweaken
theorem WellScoped.lweaken (h : WellScoped Γ cont Ct) : WellScoped (Γ.label S) cont.weaken Ct.weaken
capless-lean
Capless/Weakening/TypedCont/Term.lean
[ "import Capless.Type.Basic", "import Capless.Basic", "import Capless.Weakening.Typing", "import Capless.Weakening.Subtyping", "import Capless.CaptureSet", "import Capless.Weakening.Subcapturing", "import Capless.Store" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "CSubtyp.weaken", "content": "theorem CSubtyp.weaken\n (h : CSubtyp Γ E1 E2) :\n CSubtyp (Γ.var T) E1.weaken E2.weaken" }, { "name": "SSubtyp.weaken", "content": "theorem SSubtyp.weaken\n (h : SSubtyp Γ S1 S2) :\n ∀ b, SSubtyp (Γ.var b) S1.weaken S2.weaken" }, { "name": "Su...
[]
[ { "name": "Capless.EType.weaken1_weaken", "content": "theorem EType.weaken1_weaken (E : EType n m k) :\n E.weaken.weaken1 = E.weaken.weaken" }, { "name": "Capless.CaptureSet.weaken1_weaken", "content": "theorem CaptureSet.weaken1_weaken (C : CaptureSet n k) :\n C.weaken.weaken1 = C.weaken.weak...
import Capless.Store import Capless.Weakening.Typing import Capless.Weakening.Subtyping import Capless.Weakening.Subcapturing namespace Capless
theorem WellScoped.lweaken (h : WellScoped Γ cont Ct) : WellScoped (Γ.label S) cont.weaken Ct.weaken :=
:= by induction h case empty => simp [CaptureSet.weaken]; constructor case union ih1 ih2 => simp [CaptureSet.weaken] at * apply union <;> aesop case singleton hb _ ih => apply singleton { simp [FinFun.weaken] have hb1 := Context.Bound.there_label (S:=S) hb simp [CaptureSet.weaken, Ca...
7
140
false
Type systems
104
Capless.Typed.var_inv'
theorem Typed.var_inv' (he1 : t0 = Term.var x) (he2 : E0 = EType.type T) (h : Typed Γ t0 E0 Ct0) (hb : Γ.Bound x T0) : ∃ C0 S0, Γ.Bound x (S0^C0) ∧ (Γ ⊢ (S0^{x=x}) <: T)
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing", "import Capless.Inversion.Context" ]
[ { "name": "Exists", "module": "Init.Core" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:50 Γ \" ⊢ \" E1 \" <:e \" E2 => ESubtyp Γ E1 E2", "content": "notation:50 Γ \" ⊢ \" E1 \" <:e \" E2 => ESubtyp Γ E1 E2" }, { "name": "notation:50 Γ \" ⊢ \" T1 \" <:s \" T2 => SSubtyp Γ T1 T2", "content": "notation:50 Γ \" ⊢ \" T1 \" <:s \" T2 => SSubtyp Γ T1 T2" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "ESubtyp.sub_type_inv'", "content": "theorem ESubtyp.sub_type_inv'\n (he : E2 = EType.type T2)\n (h : ESubtyp Γ E1 E2) :\n ∃ T1, E1 = EType.type T1 ∧ CSubtyp Γ T1 T2" }, { "name": "Context.bound_lbound_absurd", "content": "theorem Context.bound_lbound_absurd\n (hb1 : Context.Bound ...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.var_inv' (he1 : t0 = Term.var x) (he2 : E0 = EType.type T) (h : Typed Γ t0 E0 Ct0) (hb : Γ.Bound x T0) : ∃ C0 S0, Γ.Bound x (S0^C0) ∧ (Γ ⊢ (S0^{x=x}) <: T) :=
:= by induction h <;> try (solve | cases he1 | cases he2) case var C0 S0 hb => cases he1; cases he2 apply Exists.intro C0 apply Exists.intro S0 constructor { trivial } { apply CSubtyp.refl } case label hbl => exfalso cases he1 apply Context.bound_lbound_absurd hb hbl case sub...
7
58
false
Type systems
105
Capless.Context.bound_lbound_absurd
theorem Context.bound_lbound_absurd (hb1 : Context.Bound Γ x T) (hb2 : Context.LBound Γ x S) : False
capless-lean
Capless/Inversion/Context.lean
[ "import Capless.Context", "import Capless.Store" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "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": "Capless.Context.var_lbound_succ_inv'", "content": "theorem Context.var_lbound_succ_inv'\n (he1 : Γ0 = Γ.var T) (he2 : x0 = x.succ)\n (hb : Context.LBound Γ0 x0 S) :\n ∃ S0, Context.LBound Γ x S0 ∧ S = S0.weaken" }, { "name": "Capless.Context.var_lbound_succ_inv", "content": "theore...
import Capless.Context import Capless.Store namespace Capless
theorem Context.bound_lbound_absurd (hb1 : Context.Bound Γ x T) (hb2 : Context.LBound Γ x S) : False :=
:= by induction Γ case empty => cases hb1 case var ih => cases hb1 case here => cases hb2 case there_var => have ⟨_, _, _⟩ := Context.var_lbound_succ_inv hb2 apply! ih case tvar ih => cases hb1; cases hb2 apply ih <;> assumption case cvar ih => cases hb1; cases hb2 ...
6
44
false
Type systems
106
Capless.Typing.inv_subcapt'
theorem Typing.inv_subcapt' (he1 : t0 = Term.var x) (he2 : E0 = EType.type (CType.capt C S)) (h : Typed Γ t0 E0 C0) : Subcapt Γ {x=x} C
capless-lean
Capless/Typing/Basic.lean
[ "import Capless.Subcapturing", "import Capless.Subcapturing.Basic", "import Capless.Typing", "import Capless.Subtyping.Basic" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "abs", "module": "Mathlib.Algebra.Order.Group.Unbundled.Abs" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "ESubtyp.type_inv_subcapt", "content": "theorem ESubtyp.type_inv_subcapt\n (h : ESubtyp Γ E (EType.type (CType.capt C S))) :\n ∃ C0 S0, E = EType.type (CType.capt C0 S0) ∧ Subcapt Γ C0 C" }, { "name": "ESubtyp.type_inv_subcapt'", "content": "theorem ESubtyp.type_inv_subcapt'\n (heq ...
[]
[]
import Capless.Typing import Capless.Subcapturing import Capless.Subcapturing.Basic import Capless.Subtyping.Basic namespace Capless
theorem Typing.inv_subcapt' (he1 : t0 = Term.var x) (he2 : E0 = EType.type (CType.capt C S)) (h : Typed Γ t0 E0 C0) : Subcapt Γ {x=x} C :=
:= by induction h <;> try (solve | cases he1 | cases he2) case var => cases he1; cases he2 apply Subcapt.refl case label => cases he1; cases he2 apply Subcapt.refl case sub hsub ih => subst he1 he2 have h := ESubtyp.type_inv_subcapt hsub let ⟨C0, S0, he, hs⟩ := h subst he hav...
5
24
false
Type systems
107
Capless.Typed.tapp_inv'
theorem Typed.tapp_inv' (he : t0 = Term.tapp x X) (h : Typed Γ t0 E Ct) : ∃ Cf F E0, Typed Γ (Term.var x) (EType.type (CType.capt Cf (SType.tforall (SType.tvar X) F))) {x=x} ∧ E0 = F.topen X ∧ ESubtyp Γ E0 E
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Renaming.Capture.Typing", "import Capless.Renaming.Term.Typing", "import Capless.Renaming.Term.Subtyping", "import Capless.Renaming.Type.Subcapturing", "import Capless.Inversion.Subtyping", "import Capless.Renaming.Term.Subcapturing", "import Caples...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "And", "module": "Init.Prelude" }, { "name": "Exists", "module": "Init.Core" } ]
[ { "name": "notation:50 Γ \" ⊢ \" E1 \" <:e \" E2 => ESubtyp Γ E1 E2", "content": "notation:50 Γ \" ⊢ \" E1 \" <:e \" E2 => ESubtyp Γ E1 E2" }, { "name": "notation:50 Γ \" ⊢ \" T1 \" <:s \" T2 => SSubtyp Γ T1 T2", "content": "notation:50 Γ \" ⊢ \" T1 \" <:s \" T2 => SSubtyp Γ T1 T2" }, { ...
[ { "name": "...", "module": "" } ]
[ { "name": "Typed.topen", "content": "theorem Typed.topen\n (h : Typed (Γ,X<: (SType.tvar X)) t E Ct) :\n Typed Γ (t.topen X) (E.topen X) Ct" }, { "name": "Typed.tsubst", "content": "theorem Typed.tsubst\n {Γ : Context n m k} {Δ : Context n m' k}\n (h : Typed Γ t E Ct)\n (σ : TVarSubst Γ f Δ...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.tapp_inv' (he : t0 = Term.tapp x X) (h : Typed Γ t0 E Ct) : ∃ Cf F E0, Typed Γ (Term.var x) (EType.type (CType.capt Cf (SType.tforall (SType.tvar X) F))) {x=x} ∧ E0 = F.topen X ∧ ESubtyp Γ E0 E :=
:= by induction h <;> try (solve | cases he) case tapp => cases he repeat (apply Exists.intro) apply And.intro { trivial } apply And.intro { trivial } { apply ESubtyp.refl } case sub hs ih => have ih := ih he have ⟨Cf, F, E0, hx, he0, hs0⟩ := ih have h := ESubtyp.trans hs0 ...
6
166
false
Type systems
108
Capless.Typed.capp_inv'
theorem Typed.capp_inv' (he : t0 = Term.capp x c) (h : Typed Γ t0 E Ct0) : ∃ Cf F E0, Typed Γ (Term.var x) (EType.type (CType.capt Cf (SType.cforall (CBound.upper {c=c}) F))) {x=x} ∧ E0 = F.copen c ∧ ESubtyp Γ E0 E
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Renaming.Capture.Typing", "import Capless.Renaming.Term.Typing", "import Capless.Renaming.Term.Subtyping", "import Capless.Renaming.Type.Subcapturing", "import Capless.Inversion.Subtyping", "import Capless.Renaming.Term.Subcapturing", "import Caples...
[ { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "And", "module": "Init.Prelude" }, { "name": "Exists", "module": "Init.Core" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "Typed.copen", "content": "theorem Typed.copen\n (h : Typed (Γ,c<:CBound.upper {c=c}) t E Ct) :\n Typed Γ (t.copen c) (E.copen c) (Ct.copen c)" }, { "name": "Typed.csubst", "content": "theorem Typed.csubst\n {Γ : Context n m k} {Δ : Context n m k'}\n (h : Typed Γ t E Ct)\n (σ : CV...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.capp_inv' (he : t0 = Term.capp x c) (h : Typed Γ t0 E Ct0) : ∃ Cf F E0, Typed Γ (Term.var x) (EType.type (CType.capt Cf (SType.cforall (CBound.upper {c=c}) F))) {x=x} ∧ E0 = F.copen c ∧ ESubtyp Γ E0 E :=
:= by induction h <;> try (solve | cases he) case capp => cases he repeat (apply Exists.intro) apply And.intro { trivial } apply And.intro { trivial } { apply ESubtyp.refl } case sub hs ih => have ih := ih he have ⟨Cf, F, E0, hx, he0, hs0⟩ := ih have h := ESubtyp.trans hs0 ...
6
167
false
Type systems
109
Capless.Typed.boundary_inv'
theorem Typed.boundary_inv' {Γ : Context n m k} {S : SType n m k} (he : t0 = (boundary:S in t)) (ht : Typed Γ t0 E Ct) : Typed ((Γ,c<:*),x: Label[S.cweaken]^{c=0}) t (S.cweaken.weaken^{}) (Ct.cweaken.weaken ∪ {c=0} ∪ {x=0}) ∧ (Γ ⊢ (S^{}) <:e E)
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Weakening.Typing", "import Capless.Weakening.Subtyping", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing"...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "ESubtyp.cweaken", "content": "theorem ESubtyp.cweaken\n (h : ESubtyp Γ E1 E2) :\n ESubtyp (Γ.cvar b) E1.cweaken E2.cweaken" }, { "name": "CSubtyp.weaken", "content": "theorem CSubtyp.weaken\n (h : CSubtyp Γ E1 E2) :\n CSubtyp (Γ.var T) E1.weaken E2.weaken" }, { "name": "SS...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.boundary_inv' {Γ : Context n m k} {S : SType n m k} (he : t0 = (boundary:S in t)) (ht : Typed Γ t0 E Ct) : Typed ((Γ,c<:*),x: Label[S.cweaken]^{c=0}) t (S.cweaken.weaken^{}) (Ct.cweaken.weaken ∪ {c=0} ∪ {x=0}) ∧ (Γ ⊢ (S^{}) <:e E) :=
:= by induction ht <;> try (solve | cases he) case boundary => cases he split_and { easy } { apply ESubtyp.refl } case sub hsc hsub ih => have ⟨ih, hsub0⟩ := ih he split_and { apply Typed.sub { exact ih } { apply Subcapt.join; apply Subcapt.join all_goals try apply ...
3
89
false
Type systems
110
Capless.WellScoped.subcapt
theorem WellScoped.subcapt (hsc : WellScoped Γ cont C) (hs : Γ ⊢ C' <:c C) : WellScoped Γ cont C'
capless-lean
Capless/WellScoped/Basic.lean
[ "import Capless.Subcapturing", "import Capless.Store", "import Capless.Inversion.Context" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "macro \"easy\" : tactic => `(tactic| assumption)", "content": "macro \"easy\" : tactic => `(tactic| assumption)" }, { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:ma...
[ { "name": "trans", "module": "Mathlib.Order.Defs.Unbundled" } ]
[ { "name": "Context.cbound_injective", "content": "theorem Context.cbound_injective\n (hb1 : Context.CBound Γ c b1)\n (hb2 : Context.CBound Γ c b2) : b1 = b2" }, { "name": "Context.cvar_cbound_succ_inv", "content": "theorem Context.cvar_cbound_succ_inv\n (hb : Context.CBound (Γ.cvar p) (Fin.su...
[]
[ { "name": "Capless.WellScoped.subset", "content": "theorem WellScoped.subset\n (hsc : WellScoped Γ cont C)\n (hs : C' ⊆ C) :\n WellScoped Γ cont C'" } ]
import Capless.Store import Capless.Subcapturing import Capless.Inversion.Context namespace Capless
theorem WellScoped.subcapt (hsc : WellScoped Γ cont C) (hs : Γ ⊢ C' <:c C) : WellScoped Γ cont C' :=
:= by induction hs generalizing cont case trans => aesop case subset => apply WellScoped.subset <;> easy case union => apply union <;> aesop case var => apply WellScoped.singleton <;> aesop case cinstl => cases hsc rename_i hb1 _ _ hb2 have h := Context.cbound_injective hb1 hb2 cases h r...
6
50
false
Type systems
111
Capless.Typed.letin_inv'
theorem Typed.letin_inv' {Γ : Context n m k} (he : t0 = Term.letin t u) (h : Typed Γ t0 E Ct0) : ∃ T E0, Typed Γ t (EType.type T) Ct0 ∧ Typed (Γ.var T) u E0.weaken Ct0.weaken ∧ ESubtyp Γ E0 E
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Weakening.Typing", "import Capless.Weakening.Subtyping", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing"...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "Exists", "module": "Init.Core" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "CSubtyp.weaken", "content": "theorem CSubtyp.weaken\n (h : CSubtyp Γ E1 E2) :\n CSubtyp (Γ.var T) E1.weaken E2.weaken" }, { "name": "SSubtyp.weaken", "content": "theorem SSubtyp.weaken\n (h : SSubtyp Γ S1 S2) :\n ∀ b, SSubtyp (Γ.var b) S1.weaken S2.weaken" }, { "name": "Su...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.letin_inv' {Γ : Context n m k} (he : t0 = Term.letin t u) (h : Typed Γ t0 E Ct0) : ∃ T E0, Typed Γ t (EType.type T) Ct0 ∧ Typed (Γ.var T) u E0.weaken Ct0.weaken ∧ ESubtyp Γ E0 E :=
:= by induction h <;> try (solve | cases he) case letin => cases he repeat apply Exists.intro constructor; trivial constructor; trivial apply ESubtyp.refl case sub hs ih => have ih := ih he obtain ⟨T, E0, ht, hu, hs0⟩ := ih have hs1 := ESubtyp.trans hs0 hs repeat apply Exists.i...
3
64
false
Type systems
112
Capless.Typed.label_inv'
theorem Typed.label_inv' (he1 : t0 = Term.var x) (he2 : E0 = EType.type T) (ht : Typed Γ t0 E0 Ct) (hb : Γ.LBound x S1) : ∃ S0, Γ.LBound x S0 ∧ (Γ ⊢ (Label[S0]^{x=x}) <: T)
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing", "import Capless.Inversion.Context" ]
[ { "name": "Exists", "module": "Init.Core" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "Context.bound_lbound_absurd", "content": "theorem Context.bound_lbound_absurd\n (hb1 : Context.Bound Γ x T)\n (hb2 : Context.LBound Γ x S) : False" }, { "name": "Context.label_lbound_succ_inv", "content": "theorem Context.label_lbound_succ_inv\n (hb : Context.LBound (Γ.label l) x.s...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.label_inv' (he1 : t0 = Term.var x) (he2 : E0 = EType.type T) (ht : Typed Γ t0 E0 Ct) (hb : Γ.LBound x S1) : ∃ S0, Γ.LBound x S0 ∧ (Γ ⊢ (Label[S0]^{x=x}) <: T) :=
:= by induction ht <;> try (solve | cases he1 | cases he2) case var hb0 => cases he1; cases he2 exfalso apply! Context.bound_lbound_absurd case label hb0 => cases he1; cases he2 apply Exists.intro; apply And.intro { exact hb0 } { apply CSubtyp.refl } case sub hsub ih => cases he1...
3
52
false
Type systems
113
Capless.WellScoped.cweaken
theorem WellScoped.cweaken (h : WellScoped Γ E Ct) : WellScoped (Γ.cvar b) E.cweaken Ct.cweaken
capless-lean
Capless/Weakening/TypedCont/Capture.lean
[ "import Capless.Type.Basic", "import Capless.Basic", "import Capless.Weakening.Typing", "import Capless.Weakening.Subtyping", "import Capless.CaptureSet", "import Capless.Weakening.Subcapturing", "import Capless.Store" ]
[ { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "Nat", "module": "Init.Prelude" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "CSubtyp.weaken", "content": "theorem CSubtyp.weaken\n (h : CSubtyp Γ E1 E2) :\n CSubtyp (Γ.var T) E1.weaken E2.weaken" }, { "name": "SSubtyp.weaken", "content": "theorem SSubtyp.weaken\n (h : SSubtyp Γ S1 S2) :\n ∀ b, SSubtyp (Γ.var b) S1.weaken S2.weaken" }, { "name": "Su...
[]
[ { "name": "Capless.EType.cweaken_ex", "content": "theorem EType.cweaken_ex (T : CType n m (k+1)) :\n (EType.ex T).cweaken = EType.ex T.cweaken1" }, { "name": "Capless.EType.cweaken_weaken", "content": "theorem EType.cweaken_weaken (E : EType n m k) :\n E.weaken.cweaken = E.cweaken.weaken" },...
import Capless.Store import Capless.Weakening.Typing import Capless.Weakening.Subtyping import Capless.Weakening.Subcapturing namespace Capless
theorem WellScoped.cweaken (h : WellScoped Γ E Ct) : WellScoped (Γ.cvar b) E.cweaken Ct.cweaken :=
:= by induction h case empty => constructor case union ih1 ih2 => apply union <;> aesop case singleton hb _ ih => apply singleton { have hb1 := Context.Bound.there_cvar (b := b) hb simp [CType.cweaken, CType.crename] at hb1 exact hb1 } { exact ih } case csingleton hb _ ih => apply ...
5
118
false
Type systems
114
Capless.WellScoped.tweaken
theorem WellScoped.tweaken (h : WellScoped Γ cont Ct) : WellScoped (Γ.tvar b) cont.tweaken Ct
capless-lean
Capless/Weakening/TypedCont/Type.lean
[ "import Capless.Type.Basic", "import Capless.Weakening.Typing", "import Capless.Weakening.Subcapturing", "import Capless.Store", "import Capless.Weakening.Subtyping" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:50 \"λ[X<:\" S \"]\" t => Term.tlam S t", "content": "notation:50 \"λ[X<:\" S \"]\" t => Term.tlam S t" }, { "name": "notation:40 \"let\" \"x=\" t \" in \" u => Term.letin t u", "content": "notation:40 \"let\" \"x=\" t \" in \" u => Term.letin t u" }, { "name": "notat...
[ { "name": "...", "module": "" } ]
[ { "name": "CSubtyp.weaken", "content": "theorem CSubtyp.weaken\n (h : CSubtyp Γ E1 E2) :\n CSubtyp (Γ.var T) E1.weaken E2.weaken" }, { "name": "Subbound.tweaken", "content": "theorem Subbound.tweaken\n (h : Subbound Γ B1 B2) :\n Subbound (Γ.tvar b) B1 B2" }, { "name": "Subbound.weake...
[]
[ { "name": "Capless.EType.tweaken_ex", "content": "theorem EType.tweaken_ex (T : CType n m (k+1)) :\n (EType.ex T).tweaken = EType.ex T.tweaken" }, { "name": "Capless.EType.tweaken_weaken", "content": "theorem EType.tweaken_weaken (E : EType n m k) :\n E.weaken.tweaken = E.tweaken.weaken" }, ...
import Capless.Store import Capless.Weakening.Typing import Capless.Weakening.Subtyping import Capless.Weakening.Subcapturing namespace Capless
theorem WellScoped.tweaken (h : WellScoped Γ cont Ct) : WellScoped (Γ.tvar b) cont.tweaken Ct :=
:= by induction h case empty => constructor case union ih1 ih2 => apply union <;> aesop case singleton hb _ ih => apply singleton { have hb1 := Context.Bound.there_tvar (b := b) hb simp [CType.tweaken, CType.trename] at hb1 exact hb1 } { exact ih } case csingleton hb _ ih => apply ...
5
125
false
Type systems
115
Capless.Typed.forall_inv'
theorem Typed.forall_inv' {v : Term n m k} (ht : Γ.IsTight) (hd : SType.Dealias Γ S0 (SType.forall T E)) (he : E0 = EType.type (CType.capt Cv S0)) (hv : v.IsValue) (ht : Typed Γ v E0 Ct) : ∃ T0 t, v = Term.lam T0 t
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing", "import Capless.Inversion.Context" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:50 \"∀(x:\" T \")\" U => SType.forall T U", "content": "notation:50 \"∀(x:\" T \")\" U => SType.forall T U" }, { "name": "notation:50 \"∀[c<:\" B \"]\" T => SType.cforall B T", "content": "notation:50 \"∀[c<:\" B \"]\" T => SType.cforall B T" }, { "name": "notation:50...
[ { "name": "...", "module": "" } ]
[ { "name": "SSubtyp.dealias_right_forall", "content": "theorem SSubtyp.dealias_right_forall\n (h : SSubtyp Γ S1 S2) (ht : Γ.IsTight)\n (hd : SType.Dealias Γ S2 (SType.forall T2 E2)) :\n ∃ T1 E1, SType.Dealias Γ S1 (SType.forall T1 E1)" } ]
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.forall_inv' {v : Term n m k} (ht : Γ.IsTight) (hd : SType.Dealias Γ S0 (SType.forall T E)) (he : E0 = EType.type (CType.capt Cv S0)) (hv : v.IsValue) (ht : Typed Γ v E0 Ct) : ∃ T0 t, v = Term.lam T0 t :=
:= by induction ht <;> try (solve | cases hv | cases he | cases hv; cases he; cases hd) case sub hsub ih => subst he cases hsub rename_i hsub cases hsub rename_i hsc hss have ⟨T1, E1, hd1⟩ := SSubtyp.dealias_right_forall hss ht hd aesop case abs => aesop
4
28
false
Type systems
116
Capless.Typed.tforall_inv'
theorem Typed.tforall_inv' {v : Term n m k} (ht : Γ.IsTight) (hd : SType.Dealias Γ S0 (SType.tforall X E)) (he : E0 = EType.type (CType.capt Cv S0)) (hv : v.IsValue) (ht : Typed Γ v E0 Ct) : ∃ X t, v = Term.tlam X t
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing", "import Capless.Inversion.Context" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:50 \"∀(x:\" T \")\" U => SType.forall T U", "content": "notation:50 \"∀(x:\" T \")\" U => SType.forall T U" }, { "name": "notation:50 \"∀[c<:\" B \"]\" T => SType.cforall B T", "content": "notation:50 \"∀[c<:\" B \"]\" T => SType.cforall B T" }, { "name": "notation:50...
[ { "name": "...", "module": "" } ]
[ { "name": "SSubtyp.dealias_right_tforall", "content": "theorem SSubtyp.dealias_right_tforall\n (h : SSubtyp Γ S1 S2) (ht : Γ.IsTight)\n (hd : SType.Dealias Γ S2 (SType.tforall T2 E2)) :\n ∃ T1 E1, SType.Dealias Γ S1 (SType.tforall T1 E1)" } ]
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.tforall_inv' {v : Term n m k} (ht : Γ.IsTight) (hd : SType.Dealias Γ S0 (SType.tforall X E)) (he : E0 = EType.type (CType.capt Cv S0)) (hv : v.IsValue) (ht : Typed Γ v E0 Ct) : ∃ X t, v = Term.tlam X t :=
:= by induction ht <;> try (solve | cases hv | cases he | cases hv; cases he; cases hd) case sub hsub ih => subst he cases hsub rename_i hsub cases hsub rename_i hsc hss have ⟨T1, E1, hd1⟩ := SSubtyp.dealias_right_tforall hss ht hd aesop case tabs => aesop
4
28
false
Type systems
117
Capless.Typed.cforall_inv'
theorem Typed.cforall_inv' {v : Term n m k} (ht : Γ.IsTight) (hd : SType.Dealias Γ S0 (SType.cforall B E)) (he : E0 = EType.type (CType.capt Cv S0)) (hv : v.IsValue) (ht : Typed Γ v E0 Ct) : ∃ B0 t, v = Term.clam B0 t
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Tactics", "import Capless.Typing", "import Capless.Subtyping.Basic", "import Capless.Inversion.Subtyping", "import Capless.Narrowing", "import Capless.Weakening.Subcapturing", "import Capless.Inversion.Context" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:50 \"∀(x:\" T \")\" U => SType.forall T U", "content": "notation:50 \"∀(x:\" T \")\" U => SType.forall T U" }, { "name": "notation:50 \"∀[c<:\" B \"]\" T => SType.cforall B T", "content": "notation:50 \"∀[c<:\" B \"]\" T => SType.cforall B T" }, { "name": "notation:50...
[ { "name": "...", "module": "" } ]
[ { "name": "SSubtyp.dealias_right_cforall", "content": "theorem SSubtyp.dealias_right_cforall\n (h : SSubtyp Γ S1 S2) (ht : Γ.IsTight)\n (hd : SType.Dealias Γ S2 (SType.cforall B2 E2)) :\n ∃ B1 E1, SType.Dealias Γ S1 (SType.cforall B1 E1)" } ]
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.cforall_inv' {v : Term n m k} (ht : Γ.IsTight) (hd : SType.Dealias Γ S0 (SType.cforall B E)) (he : E0 = EType.type (CType.capt Cv S0)) (hv : v.IsValue) (ht : Typed Γ v E0 Ct) : ∃ B0 t, v = Term.clam B0 t :=
:= by induction ht <;> try (solve | cases hv | cases he | cases hv; cases he; cases hd) case sub hsub ih => subst he cases hsub rename_i hsub cases hsub rename_i hsc hss have ⟨E1, hd1⟩ := SSubtyp.dealias_right_cforall hss ht hd aesop case cabs => aesop
4
28
false
Type systems
118
Capless.Context.tight_bound_tvar_absurd
theorem Context.tight_bound_tvar_absurd (ht : Context.IsTight Γ) (hb : Context.TBound Γ X (TBinding.bound S)) : False
capless-lean
Capless/Inversion/Context.lean
[ "import Capless.Context", "import Capless.Store" ]
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "Exists", "module": "Init.Core" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "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": "Capless.Context.var_tbound_inv'", "content": "theorem Context.var_tbound_inv'\n (he : Γ0 = Γ.var P)\n (hb : Context.TBound Γ0 X b) :\n ∃ b0, Context.TBound Γ X b0 ∧ b = b0.weaken" }, { "name": "Capless.Context.var_tbound_inv", "content": "theorem Context.var_tbound_inv\n (hb : Con...
import Capless.Context import Capless.Store namespace Capless
theorem Context.tight_bound_tvar_absurd (ht : Context.IsTight Γ) (hb : Context.TBound Γ X (TBinding.bound S)) : False :=
:= by induction ht case empty => cases hb case var ih => have ⟨S0, hb0, he0⟩ := Context.var_tbound_inv_bound hb aesop case tvar => have ⟨X0, S0, hb0, hs0, hx0⟩ := Context.tinst_tbound_bound_inv hb aesop case cvar => have ⟨S0, hb0, he0⟩ := Context.cvar_tbound_inv_bound hb aesop case l...
5
83
false
Type systems
119
Capless.Typed.canonical_form_pack'
theorem Typed.canonical_form_pack' (ht : Γ.IsTight) (he1 : t0 = Term.pack C x) (he2 : E0 = EType.ex T) (h : Typed Γ t0 E0 Ct) : Typed (Γ.cvar (CBinding.inst C)) (Term.var x) (EType.type T) {x=x}
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Renaming.Capture.Typing", "import Capless.Renaming.Term.Typing", "import Capless.Renaming.Term.Subtyping", "import Capless.Renaming.Type.Subcapturing", "import Capless.Inversion.Subtyping", "import Capless.Renaming.Term.Subcapturing", "import Caples...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" } ]
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "CSubtyp.cinstantiate", "content": "theorem CSubtyp.cinstantiate {Γ : Context n m k}\n (h : CSubtyp (Γ.cvar (CBinding.bound CBound.star)) T1 T2) :\n CSubtyp (Γ.cvar (CBinding.inst C)) T1 T2" }, { "name": "CSubtyp.csubst", "content": "theorem CSubtyp.csubst\n (h : CSubtyp Γ T1 T2)\n ...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.canonical_form_pack' (ht : Γ.IsTight) (he1 : t0 = Term.pack C x) (he2 : E0 = EType.ex T) (h : Typed Γ t0 E0 Ct) : Typed (Γ.cvar (CBinding.inst C)) (Term.var x) (EType.type T) {x=x} :=
:= by induction h <;> try (solve | cases he1 | cases he2) case pack => cases he1; cases he2 trivial case sub hs ih => subst he2 cases hs rename_i hs have ih := ih ht he1 rfl apply Typed.sub exact ih apply Subcapt.refl constructor apply hs.cinstantiate
6
167
false
Type systems
120
Capless.Typed.app_inv'
theorem Typed.app_inv' (he : t0 = Term.app x y) (h : Typed Γ t0 E Ct0) : ∃ T Cf F E0, Typed Γ (Term.var x) (EType.type (CType.capt Cf (SType.forall T F))) {x=x} ∧ Typed Γ (Term.var y) (EType.type T) {x=y} ∧ E0 = F.open y ∧ ESubtyp Γ E0 E
capless-lean
Capless/Inversion/Typing.lean
[ "import Capless.Subcapturing.Basic", "import Capless.Renaming.Capture.Typing", "import Capless.Renaming.Term.Typing", "import Capless.Renaming.Term.Subtyping", "import Capless.Renaming.Type.Subcapturing", "import Capless.Inversion.Subtyping", "import Capless.Renaming.Term.Subcapturing", "import Caples...
[ { "name": "Nat", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.succ", "module": "Init.Data.Fin.Basic" }, { "name": "abs", "module": "Mathlib.Algebra.Order.Group.Unbundled.Abs" }, { "name": "And", "module": "Init.Prelud...
[ { "name": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x", "content": "notation:max \"{x=\" x \"}\" => CaptureSet.singleton x" }, { "name": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c", "content": "notation:max \"{c=\" c \"}\" => CaptureSet.csingleton c" }, { "name"...
[ { "name": "...", "module": "" } ]
[ { "name": "ESubtyp.trans", "content": "theorem ESubtyp.trans\n (h1 : ESubtyp Γ E1 E2)\n (h2 : ESubtyp Γ E2 E3) :\n ESubtyp Γ E1 E3" }, { "name": "CSubtyp.trans", "content": "theorem CSubtyp.trans\n (h1 : CSubtyp Γ T1 T2)\n (h2 : CSubtyp Γ T2 T3) :\n CSubtyp Γ T1 T3" }, { "name": "T...
[]
[]
import Capless.Tactics import Capless.Typing import Capless.Subtyping.Basic import Capless.Subcapturing.Basic import Capless.Narrowing import Capless.Weakening.Subcapturing import Capless.Inversion.Context import Capless.Inversion.Subtyping namespace Capless
theorem Typed.app_inv' (he : t0 = Term.app x y) (h : Typed Γ t0 E Ct0) : ∃ T Cf F E0, Typed Γ (Term.var x) (EType.type (CType.capt Cf (SType.forall T F))) {x=x} ∧ Typed Γ (Term.var y) (EType.type T) {x=y} ∧ E0 = F.open y ∧ ESubtyp Γ E0 E :=
:= by induction h <;> try (solve | cases he) case app x C T F y h1 h2 _ _ => cases he refine ⟨T, C, F, (F.open y), ?_⟩ repeat (constructor; trivial) apply ESubtyp.refl case sub hsub ih => have ih := ih he have ⟨T0, Cf0, E0, F0, hx0, hy0, he0, hs0⟩ := ih refine ⟨T0, ...
4
168
false
Type systems
121
InductiveTable.table_soundness_aux
lemma table_soundness_aux (table : InductiveTable F State Input) (input output : State F) (N : ℕ+) (trace : TraceOfLength F (ProvablePair State Input) N) (env : ℕ → ℕ → Environment F) : table.Spec input [] 0 rfl input → TableConstraintsHold (table.tableConstraints input output) trace env → trace.ForAllRowsWit...
clean
Clean/Table/Inductive.lean
[ "import Clean.Table.Basic", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Table.Theorems", "import Clean.Circuit.Loops", "import Clean.Utils.Vector" ]
[ { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, ...
[ { "name": "@[inherit_doc] notation:67 \"<+>\" => Trace.empty", "content": "@[inherit_doc] notation:67 \"<+>\" => Trace.empty\n\nsyntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macr...
[ { "name": "List.length_map", "module": "Init.Data.List.Lemmas" }, { "name": "Vector.append_empty", "module": "Init.Data.Vector.Lemmas" }, { "name": "zero_add", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "NeZero.pos", "module": "Mathlib.Algebra.Order.Monoid.Canoni...
[ { "name": "toList_length", "content": "lemma toList_length : (trace : Trace F S) → trace.toList.length = trace.len\n | <+> => rfl" }, { "name": "mapRange_zero", "content": "theorem mapRange_zero {create : ℕ → α} : mapRange 0 create = #v[]" }, { "name": "getElem_mapRange", "content":...
[ { "name": "InductiveTable.Soundness", "content": "def InductiveTable.Soundness (F : Type) [Field F] (State Input : Type → Type) [ProvableType State] [ProvableType Input]\n (Spec : (initialState : State F) → (xs : List (Input F)) → (i : ℕ) → (xs.length = i) → (currentState : State F) → Prop)\n (step : ...
[ { "name": "InductiveTable.equalityConstraint.soundness", "content": "theorem equalityConstraint.soundness {row : State F × Input F} {input_state : State F} {env : Environment F} :\n Circuit.ConstraintsHold.Soundness (windowEnv (equalityConstraint Input input_state) ⟨<+> +> row, rfl⟩ env)\n (equalityCons...
import Clean.Table.Theorems import Clean.Gadgets.Equality def InductiveTable.Soundness (F : Type) [Field F] (State Input : Type → Type) [ProvableType State] [ProvableType Input] (Spec : (initialState : State F) → (xs : List (Input F)) → (i : ℕ) → (xs.length = i) → (currentState : State F) → Prop) (step : Var ...
lemma table_soundness_aux (table : InductiveTable F State Input) (input output : State F) (N : ℕ+) (trace : TraceOfLength F (ProvablePair State Input) N) (env : ℕ → ℕ → Environment F) : table.Spec input [] 0 rfl input → TableConstraintsHold (table.tableConstraints input output) trace env → trace.ForAllRowsWit...
:= by intro input_spec -- add a condition on the trace length to the goal, -- so that we can change the induction to not depend on `N` (which would make it unprovable) rcases trace with ⟨ trace, h_trace ⟩ suffices goal : TableConstraintsHold (table.tableConstraints input output) ⟨ trace, h_trace ⟩ env → ...
9
251
true
Applied verif.
122
Circomlib.MultiAND.soundness
theorem soundness {p : ℕ} [Fact p.Prime] (n : ℕ) : ∀ (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields n) (F p)) (input : fields n (F p)), input = eval env input_var → Assumptions n input → Circuit.ConstraintsHold.Soundness env ((main input_var).operations offset) → Spec n input ...
clean
Clean/Circomlib/Gates.lean
[ "import Clean.Circuit.Theorems", "import Clean.Circuit.Provable", "import Clean.Utils.Field", "import Clean.Circuit", "import Mathlib.Data.Nat.Bitwise", "import Clean.Gadgets.Boolean", "import Clean.Utils.Bitwise", "import Clean.Utils.BinaryOps", "import Clean.Circuit.Basic", "import Clean.Utils.V...
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let $x <...
[ { "name": "Array.foldl_toList", "module": "Init.Data.Array.Bootstrap" }, { "name": "List.foldl_cons", "module": "Init.Data.List.Basic" }, { "name": "List.foldl_nil", "module": "Init.Data.List.Basic" }, { "name": "Vector.foldl_mk", "module": "Init.Data.Vector.Lemmas" }, ...
[ { "name": "toList_length_one", "content": "theorem toList_length_one {α : Type} (v : Vector α 1) :\n v.toList = [v[0]]" }, { "name": "one_land_of_IsBool", "content": "theorem one_land_of_IsBool (a : ℕ) (h : IsBool a) : 1 &&& a = a" }, { "name": "land_one_of_IsBool", "content": "th...
[ { "name": "Circomlib.AND.main", "content": "def main (input : Expression (F p) × Expression (F p)) := do\n let a := input.1\n let b := input.2\n let out <== a*b\n return out" }, { "name": "Circomlib.MultiAND.main", "content": "def main : {n : ℕ} → Vector (Expression (F p)) n → Circuit (F p) ...
[ { "name": "Circomlib.MultiAND.Vector.foldl_empty'", "content": "lemma Vector.foldl_empty' {α β : Type} (init : β) (f : β → α → β) (v : Vector α 0) :\n Vector.foldl f init v = init" }, { "name": "Circomlib.MultiAND.Vector.foldl_and_split", "content": "lemma Vector.foldl_and_split {n1 n2 n3 : ℕ...
import Clean.Circuit import Clean.Utils.Field import Clean.Gadgets.Boolean import Clean.Utils.Bitwise import Clean.Utils.Vector import Clean.Utils.BinaryOps import Clean.Circuit.Theorems import Mathlib.Data.Nat.Bitwise open IsBool namespace Circomlib variable {p : ℕ} [Fact p.Prime] open Circuit (bind_output_...
theorem soundness {p : ℕ} [Fact p.Prime] (n : ℕ) : ∀ (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields n) (F p)) (input : fields n (F p)), input = eval env input_var → Assumptions n input → Circuit.ConstraintsHold.Soundness env ((main input_var).operations offset) → Spec n input ...
:= by induction n using Nat.strong_induction_on with | _ n IH => intro offset env input_var input h_env h_assumptions h_hold match n with | 0 => exact soundness_zero offset env input_var input h_env h_assumptions h_hold | 1 => exact soundness_one offset env input_var input h_env h_assumptions h_hold...
9
134
true
Applied verif.
123
MemoryAccessList.isConsistent_iff_all_single_address
theorem MemoryAccessList.isConsistent_iff_all_single_address (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) : MemoryAccessList.isConsistentOnline accesses h_sorted ↔ (∀ addr : ℕ, MemoryAccessList.isConsistentSingleAddress (MemoryAccessList.filterAddress accesses addr) (MemoryAccessList.fi...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "Bool", "module": "Init.Prelude" }, { "name": "And", "module": "Init.Prelude" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.filter", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.filter_cons", "module": "Init.Data.List.Lemmas" }, { "name": "List.filter_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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.filterAddress_sorted", "content": "theorem MemoryAccessList.filterAddress_sorted (accesses : MemoryAccessList)\n (h : accesses.isTimestampSorted) (addr : ℕ) :\n (MemoryAccessList.filterAddress accesses addr).isTimestampSorted" }, { "name": "MemoryAccessList.filterAd...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistent_iff_all_single_address (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) : MemoryAccessList.isConsistentOnline accesses h_sorted ↔ (∀ addr : ℕ, MemoryAccessList.isConsistentSingleAddress (MemoryAccessList.filterAddress accesses addr) (MemoryAccessList.fi...
:= by constructor · intro h addr have h' := MemoryAccessList.isConsistentSingleAddress_iff (accesses.filterAddress addr) addr (MemoryAccessList.filterAddress_sorted accesses h_sorted addr) (by simp only [filterAddress, List.all_filter, Bool.not_or_self, List.all_eq_true, implies_true]) exa...
3
44
true
Applied verif.
124
Gadgets.Addition32.Theorems.add32_soundness
theorem add32_soundness {x0 x1 x2 x3 y0 y1 y2 y3 carry_in c0 c1 c2 c3 z0 z1 z2 z3 : F p} (x0_byte : x0.val < 256) (x1_byte : x1.val < 256) (x2_byte : x2.val < 256) (x3_byte : x3.val < 256) (y0_byte : y0.val < 256) (y1_byte : y1.val < 256) (y2_byte : y2.val < 256) (y3_byte : y3.val < 256) (z0_byte : z0.val <...
clean
Clean/Gadgets/Addition32/Theorems.lean
[ "import Clean.Types.U32", "import Clean.Gadgets.Addition8.Addition8FullCarry", "import Clean.Gadgets.Boolean", "import Clean.Utils.Field" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "ZMod.val", "module": "Mathlib.Data.ZMod.Basic" }, { "name": "Int", "module": "Init.Data.Int.Basic" }...
[ { "name": "syntax \"field_to_nat\" : tactic", "content": "syntax \"field_to_nat\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tac...
[ { "name": "CharP.cast_eq_zero", "module": "Mathlib.Algebra.CharP.Defs" }, { "name": "Nat.cast_one", "module": "Mathlib.Data.Nat.Cast.Defs" }, { "name": "ZMod.val_one", "module": "Mathlib.Data.ZMod.Basic" }, { "name": "ZMod.val_zero", "module": "Mathlib.Data.ZMod.Basic" ...
[ { "name": "val_lt_two", "content": "theorem val_lt_two {p : ℕ} [Fact p.Prime] {x : F p} (h : IsBool x) : x.val < 2" } ]
[]
[ { "name": "Gadgets.Addition32.Theorems.lift_val1", "content": "lemma lift_val1 {x y b : (F p)} (x_byte : x.val < 256) (y_byte : y.val < 256) (b_bool : IsBool b) :\n (x + y + b).val = (x.val + y.val + b.val)" }, { "name": "Gadgets.Addition32.Theorems.lift_val2", "content": "lemma lift_val2 {x ...
import Clean.Gadgets.Addition8.Addition8FullCarry import Clean.Types.U32 import Clean.Utils.Field import Clean.Gadgets.Boolean variable {p : ℕ} [Fact p.Prime] variable [p_large_enough: Fact (p > 512)] namespace Gadgets.Addition32.Theorems
theorem add32_soundness {x0 x1 x2 x3 y0 y1 y2 y3 carry_in c0 c1 c2 c3 z0 z1 z2 z3 : F p} (x0_byte : x0.val < 256) (x1_byte : x1.val < 256) (x2_byte : x2.val < 256) (x3_byte : x3.val < 256) (y0_byte : y0.val < 256) (y1_byte : y1.val < 256) (y2_byte : y2.val < 256) (y3_byte : y3.val < 256) (z0_byte : z0.val <...
:= by apply_fun ZMod.val at h0 h1 h2 h3 rw [lift_val1 x0_byte y0_byte carry_in_bool, lift_val2 z0_byte c0_bool] at h0 rw [lift_val1 x1_byte y1_byte c0_bool, lift_val2 z1_byte c1_bool] at h1 rw [lift_val1 x2_byte y2_byte c1_bool, lift_val2 z2_byte c2_bool] at h2 rw [lift_val1 x3_byte y3_byte c2_bool, lift_val...
3
34
true
Applied verif.
125
Gadgets.ByteDecomposition.Theorems.soundness
theorem soundness (offset : Fin 8) (x low high : F p) (x_lt : x.val < 2^8) (low_lt : low.val < 2^offset.val) (high_lt : high.val < 2^8) (h_eq : x = low + high * 2^offset.val) : low.val = x.val % 2^offset.val ∧ high.val = x.val / 2^offset.val
clean
Clean/Gadgets/ByteDecomposition/Theorems.lean
[ "import Clean.Types.U32", "import Clean.Utils.Bitwise", "import Clean.Types.U64", "import Clean.Utils.Field" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Nat.reduceMod", "module": "Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat" }, { "name": "Nat.reducePow", "mo...
[ { "name": "syntax \"field_to_nat\" : tactic", "content": "syntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tactic|(\n intros\n repeat rw [ZMod.val_add] \n repeat rw [ZMod.val_mul] \n repeat rw [val_eq_...
[ { "name": "Fact.elim", "module": "Mathlib.Logic.Basic" }, { "name": "Nat.mul_lt_mul_of_lt_of_le", "module": "Init.Data.Nat.Lemmas" }, { "name": "Nat.pow_pos", "module": "Init.Prelude" }, { "name": "Nat.add_mod_mod", "module": "Init.Data.Nat.Lemmas" }, { "name": "N...
[ { "name": "two_pow_val", "content": "lemma two_pow_val (n : ℕ) (hn : n ≤ 8) : (2^n : F p).val = 2^n" }, { "name": "two_pow_lt", "content": "omit p_prime in\nlemma two_pow_lt (n : ℕ) (hn : n ≤ 8) : 2^n < p" }, { "name": "two_val", "content": "lemma two_val : (2 : F p).val = 2" }, ...
[]
[ { "name": "Gadgets.ByteDecomposition.Theorems.byteDecomposition_lift", "content": "theorem byteDecomposition_lift {low high two_power : F p}\n (h_low : low.val < 2^8) (h_high : high.val < 2^8) (h_two_power : two_power.val ≤ 2^8) :\n (low + high * two_power).val = low.val + high.val * two_power.val" } ...
import Clean.Utils.Field import Clean.Utils.Bitwise import Clean.Types.U64 import Clean.Types.U32 namespace Gadgets.ByteDecomposition.Theorems variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 2^16 + 2^8)] open FieldUtils (two_val two_pow_val)
theorem soundness (offset : Fin 8) (x low high : F p) (x_lt : x.val < 2^8) (low_lt : low.val < 2^offset.val) (high_lt : high.val < 2^8) (h_eq : x = low + high * 2^offset.val) : low.val = x.val % 2^offset.val ∧ high.val = x.val / 2^offset.val :=
:= by have two_power_lt : 2^offset.val < 2^8 := Nat.pow_lt_pow_of_lt (by linarith) offset.is_lt have two_power_val : ((2 : F p)^offset.val).val = 2^offset.val := two_pow_val offset.val (by linarith [offset.is_lt]) have two_power_le : (2^offset.val : F p).val ≤ 2^8 := by rw [two_power_val]; linarith have low_b...
3
38
true
Applied verif.
126
MemoryAccessList.isConsistentOffline_implies_single_address
theorem MemoryAccessList.isConsistentOffline_implies_single_address (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted) (h_nodup : accesses.Notimestampdup) (h_offline : accesses.isConsistentOffline h_sorted) (addr : ℕ) : (accesses.filterAddress addr).isConsistentSingleAd...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise", "module": "Init.Data.List.Basic" }, { "name": "List.filter", "module": "Init.Data.List.Basic" }, { "name": "Nat", "module":...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise.of_cons", "module": "Init.Data.List.Pairwise" }, { "name": "List.filter_eq_nil_iff", "module": "Init.Data.List.Lemmas" }, { "name": "List.mem_cons_self", "module": "Init.Data....
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup", "content": "theorem MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup\n (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted)\n (h_no_timestam...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistentOffline_implies_single_address (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted) (h_nodup : accesses.Notimestampdup) (h_offline : accesses.isConsistentOffline h_sorted) (addr : ℕ) : (accesses.filterAddress addr).isConsistentSingleAd...
:= by induction accesses with | nil => simp [filterAddress, isConsistentSingleAddress] | cons head tail ih => obtain ⟨t_head, a_head, r_head, w_head⟩ := head simp only [filterAddress, List.filter_cons] split_ifs with h_addr · -- head has the target address rw [decide_eq_true_eq] at h_add...
4
34
true
Applied verif.
127
Circomlib.MultiAND.soundness_two
lemma soundness_two {p : ℕ} [Fact p.Prime] (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields 2) (F p)) (input : fields 2 (F p)) (h_env : input = eval env input_var) (h_assumptions : Assumptions 2 input) (h_hold : Circuit.ConstraintsHold.Soundness env ((main input_var).operations offset)) :...
clean
Clean/Circomlib/Gates.lean
[ "import Clean.Circuit.Theorems", "import Clean.Circuit.Provable", "import Clean.Utils.Field", "import Clean.Circuit", "import Mathlib.Data.Nat.Bitwise", "import Clean.Gadgets.Boolean", "import Clean.Utils.Bitwise", "import Clean.Utils.BinaryOps", "import Clean.Utils.Vector" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let $x <...
[ { "name": "Array.foldl_toList", "module": "Init.Data.Array.Bootstrap" }, { "name": "List.foldl_cons", "module": "Init.Data.List.Basic" }, { "name": "List.foldl_nil", "module": "Init.Data.List.Basic" }, { "name": "Vector.foldl_mk", "module": "Init.Data.Vector.Lemmas" }, ...
[ { "name": "eval_fieldPair", "content": "@[circuit_norm ↓]\ntheorem eval_fieldPair {F : Type} [Field F] (env : Environment F) (t : Var fieldPair F) :\n ProvableType.eval env t = (match t with | (x, y) => (Expression.eval env x, Expression.eval env y))" }, { "name": "toList_length_two", "content"...
[ { "name": "Circomlib.AND.main", "content": "def main (input : Expression (F p) × Expression (F p)) := do\n let a := input.1\n let b := input.2\n let out <== a*b\n return out" }, { "name": "Circomlib.MultiAND.main", "content": "def main : {n : ℕ} → Vector (Expression (F p)) n → Circuit (F p) ...
[]
import Clean.Circuit import Clean.Utils.Field import Clean.Gadgets.Boolean import Clean.Utils.Bitwise import Clean.Utils.Vector import Clean.Utils.BinaryOps import Clean.Circuit.Theorems import Mathlib.Data.Nat.Bitwise open IsBool namespace Circomlib variable {p : ℕ} [Fact p.Prime] open Circuit (bind_output_...
lemma soundness_two {p : ℕ} [Fact p.Prime] (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields 2) (F p)) (input : fields 2 (F p)) (h_env : input = eval env input_var) (h_assumptions : Assumptions 2 input) (h_hold : Circuit.ConstraintsHold.Soundness env ((main input_var).operations offset)) :...
:= by simp only [main] at h_hold ⊢ simp only [Spec] have h_input0 := h_assumptions 0 (by norm_num : 0 < 2) have h_input1 := h_assumptions 1 (by norm_num : 1 < 2) have h_eval0 : env input_var[0] = input[0] := by simp [h_env, circuit_norm] have h_eval1 : env input_var[1] = input[1] := by simp [h_env, circuit_...
9
99
true
Applied verif.
128
Gadgets.ByteDecomposition.soundness
theorem soundness (offset : Fin 8) : Soundness (F p) (circuit := elaborated offset) Assumptions (Spec offset)
clean
Clean/Gadgets/ByteDecomposition/ByteDecomposition.lean
[ "import Clean.Utils.Primes", "import Init.Data.Nat.Div.Basic", "import Clean.Gadgets.ByteDecomposition.Theorems", "import Clean.Utils.Field" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, ...
[ { "name": "syntax \"let \" ident \" <== \" term : doElem", "content": "syntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem\n\nsyntax \"infer_constant_length\" : tactic\n\nsyntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "conten...
[ { "name": "Fact.elim", "module": "Mathlib.Logic.Basic" }, { "name": "Nat.add_mod_mod", "module": "Init.Data.Nat.Lemmas" }, { "name": "Nat.div_lt_iff_lt_mul", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { ...
[ { "name": "soundness", "content": "theorem soundness (offset : Fin 8) (x low high : F p)\n (x_lt : x.val < 2^8) (low_lt : low.val < 2^offset.val) (high_lt : high.val < 2^8)\n (h_eq : x = low + high * 2^offset.val) :\n low.val = x.val % 2^offset.val ∧ high.val = x.val / 2^offset.val" }, { "name"...
[ { "name": "Gadgets.ByteDecomposition.Outputs", "content": "structure Outputs (F : Type) where\n low : F\n high : F" }, { "name": "Gadgets.ByteDecomposition.main", "content": "def main (offset : Fin 8) (x : Expression (F p)) : Circuit (F p) (Var Outputs (F p)) := do\n let low ← witness fun env...
[]
import Clean.Utils.Primes import Clean.Utils.Field import Clean.Gadgets.ByteDecomposition.Theorems import Init.Data.Nat.Div.Basic variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 2^16 + 2^8)] namespace Gadgets.ByteDecomposition open FieldUtils (mod floorDiv two_lt two_pow_lt two_val two_pow_val) struct...
theorem soundness (offset : Fin 8) : Soundness (F p) (circuit := elaborated offset) Assumptions (Spec offset) :=
:= by intro i0 env x_var (x : F p) h_input (x_byte : x.val < 256) h_holds simp only [id_eq, circuit_norm] at h_input simp only [circuit_norm, elaborated, main, Spec, ByteTable, h_input] at h_holds ⊢ clear h_input obtain ⟨low_lt, high_lt, h_eq⟩ := h_holds set low := env.get i0 set high := env.get (i0 + 1)...
7
119
true
Applied verif.
129
Gadgets.Or.Or8.completeness
theorem completeness : Completeness (F p) elaborated Assumptions
clean
Clean/Gadgets/Or/Or8.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Utils.Field", "import Clean.Circuit.Basic" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tactic|(\n intros\n repeat rw [ZMod.val_add] \n ...
[ { "name": "BitVec.toNat_ofNat", "module": "Init.Data.BitVec.Bootstrap" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.or_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.N...
[ { "name": "val_lt_p", "content": "theorem val_lt_p {p : ℕ} (x : ℕ) : (x < p) → (x : F p).val = x" }, { "name": "natToField_eq", "content": "theorem natToField_eq {n : ℕ} {lt : n < p} (x : F p) (hx : x = natToField n lt) : x.val = n" }, { "name": "natToField_eq_natCast", "content": "t...
[ { "name": "Gadgets.Or.Or8.Inputs", "content": "structure Inputs (F : Type) where\n x: F\n y: F" }, { "name": "Gadgets.Or.Or8.Assumptions", "content": "def Assumptions (input : Inputs (F p)) :=\n let ⟨x, y⟩ := input\n x.val < 256 ∧ y.val < 256" }, { "name": "Gadgets.Or.Or8.main", ...
[ { "name": "Gadgets.Or.Or8.or_times_two_sub_xor", "content": "private theorem or_times_two_sub_xor {x y : ℕ} (hx : x < 256) (hy : y < 256) :\n 2 * (x ||| y) = x + y + (x ^^^ y)" }, { "name": "Gadgets.Or.Or8.or_times_two_sub_xor'", "content": "private theorem or_times_two_sub_xor' {x y : ℕ} (hx...
import Clean.Circuit.Basic import Clean.Gadgets.Xor.ByteXorTable variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] namespace Gadgets.Or.Or8 open Xor (ByteXorTable) open FieldUtils structure Inputs (F : Type) where x: F y: F def Assumptions (input : Inputs (F p)) := let ⟨x, y⟩ := input x.va...
theorem completeness : Completeness (F p) elaborated Assumptions :=
:= by intro i env ⟨ x_var, y_var ⟩ h_env ⟨ x, y ⟩ h_input h_assumptions simp_all only [circuit_norm, main, Assumptions, ByteXorTable, Inputs.mk.injEq] obtain ⟨ hx_byte, hy_byte ⟩ := h_assumptions set w : F p := ZMod.val x ||| ZMod.val y have hw : w = ZMod.val x ||| ZMod.val y := rfl let z := 2*w - x - y ...
7
117
true
Applied verif.
130
Gadgets.BLAKE3.ApplyRounds.soundness
theorem soundness : Soundness (F p) elaborated Assumptions Spec
clean
Clean/Gadgets/BLAKE3/ApplyRounds.lean
[ "import Clean.Specs.BLAKE3", "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.BLAKE3.BLAKE3State", "import Clean.Gadgets.BLAKE3.Permute", "import Clean.Types.U32", "import Clean.Gadgets.BLAKE3.Round", "import Clean.Circuit.StructuralLemmas" ]
[ { "name": "Fin", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Vector.ofFn", "module": "Init.Data.Vector.Basic" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "ZMod", "module": "Mathlib.Data...
[ { "name": "syntax \"let \" ident \" <== \" term : doElem", "content": "syntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem\n\nsyntax \"infer_constant_length\" : tactic" }, { "name": "macro \"provable_struct_simp\" : tactic =>", "content": "...
[ { "name": "Nat.add_mul_div_left", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.div_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" } ]
[ { "name": "eval_vector", "content": "theorem eval_vector (env : Environment F)\n (x : Var (ProvableVector α n) F) :\n eval env x = x.map (eval env)" }, { "name": "eval_vector_eq_get", "content": "lemma eval_vector_eq_get {M : TypeMap} [NonEmptyProvableType M] {n : ℕ} (env : Environment F)\n ...
[ { "name": "Gadgets.BLAKE3.ApplyRounds.roundWithPermute", "content": "def roundWithPermute : FormalCircuit (F p) Round.Inputs Round.Inputs where\n main := fun input => do\n let state ← subcircuit Round.circuit input\n let permuted_message ← subcircuit Permute.circuit input.message\n return ⟨state, ...
[ { "name": "Gadgets.BLAKE3.ApplyRounds.applyRounds_eq_applySevenRounds", "content": "lemma applyRounds_eq_applySevenRounds\n (chaining_value : Vector ℕ 8)\n (block_words : Vector ℕ 16)\n (counter : ℕ)\n (block_len : ℕ)\n (flags : ℕ) :\n applyRounds chaining_value block_words counter block_l...
import Clean.Gadgets.BLAKE3.BLAKE3State import Clean.Gadgets.BLAKE3.Round import Clean.Gadgets.BLAKE3.Permute import Clean.Types.U32 import Clean.Circuit.Provable import Clean.Specs.BLAKE3 import Clean.Circuit.StructuralLemmas import Clean.Utils.Tactics namespace Gadgets.BLAKE3.ApplyRounds variable {p : ℕ} [Fa...
theorem soundness : Soundness (F p) elaborated Assumptions Spec :=
:= by circuit_proof_start -- Equations for counter values have h_counter_low_eq : input_counter_low.value % 4294967296 = input_counter_low.value := by apply Nat.mod_eq_of_lt exact U32.value_lt_of_normalized h_assumptions.2.2.2.1 have h_counter_high_eq : (input_counter_low.value + 4294967296 * input_co...
21
204
false
Applied verif.
131
Utils.StateTransition.size_removeCycle_lt
lemma size_removeCycle_lt (R : Run S) (cycle : List S) (h_len : cycle.length ≥ 2) (h_contains : R.containsPath cycle) (_h_cycle : cycle.head? = cycle.getLast?) : (R.removeCycle cycle).size < R.size
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "Finset", "module": "Mathlib.Data.Finset.Defs" }, { "name": "Finset.univ", "module": "Mat...
[ { "name": "...", "content": "..." } ]
[ { "name": "Finset.mem_univ", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "Finset.sum_erase_add", "module": "Mathlib.Algebra.BigOperators.Group.Finset.Basic" }, { "name": "Finset.sum_le_sum", "module": "Mathlib.Algebra.Order.BigOperators.Group.Finset" }, { "name": "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.Run.size", "content": "noncomputable def Run.size {S : Typ...
[ { "name": "Utils.StateTransition.sum_decrease", "content": "lemma sum_decrease {α : Type*} [Fintype α] [DecidableEq α] (f g : α → ℕ) (a : α)\n (h_a_decrease : g a < f a)\n (h_others_le : ∀ x, g x ≤ f x) :\n ∑ x : α, g x < ∑ x : α, f x" }, { "name": "Utils.StateTransition.path_has_transition...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma size_removeCycle_lt (R : Run S) (cycle : List S) (h_len : cycle.length ≥ 2) (h_contains : R.containsPath cycle) (_h_cycle : cycle.head? = cycle.getLast?) : (R.removeCycle cycle).size < R.size :=
:= by -- Get a transition in the path obtain ⟨t, h_in_zip⟩ := path_has_transition cycle h_len -- This transition has positive capacity have h_pos := containsPath_has_positive_transition R cycle h_contains t h_in_zip let (x, y) := t -- Show that this transition appears in the cycle, so countTransitionInPath ...
2
25
true
Applied verif.
132
U32.ByteVector.bitwise_componentwise
omit [Fact (Nat.Prime p)] p_large_enough in lemma bitwise_componentwise (f : Bool → Bool → Bool) {x y : U32 (F p)} (x_norm : x.Normalized) (y_norm : y.Normalized) : f false false = false → Nat.bitwise f x.value y.value = Nat.bitwise f x.x0.val y.x0.val + 256 * (Nat.bitwise f x.x1.val y.x1.val ...
clean
Clean/Types/U32.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Subcircuit", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Clean.Utils.Bitwise", "import Clean.Circuit.Extensions", "import Clean.Gadgets.ByteLookup" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|infer_constant_length) => `(tactic|(\n apply ConstantLength.fromConstantLength\n try simp only [circuit_norm]\n ...
[ { "name": "Nat.bitwise_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.eq_of_testBit_eq", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.testBit_bitwise", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.testBit_two_pow_mul_add", ...
[ { "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": "U32", "content": "structure U32 (T : Type) where\n x0 : T\n x1 : T\n x2 : T\n x3 : T\nderiving DecidableEq" }, { "name": "U32.map", "content": "def map {α β : Type} (x : U32 α) (f : α → β) : U32 β :=\n ⟨ f x.x0, f x.x1, f x.x2, f x.x3 ⟩" }, { "name": "U32.Normalized", ...
[ { "name": "U32.ByteVector.reorganize_value", "content": "private lemma reorganize_value (a b c d : ℕ) :\n a + 256 * (b + 256 * (c + 256 * d)) =\n 2^8 * (2^8 * (2^8 * d + c) + b) + a" }, { "name": "U32.ByteVector.reorganize_value'", "content": "private lemma reorganize_value' (a b c d : ℕ) :\n ...
import Clean.Gadgets.ByteLookup import Clean.Circuit.Extensions import Clean.Utils.Bitwise import Clean.Circuit.Provable import Clean.Utils.Primes import Clean.Circuit.Subcircuit import Clean.Gadgets.Equality section variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] structure U32 (T : Type) wher...
omit [Fact (Nat.Prime p)] p_large_enough in lemma bitwise_componentwise (f : Bool → Bool → Bool) {x y : U32 (F p)} (x_norm : x.Normalized) (y_norm : y.Normalized) : f false false = false → Nat.bitwise f x.value y.value = Nat.bitwise f x.x0.val y.x0.val + 256 * (Nat.bitwise f x.x1.val y.x1.val ...
:= by intro _ simp only [value] have ⟨_, _, _, _⟩ := x_norm have ⟨_, _, _, _⟩ := y_norm apply Nat.eq_of_testBit_eq intro i simp only [reorganize_value, reorganize_value'] rw [Nat.testBit_bitwise] <;> try assumption rw [Nat.testBit_two_pow_mul_add (i:=8) (b:=ZMod.val x.x0)] <;> try assumption rw [Na...
7
66
true
Applied verif.
133
MemoryAccessList.isConsistentOffline_iff_all_single_addresses
theorem MemoryAccessList.isConsistentOffline_iff_all_single_addresses (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted) (h_nodup : accesses.Notimestampdup) : MemoryAccessList.isConsistentOffline accesses h_sorted ↔ ∀ addr, MemoryAccessList.isConsistentSingleAddress (MemoryAccessList.f...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise", "module": "Init.Data.List.Basic" }, { "name": "List.filter", "module": "Init.Data.List.Basic" }, { "name": "Nat", "module":...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise.of_cons", "module": "Init.Data.List.Pairwise" }, { "name": "List.filter_eq_nil_iff", "module": "Init.Data.List.Lemmas" }, { "name": "List.mem_cons_self", "module": "Init.Data....
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup", "content": "theorem MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup\n (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted)\n (h_no_timestam...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistentOffline_iff_all_single_addresses (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted) (h_nodup : accesses.Notimestampdup) : MemoryAccessList.isConsistentOffline accesses h_sorted ↔ ∀ addr, MemoryAccessList.isConsistentSingleAddress (MemoryAccessList.f...
:= by constructor · intro h_offline addr exact isConsistentOffline_implies_single_address accesses h_sorted h_nodup h_offline addr · induction accesses · simp [isConsistentOffline] rename_i hd tl h_ih intro h rcases tl · rcases hd with ⟨ hd_t, hd_a, hd_r, hd_w ⟩ simp only [isConsiste...
4
38
true
Applied verif.
134
FlatOperation.proverEnvironment_usesLocalWitnesses
theorem proverEnvironment_usesLocalWitnesses {ops : List (FlatOperation F)} (init : List F) : (∀ (env env' : Environment F), forAll init.length { witness n _ c := env.AgreesBelow n env' → c env = c env' } ops) → (proverEnvironment ops init).UsesLocalWitnessesFlat init.length ops
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|infer_constant_length) => `(tactic|(\n apply ConstantLength.fromConstantLength\n try simp only [circuit_norm]\n ...
[ { "name": "List.foldl_cons", "module": "Init.Data.List.Basic" }, { "name": "List.getElem_append_left", "module": "Init.Data.List.BasicAux" }, { "name": "List.length_append", "module": "Init.Data.List.Basic" }, { "name": "List.getElem_append_right", "module": "Init.Data.Li...
[ { "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": "FlatOperation.forAll_cons", "content": "theorem forAll_cons {condition : Condition F} {offset : ℕ} {op : FlatOperation F} {ops : List (FlatOperation F)} :\n forAll offset condition (op :: ops) ↔\n condition.applyFlat offset op ∧ forAll (op.singleLocalLength + offset) condition ops" }, { ...
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit end Circuit namespace FlatOperation end FlatOperation namespace Environment open FlatOperation (localLength localWitnesses) end Environment namespace Circ...
theorem proverEnvironment_usesLocalWitnesses {ops : List (FlatOperation F)} (init : List F) : (∀ (env env' : Environment F), forAll init.length { witness n _ c := env.AgreesBelow n env' → c env = c env' } ops) → (proverEnvironment ops init).UsesLocalWitnessesFlat init.length ops :=
:= by simp only [proverEnvironment, Environment.UsesLocalWitnessesFlat, Environment.ExtendsVector] intro h_computable induction ops generalizing init with | nil => trivial | cons op ops ih => simp only [forAll_cons] at h_computable ⊢ cases op with | assert | lookup => simp_all [dynamicWitne...
7
57
true
Applied verif.
135
Utils.StateTransition.acyclic_has_leaf_aux
lemma acyclic_has_leaf_aux (R : Run S) (root current : S) (path : List S) (h_acyclic : R.isAcyclic) (h_start : path.head? = some root) (h_end : path.getLast? = some current) (h_nonempty : path ≠ []) (h_contains : R.containsPath path) (h_has_out : ∃ y, y ∉ path ∧ R (current, y) > 0) : ∃ l...
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Finset", "module": "Mathlib.Data.Finset.Defs" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "Fintype.card", "module": "Ma...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.countP_cons_of_pos", "module": "Init.Data.List.Count" }, { "name": "List.countP_nil", "module": "Init.Data.List.Count" }, { "name": "List.count_cons", "module": "Init.Data.List.Count" }, { "name": "List.count_nil", "module": "Init.Data.List.Count" }, {...
[ { "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.countTransitionInPath", "content": "def countTransitionInP...
[ { "name": "Utils.StateTransition.finset_ssubset_univ_of_not_mem", "content": "lemma finset_ssubset_univ_of_not_mem {α : Type*} [Fintype α] (s : Finset α) (x : α)\n (h : x ∉ s) :\n s ⊂ Finset.univ" }, { "name": "Utils.StateTransition.zip_drop_sublist", "content": "lemma zip_drop_sublist (l ...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma acyclic_has_leaf_aux (R : Run S) (root current : S) (path : List S) (h_acyclic : R.isAcyclic) (h_start : path.head? = some root) (h_end : path.getLast? = some current) (h_nonempty : path ≠ []) (h_contains : R.containsPath path) (h_has_out : ∃ y, y ∉ path ∧ R (current, y) > 0) : ∃ l...
:= by -- Get a successor not in path obtain ⟨y, h_y_not_in_path, h_edge⟩ := h_has_out -- Check if y has any outgoing edges to states not in path ++ [y] by_cases h_y_has_out : ∃ z, z ∉ path ∧ z ≠ y ∧ R (y, z) > 0 case neg => -- y has no outgoing edges to states not in path ++ [y] -- We'll show y is ac...
7
97
true
Applied verif.
136
MemoryAccessList.filterAddress_sorted_from_addressTimestampSorted
theorem MemoryAccessList.filterAddress_sorted_from_addressTimestampSorted (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted) (h_nodup : accesses.Notimestampdup) (addr : ℕ) : (accesses.filterAddress addr).isTimestampSorted
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Pairwise", "module": "Init.Data.List.Basic" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "Nat", "module": "Init.Prelude" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "Nat.lt_of_le_of_ne", "module": "Init.Prelude" }, { "name": "eq_comm", "module": "Init.Core" }, { "name": "List.Pairwise.of_cons", "module": "Init.Data.List.Pairwise" }, { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "L...
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup", "content": "theorem MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup\n (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted)\n (h_no_timestam...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.filterAddress_sorted_from_addressTimestampSorted (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted) (h_nodup : accesses.Notimestampdup) (addr : ℕ) : (accesses.filterAddress addr).isTimestampSorted :=
:= by have h_strict := addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup accesses h_sorted h_nodup simp only [isAddressStrictTimestampSorted, filterAddress, isTimestampSorted] at h_strict ⊢ induction accesses with | nil => simp | cons head tail ih => obtain ⟨t, a, r, w⟩ := head sim...
2
23
true
Applied verif.
137
MemoryAccessList.isConsistentOnline_iff_isConsistentOffline
theorem MemoryAccessList.isConsistentOnline_iff_isConsistentOffline (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) (h_nodup : accesses.Notimestampdup) : MemoryAccessList.isConsistentOnline accesses h_sorted ↔ ∃ permuted : AddressSortedMemoryAccessList, permuted.val.Perm ...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.insertionSort", "module": "Mathlib.Data.List.Sort" }, { "name": "List.Pairwise", "module": "Init.Data.List.Basic" }, { "name": "List.filte...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise.of_cons", "module": "Init.Data.List.Pairwise" }, { "name": "List.filter_eq_nil_iff", "module": "Init.Data.List.Lemmas" }, { "name": "List.mem_cons_self", "module": "Init.Data....
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.addressTimestampSort_sorted", "content": "theorem MemoryAccessList.addressTimestampSort_sorted (accesses : MemoryAccessList) :\n (MemoryAccessList.addressTimestampSort accesses).Sorted address_timestamp_ordering" }, { "name": "MemoryAccessList.addressTimestampSort_perm...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistentOnline_iff_isConsistentOffline (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) (h_nodup : accesses.Notimestampdup) : MemoryAccessList.isConsistentOnline accesses h_sorted ↔ ∃ permuted : AddressSortedMemoryAccessList, permuted.val.Perm ...
:= by constructor · intro h use ⟨MemoryAccessList.addressTimestampSort accesses, MemoryAccessList.addressTimestampSort_sorted accesses⟩ constructor · simp only apply MemoryAccessList.addressTimestampSort_perm · simp only have h' := MemoryAccessList.isConsistentOnline_iff_sorted_isConsist...
6
94
true
Applied verif.
138
Utils.StateTransition.path_with_back_edge_creates_cycle
lemma path_with_back_edge_creates_cycle (R : Run S) (path : List S) (current y : S) (h_acyclic : R.isAcyclic) (h_end : path.getLast? = some current) (h_contains : R.containsPath path) (h_y_in_path : y ∈ path) (h_edge : R (current, y) > 0) : R.hasCycle
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sublist", "module": "Init.Data.List.Basic" }, { "name": "List.count", "module": "Init.Data.List.Basic" }, { "name": "List.drop", "module": "Init....
[ { "name": "...", "content": "..." } ]
[ { "name": "List.drop_succ_cons", "module": "Init.Data.List.Basic" }, { "name": "List.tail_cons", "module": "Init.Data.List.Basic" }, { "name": "List.zip_cons_cons", "module": "Init.Data.List.Basic" }, { "name": "List.Sublist.count_le", "module": "Init.Data.List.Count" }...
[ { "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.countTransitionInPath", "content": "def countTransitionInP...
[ { "name": "Utils.StateTransition.zip_drop_sublist", "content": "lemma zip_drop_sublist (l : List S) (n : ℕ) :\n ((l.drop n).zip (l.drop (n + 1))).Sublist (l.zip l.tail)" }, { "name": "Utils.StateTransition.containsPath_drop", "content": "lemma containsPath_drop (R : Run S) (path : List S) (n ...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma path_with_back_edge_creates_cycle (R : Run S) (path : List S) (current y : S) (h_acyclic : R.isAcyclic) (h_end : path.getLast? = some current) (h_contains : R.containsPath path) (h_y_in_path : y ∈ path) (h_edge : R (current, y) > 0) : R.hasCycle :=
:= by -- Find y's position in path rw [List.mem_iff_getElem] at h_y_in_path obtain ⟨i, h_i_lt, h_y_eq⟩ := h_y_in_path let suffix := path.drop i have h_suffix_nonempty : suffix ≠ [] := drop_of_lt_length_nonempty path i h_i_lt have h_suffix_head : suffix.head? = some y := by aesop have h_suffix_last : suffi...
5
71
true
Applied verif.
139
Vector.flatten_toChunks
theorem flatten_toChunks {α : Type} (m : ℕ+) (v : Vector (Vector α m) n) : v.flatten.toChunks m = v
clean
Clean/Utils/Vector.lean
[ "import Mathlib.Combinatorics.Enumerative.Composition", "import Mathlib.Analysis.Normed.Ring.Lemmas", "import Init.Data.List.Find" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Vector.mk", "module": "Init.Data.Vector.Basic" }, { "name": "Composition", "module": "Mathlib.Combinatorics.Enumerative.Composition" }, { "name": "Co...
[ { "name": "...", "content": "..." } ]
[ { "name": "Array.length_toList", "module": "Init.Data.Array.Lemmas" }, { "name": "Array.toArray_toList", "module": "Init.Data.Array.Basic" }, { "name": "Array.toList_flatten", "module": "Init.Data.Array.Lemmas" }, { "name": "Array.toList_inj", "module": "Init.Data.Array.L...
[ { "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": "Vector.cons", "content": "def cons (a : α) (v : Vector α n) : Vector α (n + 1) :=\n ⟨ .mk (a :: v.toList), by admit /- proof elided -/\n ⟩" }, { "name": "Vector.induct", "content": "def induct {motive : {n : ℕ} → Vector α n → Sort u}\n (nil : motive #v[])\n (cons: ∀ {n : ℕ} (a...
[ { "name": "Vector.toList_cons", "content": "theorem toList_cons {a : α} {v : Vector α n} : (cons a v).toList = a :: v.toList" } ]
import Mathlib.Analysis.Normed.Ring.Lemmas import Mathlib.Combinatorics.Enumerative.Composition import Init.Data.List.Find variable {α β : Type} {n m : ℕ} open Vector (finRange) namespace Vector def cons (a : α) (v : Vector α n) : Vector α (n + 1) := ⟨ .mk (a :: v.toList), by admit /- proof elided -/ ⟩ def i...
theorem flatten_toChunks {α : Type} (m : ℕ+) (v : Vector (Vector α m) n) : v.flatten.toChunks m = v :=
:= by simp only [toChunks] rw [←Vector.toArray_inj,←Array.toList_inj] simp only let v_list_list := v.toList.map (Array.toList ∘ toArray) have h_flatten : v.flatten.toList = v_list_list.flatten := by rw [Vector.flatten_mk, Vector.toList_mk, Array.toList_flatten, Array.toList_map, List.map_map] congr ...
3
39
true
Applied verif.
140
Tables.Fibonacci32.fib_constraints
lemma fib_constraints (curr next : Row (F p) RowType) (aux_env : Environment (F p)) : recursiveRelation.ConstraintsHoldOnWindow ⟨<+> +> curr +> next, rfl⟩ aux_env → curr.y = next.x ∧ (curr.x.Normalized → curr.y.Normalized → next.y.value = (curr.x.value + curr.y.value) % 2^32 ∧ next.y.Normalized)
clean
Clean/Tables/Fibonacci32.lean
[ "import Clean.Types.U32", "import Clean.Utils.Vector", "import Clean.Gadgets.Equality", "import Clean.Gadgets.Addition32.Addition32", "import Clean.Circuit.Basic", "import Clean.Table.Theorems" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "List", "module": "Init.Prelude" }, ...
[ { "name": "syntax \"let \" ident \" <== \" term : doElem", "content": "syntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem\n\nsyntax \"infer_constant_length\" : tactic" }, { "name": "@[inherit_doc] notation:67 \"<+>\" => Trace.empty", "cont...
[ { "name": "Fin.cast_mk", "module": "Init.Data.Fin.Lemmas" }, { "name": "List.getElem_cons_succ", "module": "Init.GetElem" }, { "name": "List.getElem_cons_zero", "module": "Init.GetElem" }, { "name": "List.getElem_toArray", "module": "Init.Data.Array.Basic" }, { "n...
[ { "name": "mapRange_zero", "content": "theorem mapRange_zero {create : ℕ → α} : mapRange 0 create = #v[]" }, { "name": "mapFinRange_succ", "content": "theorem mapFinRange_succ {n : ℕ} {create : Fin (n + 1) → α} :\n mapFinRange (n + 1) create = (mapFinRange n (fun i => create i.castSucc)).push...
[ { "name": "Tables.Fibonacci32.RowType", "content": "structure RowType (F : Type) where\n x: U32 F\n y: U32 F" }, { "name": "Tables.Fibonacci32.nextRowOff", "content": "@[reducible]\ndef nextRowOff : RowType (CellOffset 2 RowType) := {\n x := ⟨.next 0, .next 1, .next 2, .next 3⟩,\n y := ⟨.nex...
[ { "name": "Tables.Fibonacci32.fib_assignment", "content": "lemma fib_assignment : (recursiveRelation (p:=p)).finalAssignment.vars =\n #v[.input ⟨0, 0⟩, .input ⟨0, 1⟩, .input ⟨0, 2⟩, .input ⟨0, 3⟩, .input ⟨0, 4⟩, .input ⟨0, 5⟩, .input ⟨0, 6⟩,\n .input ⟨0, 7⟩, .input ⟨1, 0⟩, .input ⟨1, 1⟩, .input ⟨1, 2...
import Clean.Utils.Vector import Clean.Circuit.Basic import Clean.Table.Theorems import Clean.Gadgets.Addition32.Addition32 import Clean.Gadgets.Equality import Clean.Types.U32 namespace Tables.Fibonacci32 variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] structure RowType (F : Type) where x: U...
lemma fib_constraints (curr next : Row (F p) RowType) (aux_env : Environment (F p)) : recursiveRelation.ConstraintsHoldOnWindow ⟨<+> +> curr +> next, rfl⟩ aux_env → curr.y = next.x ∧ (curr.x.Normalized → curr.y.Normalized → next.y.value = (curr.x.value + curr.y.value) % 2^32 ∧ next.y.Normalized) :=
:= by simp only [table_norm] obtain ⟨ hcurr_x, hcurr_y, hnext_x, hnext_y ⟩ := fib_vars curr next aux_env set env := recursiveRelation.windowEnv ⟨<+> +> curr +> next, rfl⟩ aux_env simp only [table_norm, circuit_norm, recursiveRelation, assignU32, Gadgets.Addition32.circuit] rintro ⟨ h_add, h_eq ⟩ simp o...
17
142
true
Applied verif.
141
MemoryAccessList.isConsistentOnline_iff_sorted_isConsistentOffline
theorem MemoryAccessList.isConsistentOnline_iff_sorted_isConsistentOffline (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) (h_nodup : accesses.Notimestampdup) : MemoryAccessList.isConsistentOnline accesses h_sorted ↔ MemoryAccessList.isConsistentOffline (MemoryAccessList.addres...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.insertionSort", "module": "Mathlib.Data.List.Sort" }, { "name": "List.Pairwise", "module": "Init.Data.List.Basic" }, { "name": "List.filte...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise.of_cons", "module": "Init.Data.List.Pairwise" }, { "name": "List.filter_eq_nil_iff", "module": "Init.Data.List.Lemmas" }, { "name": "List.mem_cons_self", "module": "Init.Data....
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.addressTimestampSort_sorted", "content": "theorem MemoryAccessList.addressTimestampSort_sorted (accesses : MemoryAccessList) :\n (MemoryAccessList.addressTimestampSort accesses).Sorted address_timestamp_ordering" }, { "name": "MemoryAccessList.addressTimestampSort_perm...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistentOnline_iff_sorted_isConsistentOffline (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) (h_nodup : accesses.Notimestampdup) : MemoryAccessList.isConsistentOnline accesses h_sorted ↔ MemoryAccessList.isConsistentOffline (MemoryAccessList.addres...
:= by rw [isConsistent_iff_all_single_address] -- Use isConsistentOffline_iff_all_single_addresses rw [isConsistentOffline_iff_all_single_addresses (addressTimestampSort accesses) (addressTimestampSort_sorted accesses) (addressTimestampSort_noTimestampDup accesses h_nodup)] -- Now use filterAddress_addr...
5
84
true
Applied verif.
142
U32.value_injective_on_normalized
omit p_large_enough in lemma value_injective_on_normalized (x y : U32 (F p)) (hx : x.Normalized) (hy : y.Normalized) : x.value = y.value → x = y
clean
Clean/Types/U32.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Subcircuit", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Clean.Utils.Bitwise", "import Clean.Circuit.Extensions", "import Clean.Gadgets.ByteLookup" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|infer_constant_length) => `(tactic|(\n apply ConstantLength.fromConstantLength\n try simp only [circuit_norm]\n ...
[ { "name": "ZMod.val_injective", "module": "Mathlib.Data.ZMod.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": "U32", "content": "structure U32 (T : Type) where\n x0 : T\n x1 : T\n x2 : T\n x3 : T\nderiving DecidableEq" }, { "name": "U32.map", "content": "def map {α β : Type} (x : U32 α) (f : α → β) : U32 β :=\n ⟨ f x.x0, f x.x1, f x.x2, f x.x3 ⟩" }, { "name": "U32.Normalized", ...
[ { "name": "U32.value_horner", "content": "omit [Fact (Nat.Prime p)] p_large_enough in\ntheorem value_horner (x : U32 (F p)) : x.value =\n x.x0.val + 2^8 * (x.x1.val + 2^8 * (x.x2.val + 2^8 * x.x3.val))" } ]
import Clean.Gadgets.ByteLookup import Clean.Circuit.Extensions import Clean.Utils.Bitwise import Clean.Circuit.Provable import Clean.Utils.Primes import Clean.Circuit.Subcircuit import Clean.Gadgets.Equality section variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] structure U32 (T : Type) wher...
omit p_large_enough in lemma value_injective_on_normalized (x y : U32 (F p)) (hx : x.Normalized) (hy : y.Normalized) : x.value = y.value → x = y :=
:= by intro h_eq -- Use horner form of value have hx_value := U32.value_horner x have hy_value := U32.value_horner y simp only [U32.Normalized] at hx hy have : x.x0 = y.x0 := by apply ZMod.val_injective; omega have : x.x1 = y.x1 := by apply ZMod.val_injective; omega have : x.x2 = y.x2 := by apply ZMod...
7
58
true
Applied verif.
143
MemoryAccessList.isConsistentSingleAddress_cons_forall
theorem MemoryAccessList.isConsistentSingleAddress_cons_forall (head : MemoryAccess) (tail : MemoryAccessList) (h_sorted : isTimestampSorted (head :: tail)) : (∀ addr : ℕ, (filterAddress (head :: tail) addr).isConsistentSingleAddress (MemoryAccessList.filterAddress_sorted (head :: tail) h_sorted addr)) → (∀...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.filter", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.filter_cons", "module": "Init.Data.List.Lemmas" }, { "name": "List.sorted_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.So...
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.filterAddress_sorted", "content": "theorem MemoryAccessList.filterAddress_sorted (accesses : MemoryAccessList)\n (h : accesses.isTimestampSorted) (addr : ℕ) :\n (MemoryAccessList.filterAddress accesses addr).isTimestampSorted" }, { "name": "MemoryAccessList.filterAd...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistentSingleAddress_cons_forall (head : MemoryAccess) (tail : MemoryAccessList) (h_sorted : isTimestampSorted (head :: tail)) : (∀ addr : ℕ, (filterAddress (head :: tail) addr).isConsistentSingleAddress (MemoryAccessList.filterAddress_sorted (head :: tail) h_sorted addr)) → (∀...
:= by intro h addr' obtain ⟨t_head, a_head, r_head, w_head⟩ := head simp_all [MemoryAccessList.filterAddress_cons] specialize h addr' by_cases h_addr : a_head = addr' · simp_all only [↓reduceIte] rw [h_addr] at h_sorted have tail_sorted : tail.isTimestampSorted := by unfold isTimestampSorted a...
2
16
true
Applied verif.
144
Utils.StateTransition.acyclic_containsPath_nodup
lemma acyclic_containsPath_nodup (R : Run S) (path : List S) (h_acyclic : R.isAcyclic) (h_contains : R.containsPath path) : path.Nodup
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sublist", "module": "Init.Data.List.Basic" }, { "name": "List.count", "module": "Init.Data.List.Basic" }, { "name": "List.drop", "module": "Init....
[ { "name": "...", "content": "..." } ]
[ { "name": "List.drop_succ_cons", "module": "Init.Data.List.Basic" }, { "name": "List.tail_cons", "module": "Init.Data.List.Basic" }, { "name": "List.zip_cons_cons", "module": "Init.Data.List.Basic" }, { "name": "List.Sublist.count_le", "module": "Init.Data.List.Count" }...
[ { "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.countTransitionInPath", "content": "def countTransitionInP...
[ { "name": "Utils.StateTransition.zip_drop_sublist", "content": "lemma zip_drop_sublist (l : List S) (n : ℕ) :\n ((l.drop n).zip (l.drop (n + 1))).Sublist (l.zip l.tail)" }, { "name": "Utils.StateTransition.containsPath_drop", "content": "lemma containsPath_drop (R : Run S) (path : List S) (n ...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma acyclic_containsPath_nodup (R : Run S) (path : List S) (h_acyclic : R.isAcyclic) (h_contains : R.containsPath path) : path.Nodup :=
:= by -- Proof by contradiction: if path has duplicates, extract a cycle by_contra h_dup -- If path is not Nodup, there exists an element that appears twice rw [← List.exists_duplicate_iff_not_nodup] at h_dup obtain ⟨x, h_duplicate⟩ := h_dup -- x appears at least twice in path, at distinct positions rw [L...
4
44
true
Applied verif.
145
Gadgets.And.And8.completeness
theorem completeness : Completeness (F p) elaborated Assumptions
clean
Clean/Gadgets/And/And8.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Utils.Field", "import Clean.Circuit.Basic", "import Clean.Utils.Primes" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tactic|(\n intros\n repeat rw [ZMod.val_add] \n ...
[ { "name": "Fact.elim", "module": "Mathlib.Logic.Basic" }, { "name": "Nat.and_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemm...
[ { "name": "val_lt_p", "content": "theorem val_lt_p {p : ℕ} (x : ℕ) : (x < p) → (x : F p).val = x" }, { "name": "natToField_eq", "content": "theorem natToField_eq {n : ℕ} {lt : n < p} (x : F p) (hx : x = natToField n lt) : x.val = n" }, { "name": "natToField_eq_natCast", "content": "t...
[ { "name": "Gadgets.And.And8.Inputs", "content": "structure Inputs (F : Type) where\n x: F\n y: F" }, { "name": "Gadgets.And.And8.Assumptions", "content": "def Assumptions (input : Inputs (F p)) :=\n let ⟨x, y⟩ := input\n x.val < 256 ∧ y.val < 256" }, { "name": "Gadgets.And.And8.main"...
[ { "name": "Gadgets.And.And8.and_times_two_add_xor", "content": "theorem and_times_two_add_xor {x y : ℕ} (hx : x < 256) (hy : y < 256) : 2 * (x &&& y) + (x ^^^ y) = x + y" }, { "name": "Gadgets.And.And8.two_and_le_add", "content": "theorem two_and_le_add {x y : ℕ} (hx : x < 256) (hy : y < 256) : ...
import Clean.Circuit.Basic import Clean.Gadgets.Xor.ByteXorTable import Clean.Utils.Primes variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] namespace Gadgets.And.And8 open Xor (ByteXorTable) open FieldUtils structure Inputs (F : Type) where x: F y: F def Assumptions (input : Inputs (F p)) :=...
theorem completeness : Completeness (F p) elaborated Assumptions :=
:= by intro i env ⟨ x_var, y_var ⟩ h_env ⟨ x, y ⟩ h_input h_assumptions simp_all only [circuit_norm, main, Assumptions, ByteXorTable, Inputs.mk.injEq] obtain ⟨ hx_byte, hy_byte ⟩ := h_assumptions set w : F p := ZMod.val x &&& ZMod.val y have hw : w = ZMod.val x &&& ZMod.val y := rfl let z := x + y + -(2*w) ...
8
110
true
Applied verif.
146
Utils.StateTransition.acyclic_run_has_path_from_source_to_sink
lemma acyclic_run_has_path_from_source_to_sink (R : Run S) (s d : S) (h_acyclic : R.isAcyclic) (h_source : R.netFlow s = 1) (h_others : ∀ x, x ≠ s → x ≠ d → R.netFlow x = 0) : ∃ (path : List S), path.head? = some s ∧ path.getLast? = some d ∧ path ≠ [] ∧ R.containsPath path ∧ path.Nodup
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sublist", "module": "Init.Data.List.Basic" }, { "name": "List.count", "module": "In...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.drop_succ_cons", "module": "Init.Data.List.Basic" }, { "name": "List.tail_cons", "module": "Init.Data.List.Basic" }, { "name": "List.zip_cons_cons", "module": "Init.Data.List.Basic" }, { "name": "List.Sublist.count_le", "module": "Init.Data.List.Count" }...
[ { "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.Run.netFlow", "content": "noncomputable def Run.netFlow {S...
[ { "name": "Utils.StateTransition.finset_ssubset_univ_of_not_mem", "content": "lemma finset_ssubset_univ_of_not_mem {α : Type*} [Fintype α] (s : Finset α) (x : α)\n (h : x ∉ s) :\n s ⊂ Finset.univ" }, { "name": "Utils.StateTransition.containsPath_has_positive_transition", "content": "lemma ...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma acyclic_run_has_path_from_source_to_sink (R : Run S) (s d : S) (h_acyclic : R.isAcyclic) (h_source : R.netFlow s = 1) (h_others : ∀ x, x ≠ s → x ≠ d → R.netFlow x = 0) : ∃ (path : List S), path.head? = some s ∧ path.getLast? = some d ∧ path ≠ [] ∧ R.containsPath path ∧ path.Nodup :=
:= by -- s has positive net flow, so it has an outgoing edge have h_s_out : ∃ y, R (s, y) > 0 := by apply positive_netFlow_has_outgoing_edge rw [h_source] omega -- Find a leaf reachable from s obtain ⟨leaf, h_leaf⟩ := acyclic_has_leaf R s h_acyclic h_s_out -- The leaf has negative net flow hav...
8
122
true
Applied verif.
147
Circuit.FoldlM.operations_eq
theorem operations_eq : (Vector.foldlM circuit init xs).operations n = (List.ofFn fun i => (circuit (foldlAcc n xs circuit init i) xs[i.val]).operations (n + i * constant.localLength)).flatten
clean
Clean/Circuit/Loops.lean
[ "import Clean.Utils.Misc", "import Clean.Circuit.Subcircuit", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name":...
[ { "name": "Circuit", "content": "def Circuit (F : Type) [Field F] (α : Type) := ℕ → α × List (Operation F)" }, { "name": "Operation", "content": "inductive Operation (F : Type) [Field F] where\n | witness : (m : ℕ) → (compute : Environment F → Vector F m) → Operation F\n | assert : Expression ...
[ { "name": "Fin.foldl_zero", "module": "Init.Data.Fin.Fold" }, { "name": "List.foldlM_toArray", "module": "Init.Data.List.ToArray" }, { "name": "Vector.foldlM_mk", "module": "Init.Data.Vector.Lemmas" }, { "name": "List.foldlM_cons", "module": "Init.Data.List.Control" }, ...
[ { "name": "bind_operations_eq", "content": "theorem bind_operations_eq (f : Circuit F α) (g : α → Circuit F β) (n : ℕ) :\n (f >>= g).operations n = f.operations n ++ (g (f.output n)).operations (n + f.localLength n)" } ]
[ { "name": "Circuit.FoldlM.prod", "content": "@[reducible]\ndef prod (circuit : β → α → Circuit F β) : β × α → Circuit F β := fun t => circuit t.1 t.2" }, { "name": "Circuit.FoldlM.foldlAcc", "content": "def foldlAcc (n : ℕ) (xs : Vector α m) (circuit : β → α → Circuit F β) (init : β) (j : Fin m)...
[ { "name": "Vector.foldlM_toList", "content": "lemma Vector.foldlM_toList (xs : Vector α n) {m : Type → Type} [Monad m] (body : β → α → m β) (init : β) :\n xs.foldlM body init = xs.toList.foldlM body init" }, { "name": "Circuit.FoldlM.foldlM_cons", "content": "lemma foldlM_cons (x : α) :\n (V...
import Clean.Circuit.Subcircuit import Clean.Utils.Misc variable {n m : ℕ} {F : Type} [Field F] {α β : Type} namespace Circuit variable {prop : Condition F} namespace ForM variable {circuit : α → Circuit F Unit} (xs : Vector α m) (constant : ConstantLength circuit) (n : ℕ) end ForM namespace MapM variable {cir...
theorem operations_eq : (Vector.foldlM circuit init xs).operations n = (List.ofFn fun i => (circuit (foldlAcc n xs circuit init i) xs[i.val]).operations (n + i * constant.localLength)).flatten :=
:= by induction xs using Vector.induct generalizing n init with | nil => rfl | cons x xs ih => rw [foldlM_cons, bind_operations_eq, ih, List.ofFn_succ, List.flatten_cons] simp only [foldlAcc_cons_succ, foldlAcc_zero] simp +arith [Vector.cons, add_mul, constant.localLength_eq (init, x)]
6
72
true
Applied verif.
148
FlatOperation.localWitnesses_toFlat
lemma localWitnesses_toFlat {ops : Operations F} {env} : (localWitnesses env ops.toFlat).toArray = (ops.localWitnesses env).toArray
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, ...
[ { "name": "toFlat", "content": "def toFlat : Operations F → List (FlatOperation F)\n | [] => []\n | .witness m c :: ops => .witness m c :: toFlat ops\n | .assert e :: ops => .assert e :: toFlat ops\n | .lookup l :: ops => .lookup l :: toFlat ops\n | .subcircuit s :: ops => s.ops ++ toFlat ops" }, {...
[ { "name": "Array.append_assoc", "module": "Init.Data.Array.Bootstrap" }, { "name": "Array.empty_append", "module": "Init.Data.Array.Bootstrap" }, { "name": "List.cons_append", "module": "Init.Data.List.Basic" }, { "name": "List.nil_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": "FlatOperation.localWitnesses_append", "content": "lemma localWitnesses_append {F} {a b: List (FlatOperation F)} {env} :\n (localWitnesses env (a ++ b)).toArray = (localWitnesses env a).toArray ++ (localWitnesses env b).toArray" } ]
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit end Circuit namespace FlatOperation
lemma localWitnesses_toFlat {ops : Operations F} {env} : (localWitnesses env ops.toFlat).toArray = (ops.localWitnesses env).toArray :=
:= by induction ops using Operations.induct with | empty => trivial | witness _ _ _ ih | assert _ _ ih | lookup _ _ ih | subcircuit _ _ ih => simp only [Operations.toFlat, Operations.localLength, Operations.localWitnesses, Vector.toArray_append] rw [←ih] try rw [localWitnesses_append] try simp onl...
9
47
true
Applied verif.
149
Tables.KeccakInductive.tableStatement
theorem tableStatement (output : KeccakState (F p)) : ∀ n > 0, ∀ trace, ∃ blocks, blocks.length = n - 1 ∧ (formalTable output).statement n trace → output.Normalized ∧ output.value = absorbBlocks blocks
clean
Clean/Tables/KeccakInductive.lean
[ "import Clean.Utils.Vector", "import Clean.Table.Basic", "import Clean.Gadgets.Keccak.AbsorbBlock", "import Clean.Types.U64", "import Clean.Circuit.Extensions", "import Clean.Table.Inductive", "import Clean.Specs.Keccak256" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "String", "module": "Init.Prelude" }...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "@[inherit_doc] notation:67 \"<+>\" => Trace.empty", "content"...
[ { "name": "Fin.val_zero", "module": "Init.Data.Fin.Lemmas" }, { "name": "Vector.getElem_map", "module": "Init.Data.Vector.Lemmas" }, { "name": "List.length_map", "module": "Init.Data.List.Lemmas" }, { "name": "true_and", "module": "Init.SimpLemmas" } ]
[ { "name": "fromByte_value", "content": "lemma fromByte_value {x : Fin 256} : (fromByte x).value (p:=p) = x" }, { "name": "getElem_fill", "content": "theorem getElem_fill {n} {a : α} {i : ℕ} {hi : i < n} :\n (fill n a)[i] = a" }, { "name": "fromByte_normalized", "content": "lemma f...
[ { "name": "Tables.KeccakInductive.table", "content": "def table : InductiveTable (F p) KeccakState KeccakBlock where\n step state block := do\n KeccakBlock.normalized block\n AbsorbBlock.circuit { state, block }\n\n Spec _ blocks i _ state : Prop :=\n state.Normalized\n ∧ state.value = absorbB...
[ { "name": "Tables.KeccakInductive.initialState_value", "content": "lemma initialState_value : (initialState (p:=p)).value = .fill 25 0" }, { "name": "Tables.KeccakInductive.initialState_normalized", "content": "lemma initialState_normalized : (initialState (p:=p)).Normalized" } ]
import Clean.Table.Inductive import Clean.Circuit.Extensions import Clean.Gadgets.Keccak.AbsorbBlock import Clean.Specs.Keccak256 open Specs.Keccak256 variable {p : ℕ} [Fact p.Prime] [Fact (p > 2 ^ 16 + 2 ^ 8)] namespace Tables.KeccakInductive open Gadgets.Keccak256 def table : InductiveTable (F p) KeccakState ...
theorem tableStatement (output : KeccakState (F p)) : ∀ n > 0, ∀ trace, ∃ blocks, blocks.length = n - 1 ∧ (formalTable output).statement n trace → output.Normalized ∧ output.value = absorbBlocks blocks :=
:= by intro n hn trace use (InductiveTable.traceInputs trace.tail).map KeccakBlock.value intro Spec simp only [formalTable, FormalTable.statement, table, InductiveTable.toFormal] at Spec simp only [List.length_map, Trace.toList_length, trace.tail.prop, InductiveTable.traceInputs, hn] at Spec simp only [init...
24
288
true
Applied verif.
150
Environment.usesLocalWitnessesFlat_iff_extends
theorem usesLocalWitnessesFlat_iff_extends {env : Environment F} (n : ℕ) {ops : List (FlatOperation F)} : env.UsesLocalWitnessesFlat n ops ↔ env.ExtendsVector (localWitnesses env ops) n
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, ...
[ { "name": "FlatOperation.singleLocalLength", "content": "def FlatOperation.singleLocalLength : FlatOperation F → ℕ\n | .witness m _ => m\n | .assert _ => 0\n | .lookup _ => 0" }, { "name": "FlatOperation", "content": "inductive FlatOperation (F : Type) where\n | witness : (m : ℕ) → (Environm...
[ { "name": "Vector.getElem_append", "module": "Init.Data.Vector.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": "FlatOperation.forAll_empty", "content": "theorem forAll_empty {condition : Condition F} {n : ℕ} : forAll n condition [] = True" }, { "name": "FlatOperation.forAll_cons", "content": "theorem forAll_cons {condition : Condition F} {offset : ℕ} {op : FlatOperation F} {ops : List (FlatOper...
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit end Circuit namespace FlatOperation end FlatOperation namespace Environment open FlatOperation (localLength localWitnesses)
theorem usesLocalWitnessesFlat_iff_extends {env : Environment F} (n : ℕ) {ops : List (FlatOperation F)} : env.UsesLocalWitnessesFlat n ops ↔ env.ExtendsVector (localWitnesses env ops) n :=
:= by induction ops using FlatOperation.induct generalizing n with | empty => simp [UsesLocalWitnessesFlat, FlatOperation.forAll_empty, ExtendsVector, localLength] | witness m _ _ ih => rw [UsesLocalWitnessesFlat, FlatOperation.forAll, env_extends_witness,←ih (m + n)] trivial | assert | lookup => si...
7
41
true
Applied verif.
151
Gadgets.Or.Or8.soundness
theorem soundness : Soundness (F p) elaborated Assumptions Spec
clean
Clean/Gadgets/Or/Or8.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Utils.Field", "import Clean.Circuit.Basic" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tactic|(\n intros\n repeat rw [ZMod.val_add] \n ...
[ { "name": "BitVec.toNat_ofNat", "module": "Init.Data.BitVec.Bootstrap" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.or_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.N...
[ { "name": "mul_nat_val_of_dvd", "content": "theorem mul_nat_val_of_dvd {x : F p} (c : ℕ) (c_lt : c < p) {z : ℕ} :\n (c * x).val = c * z → (c * x).val = c * x.val" }, { "name": "mul_val_of_dvd", "content": "theorem mul_val_of_dvd {x c : F p} :\n c.val ∣ (c * x).val → (c * x).val = c.val * x...
[ { "name": "Gadgets.Or.Or8.Inputs", "content": "structure Inputs (F : Type) where\n x: F\n y: F" }, { "name": "Gadgets.Or.Or8.Assumptions", "content": "def Assumptions (input : Inputs (F p)) :=\n let ⟨x, y⟩ := input\n x.val < 256 ∧ y.val < 256" }, { "name": "Gadgets.Or.Or8.Spec", ...
[ { "name": "Gadgets.Or.Or8.or_times_two_sub_xor", "content": "private theorem or_times_two_sub_xor {x y : ℕ} (hx : x < 256) (hy : y < 256) :\n 2 * (x ||| y) = x + y + (x ^^^ y)" } ]
import Clean.Circuit.Basic import Clean.Gadgets.Xor.ByteXorTable variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] namespace Gadgets.Or.Or8 open Xor (ByteXorTable) open FieldUtils structure Inputs (F : Type) where x: F y: F def Assumptions (input : Inputs (F p)) := let ⟨x, y⟩ := input x.va...
theorem soundness : Soundness (F p) elaborated Assumptions Spec :=
:= by intro i env ⟨ x_var, y_var ⟩ ⟨ x, y ⟩ h_input h_assumptions h_constraint simp_all only [circuit_norm, main, Assumptions, Spec, ByteXorTable, Inputs.mk.injEq] have ⟨ hx_byte, hy_byte ⟩ := h_assumptions set w := env.get i -- The constraint from lookup is about xor = 2*or - x - y -- which in field arithm...
7
114
false
Applied verif.
152
Gadgets.Not.not_bytewise_value_spec
theorem not_bytewise_value_spec {x : U64 (F p)} (x_lt : x.Normalized) : (not64_bytewise_value x).value = not64 x.value ∧ (not64_bytewise_value x).Normalized
clean
Clean/Gadgets/Not/Not64.lean
[ "import Clean.Utils.Primes", "import Clean.Utils.Bitwise", "import Clean.Types.U64", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|infer_constant_length) => `(tactic|(\n apply ConstantLength.fromConstantLength\n try simp only [circuit_norm]\n ...
[ { "name": "Nat.cast_sub", "module": "Mathlib.Data.Int.Cast.Basic" }, { "name": "Nat.le_pred_of_lt", "module": "Init.Data.Nat.Basic" }, { "name": "Int.ofNat_lt", "module": "Init.Data.Int.Order" }, { "name": "Nat.sub_one_sub_lt_of_lt", "module": "Init.Data.Nat.Basic" }, ...
[ { "name": "not64_eq_sub", "content": "theorem not64_eq_sub {x : ℕ} (x_lt : x < 2^64) :\n not64 x = 2^64 - 1 - x" }, { "name": "value_lt_of_normalized", "content": "omit [Fact (Nat.Prime p)] p_large_enough in\ntheorem value_lt_of_normalized {x : U64 (F p)} (hx : x.Normalized) : x.value < 2^64"...
[ { "name": "Gadgets.Not.not64_bytewise_value", "content": "def not64_bytewise_value (x : U64 (F p)) : U64 (F p) := x.map (fun x => 255 - x)" } ]
[ { "name": "Gadgets.Not.not_zify", "content": "theorem not_zify (n : ℕ) {x : ℕ} (hx : x < n) : ((n - 1 - x : ℕ) : ℤ) = ↑n - 1 - ↑x" }, { "name": "Gadgets.Not.not_lt", "content": "theorem not_lt (n : ℕ) {x : ℕ} (hx : x < n) : n - 1 - (x : ℤ) < n" } ]
import Clean.Utils.Primes import Clean.Circuit.Basic import Clean.Utils.Field import Clean.Types.U64 section variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] namespace Gadgets.Not def not64_bytewise_value (x : U64 (F p)) : U64 (F p) := x.map (fun x => 255 - x)
theorem not_bytewise_value_spec {x : U64 (F p)} (x_lt : x.Normalized) : (not64_bytewise_value x).value = not64 x.value ∧ (not64_bytewise_value x).Normalized :=
:= by rw [not64_eq_sub (U64.value_lt_of_normalized x_lt)] have h_not_val : ∀ {x : F p}, x.val < 256 → ((255 - x).val : ℤ) = 255 - ↑x.val := by intro x hx have val_255 : (255 : F p).val = 255 := FieldUtils.val_lt_p 255 (by linarith [p_large_enough.elim]) have hx' : x.val ≤ (255 : F p).val := by linarit...
7
70
true
Applied verif.
153
Gadgets.And.And8.soundness
theorem soundness : Soundness (F p) elaborated Assumptions Spec
clean
Clean/Gadgets/And/And8.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Utils.Field", "import Clean.Circuit.Basic", "import Clean.Utils.Primes" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tactic|(\n intros\n repeat rw [ZMod.val_add] \n ...
[ { "name": "Nat.and_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "UInt16.toNat_ofNat_of_lt", "module": "In...
[ { "name": "mul_nat_val_of_dvd", "content": "theorem mul_nat_val_of_dvd {x : F p} (c : ℕ) (c_lt : c < p) {z : ℕ} :\n (c * x).val = c * z → (c * x).val = c * x.val" }, { "name": "mul_val_of_dvd", "content": "theorem mul_val_of_dvd {x c : F p} :\n c.val ∣ (c * x).val → (c * x).val = c.val * x...
[ { "name": "Gadgets.And.And8.Inputs", "content": "structure Inputs (F : Type) where\n x: F\n y: F" }, { "name": "Gadgets.And.And8.Assumptions", "content": "def Assumptions (input : Inputs (F p)) :=\n let ⟨x, y⟩ := input\n x.val < 256 ∧ y.val < 256" }, { "name": "Gadgets.And.And8.Spec"...
[ { "name": "Gadgets.And.And8.and_times_two_add_xor", "content": "theorem and_times_two_add_xor {x y : ℕ} (hx : x < 256) (hy : y < 256) : 2 * (x &&& y) + (x ^^^ y) = x + y" }, { "name": "Gadgets.And.And8.xor_le_add", "content": "theorem xor_le_add {x y : ℕ} (hx : x < 256) (hy : y < 256) : x ^^^ y ...
import Clean.Circuit.Basic import Clean.Gadgets.Xor.ByteXorTable import Clean.Utils.Primes variable {p : ℕ} [Fact p.Prime] [p_large_enough: Fact (p > 512)] namespace Gadgets.And.And8 open Xor (ByteXorTable) open FieldUtils structure Inputs (F : Type) where x: F y: F def Assumptions (input : Inputs (F p)) :=...
theorem soundness : Soundness (F p) elaborated Assumptions Spec :=
:= by intro i env ⟨ x_var, y_var ⟩ ⟨ x, y ⟩ h_input h_assumptions h_xor simp_all only [circuit_norm, main, Assumptions, Spec, ByteXorTable, Inputs.mk.injEq] have ⟨ hx_byte, hy_byte ⟩ := h_assumptions set w := env.get i set z := x + y + -(2*w) show w.val = x.val &&& y.val -- it's easier to prove something...
8
109
true
Applied verif.
154
MemoryAccessList.isConsistentOnline_filter_of_consistentOnline
theorem MemoryAccessList.isConsistentOnline_filter_of_consistentOnline (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) (h_consistent : MemoryAccessList.isConsistentOnline accesses h_sorted) (addr : ℕ) : MemoryAccessList.isConsistentOnline (MemoryAccessList.filterAddress accesses addr) (Mem...
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "And", "module": "Init.Prelude" } ]
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Sorted.filter", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Sorted.of_cons", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.filter_cons", "module": "Init.Data.List.Lemmas" }, { "name": "List.filter_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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.filterAddress_sorted", "content": "theorem MemoryAccessList.filterAddress_sorted (accesses : MemoryAccessList)\n (h : accesses.isTimestampSorted) (addr : ℕ) :\n (MemoryAccessList.filterAddress accesses addr).isTimestampSorted" }, { "name": "MemoryAccessList.lastWrit...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
theorem MemoryAccessList.isConsistentOnline_filter_of_consistentOnline (accesses : MemoryAccessList) (h_sorted : accesses.isTimestampSorted) (h_consistent : MemoryAccessList.isConsistentOnline accesses h_sorted) (addr : ℕ) : MemoryAccessList.isConsistentOnline (MemoryAccessList.filterAddress accesses addr) (Mem...
:= by induction accesses with | nil => simp only [filterAddress, List.filter_nil, isConsistentOnline] | cons head tail ih => obtain ⟨t, a, r, w⟩ := head simp [filterAddress, List.filter_cons, isConsistentOnline] at ⊢ h_consistent ih have h_sorted' : isTimestampSorted tail := by unfold isTime...
3
17
true
Applied verif.
155
Circomlib.MultiAND.localLength_eq
theorem localLength_eq (n : ℕ) (input : Var (fields n) (F p)) (offset : ℕ) : (main input).localLength offset = n - 1
clean
Clean/Circomlib/Gates.lean
[ "import Clean.Circuit.Theorems", "import Clean.Utils.Field", "import Clean.Circuit", "import Mathlib.Data.Nat.Bitwise", "import Clean.Gadgets.Boolean", "import Clean.Utils.Bitwise", "import Clean.Utils.BinaryOps", "import Clean.Utils.Vector" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let $x <...
[ { "name": "Nat.add_one_sub_one", "module": "Init.Data.Nat.Basic" }, { "name": "Nat.strong_induction_on", "module": "Mathlib.Data.Nat.Init" } ]
[ { "name": "bind_localLength_eq", "content": "theorem bind_localLength_eq (f : Circuit F α) (g : α → Circuit F β) (n : ℕ) :\n (f >>= g).localLength n = f.localLength n + (g (f.output n)).localLength (n + f.localLength n)" }, { "name": "append_localLength", "content": "@[circuit_norm]\ntheorem ...
[ { "name": "Circomlib.AND.main", "content": "def main (input : Expression (F p) × Expression (F p)) := do\n let a := input.1\n let b := input.2\n let out <== a*b\n return out" }, { "name": "Circomlib.MultiAND.main", "content": "def main : {n : ℕ} → Vector (Expression (F p)) n → Circuit (F p) ...
[]
import Clean.Circuit import Clean.Utils.Field import Clean.Gadgets.Boolean import Clean.Utils.Bitwise import Clean.Utils.Vector import Clean.Utils.BinaryOps import Clean.Circuit.Theorems import Mathlib.Data.Nat.Bitwise open IsBool namespace Circomlib variable {p : ℕ} [Fact p.Prime] open Circuit (bind_output_...
theorem localLength_eq (n : ℕ) (input : Var (fields n) (F p)) (offset : ℕ) : (main input).localLength offset = n - 1 :=
:= by induction n using Nat.strong_induction_on generalizing offset with | _ n IH => match n with | 0 => simp only [main] rfl | 1 => simp only [main] rfl | 2 => simp only [main] simp only [Nat.add_one_sub_one] have h := AND.circuit.localLength_eq (input[0], ...
9
87
true
Applied verif.
156
FlatOperation.localLength_toFlat
lemma localLength_toFlat {ops : Operations F} : localLength ops.toFlat = ops.localLength
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, ...
[ { "name": "ConstantLength", "content": "class ConstantLength (circuit : α → Circuit F β) where\n localLength : ℕ\n localLength_eq : ∀ (a : α) (n : ℕ), (circuit a).localLength n = localLength" }, { "name": "toFlat", "content": "def toFlat : Operations F → List (FlatOperation F)\n | [] => []\n ...
[ { "name": "List.cons_append", "module": "Init.Data.List.Basic" }, { "name": "List.nil_append", "module": "Init.Data.List.Basic" }, { "name": "add_comm", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "forall_eq'", "module": "Init.PropLemmas" } ]
[ { "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": "FlatOperation.localLength_append", "content": "lemma localLength_append {F} {a b: List (FlatOperation F)} :\n localLength (a ++ b) = localLength a + localLength b" } ]
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit end Circuit namespace FlatOperation
lemma localLength_toFlat {ops : Operations F} : localLength ops.toFlat = ops.localLength :=
:= by induction ops using Operations.induct with | empty => trivial | witness _ _ ops ih | assert _ ops ih | lookup _ ops ih | subcircuit _ ops ih => dsimp only [Operations.toFlat, Operations.localLength] generalize ops.toFlat = flat_ops at * generalize Operations.localLength ops = n at * inducti...
9
43
true
Applied verif.
157
Gadgets.Xor64.completeness
theorem completeness : Completeness (F p) elaborated Assumptions
clean
Clean/Gadgets/Xor/Xor64.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Circuit.Provable", "import Clean.Circuit.Expression", "import Clean.Types.U64", "import Clean.Utils.Field", "import Mathlib.Data.ZMod.Basic", "import Clean.Utils.Primes", "import Mathlib.Algebra.Field.Basic", "import Clean.Circuit.Basic", "imp...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"let \" ident \" <== \" term : doElem", "content": "syntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem\n\nsyntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let ...
[ { "name": "Fact.elim", "module": "Mathlib.Logic.Basic" }, { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Fin.forall_iff", "module": "Init.Data.Fin.Lemmas" } ]
[ { "name": "val_lt_p", "content": "theorem val_lt_p {p : ℕ} (x : ℕ) : (x < p) → (x : F p).val = x" } ]
[ { "name": "Gadgets.Xor64.Inputs", "content": "structure Inputs (F : Type) where\n x: U64 F\n y: U64 F" }, { "name": "Gadgets.Xor64.main", "content": "def main (input : Var Inputs (F p)) : Circuit (F p) (Var U64 (F p)) := do\n let ⟨x, y⟩ := input\n let z ← witness fun env =>\n let z0 := (...
[ { "name": "Gadgets.Xor64.xor_val", "content": "lemma xor_val {x y : F p} (hx : x.val < 256) (hy : y.val < 256) :\n (x.val ^^^ y.val : F p).val = x.val ^^^ y.val" } ]
import Mathlib.Algebra.Field.Basic import Mathlib.Data.ZMod.Basic import Clean.Utils.Primes import Clean.Utils.Vector import Clean.Circuit.Expression import Clean.Circuit.Provable import Clean.Circuit.Basic import Clean.Utils.Field import Clean.Types.U64 import Clean.Gadgets.Xor.ByteXorTable section variable...
theorem completeness : Completeness (F p) elaborated Assumptions :=
:= by intro i0 env input_var h_env input h_input as let ⟨⟨ x0, x1, x2, x3, x4, x5, x6, x7 ⟩, ⟨ y0, y1, y2, y3, y4, y5, y6, y7 ⟩⟩ := input simp only [circuit_norm, explicit_provable_type, Inputs.mk.injEq, U64.mk.injEq] at h_input simp only [Assumptions, circuit_norm, U64.Normalized] at as simp only [h_input, c...
8
99
true
Applied verif.
158
Circuit.subcircuit_computableWitnesses
theorem Circuit.subcircuit_computableWitnesses (circuit : FormalCircuit F β α) (input : Var β F) (n : ℕ) : Environment.OnlyAccessedBelow n (eval · input) ∧ circuit.ComputableWitnesses → (subcircuit circuit input).ComputableWitnesses n
clean
Clean/Circuit/Subcircuit.lean
[ "import Clean.Circuit.Basic", "import Clean.Circuit.Theorems" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|infer_constant_length) => `(tactic|(\n apply ConstantLength.fromConstantLength\n try simp only [circuit_norm]\n ...
[ { "name": "forall_const", "module": "Init.PropLemmas" }, { "name": "imp_self", "module": "Init.Core" }, { "name": "implies_true", "module": "Init.SimpLemmas" }, { "name": "true_and", "module": "Init.SimpLemmas" } ]
[ { "name": "Environment.agreesBelow_of_le", "content": "lemma Environment.agreesBelow_of_le {F} {n m : ℕ} {env env' : Environment F} :\n env.AgreesBelow n env' → m ≤ n → env.AgreesBelow m env'" }, { "name": "forAll_implies", "content": "theorem forAll_implies {c c' : Condition F} (n : ℕ) {ops ...
[ { "name": "FormalCircuit.toSubcircuit", "content": "def FormalCircuit.toSubcircuit (circuit : FormalCircuit F β α)\n (n : ℕ) (input_var : Var β F) : Subcircuit F n :=\n let ops := circuit.main input_var |>.operations n\n have h_consistent : ops.SubcircuitsConsistent n := circuit.subcircuitsConsistent i...
[ { "name": "ElaboratedCircuit.computableWitnesses_implies", "content": "lemma computableWitnesses_implies {circuit : ElaboratedCircuit F β α} :\n circuit.ComputableWitnesses → circuit.ComputableWitnesses'" }, { "name": "ElaboratedCircuit.compose_computableWitnesses", "content": "theorem compos...
import Clean.Circuit.Basic import Clean.Circuit.Theorems variable {F : Type} [Field F] namespace FlatOperation open Circuit (ConstraintsHold.Completeness ConstraintsHold) end FlatOperation variable {α β: TypeMap} [ProvableType α] [ProvableType β] section open Circuit open FlatOperation (constraintsHold_cons co...
theorem Circuit.subcircuit_computableWitnesses (circuit : FormalCircuit F β α) (input : Var β F) (n : ℕ) : Environment.OnlyAccessedBelow n (eval · input) ∧ circuit.ComputableWitnesses → (subcircuit circuit input).ComputableWitnesses n :=
:= by intro h env env' simp only [circuit_norm, FormalCircuit.toSubcircuit, Operations.ComputableWitnesses, Operations.forAllFlat, Operations.forAll_toFlat_iff] exact circuit.compose_computableWitnesses input n h env env'
12
91
true
Applied verif.
159
Gadgets.Xor64.soundness
theorem soundness : Soundness (F p) elaborated Assumptions Spec
clean
Clean/Gadgets/Xor/Xor64.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Circuit.Provable", "import Clean.Circuit.Expression", "import Clean.Types.U64", "import Clean.Utils.Field", "import Mathlib.Data.ZMod.Basic", "import Clean.Utils.Primes", "import Clean.Utils.Bitwise", "import Mathlib.Algebra.Field.Basic", "imp...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"let \" ident \" <== \" term : doElem", "content": "syntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem\n\nsyntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let ...
[ { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" } ]
[ { "name": "value_xor_horner", "content": "omit [Fact (Nat.Prime p)] p_large_enough in\ntheorem value_xor_horner {x : U64 (F p)} (hx : x.Normalized) : x.value =\n x.x0.val ^^^ 2^8 * (x.x1.val ^^^ 2^8 * (x.x2.val ^^^ 2^8 * (x.x3.val ^^^\n 2^8 * (x.x4.val ^^^ 2^8 * (x.x5.val ^^^ 2^8 * (x.x6.val ^^^ 2^8...
[ { "name": "Gadgets.Xor64.Inputs", "content": "structure Inputs (F : Type) where\n x: U64 F\n y: U64 F" }, { "name": "Gadgets.Xor64.main", "content": "def main (input : Var Inputs (F p)) : Circuit (F p) (Var U64 (F p)) := do\n let ⟨x, y⟩ := input\n let z ← witness fun env =>\n let z0 := (...
[ { "name": "Gadgets.Xor64.soundness_to_u64", "content": "omit [Fact (Nat.Prime p)] p_large_enough in\ntheorem soundness_to_u64 {x y z : U64 (F p)}\n (x_norm : x.Normalized) (y_norm : y.Normalized)\n (h_eq :\n z.x0.val = x.x0.val ^^^ y.x0.val ∧\n z.x1.val = x.x1.val ^^^ y.x1.val ∧\n z.x2.val = x.x2...
import Mathlib.Algebra.Field.Basic import Mathlib.Data.ZMod.Basic import Clean.Utils.Primes import Clean.Utils.Vector import Clean.Circuit.Expression import Clean.Circuit.Provable import Clean.Circuit.Basic import Clean.Utils.Field import Clean.Types.U64 import Clean.Gadgets.Xor.ByteXorTable section variable...
theorem soundness : Soundness (F p) elaborated Assumptions Spec :=
:= by intro i0 env input_var input h_input h_as h_holds let ⟨⟨ x0_var, x1_var, x2_var, x3_var, x4_var, x5_var, x6_var, x7_var ⟩, ⟨ y0_var, y1_var, y2_var, y3_var, y4_var, y5_var, y6_var, y7_var ⟩⟩ := input_var let ⟨⟨ x0, x1, x2, x3, x4, x5, x6, x7 ⟩, ⟨ y0, y1, y2, y3, y4, y5, y6, y7 ⟩⟩ := input ...
8
116
true
Applied verif.
160
Circuit.ext
@[ext] theorem ext {f g : Circuit F α} (h_output : ∀ n, f.output n = g.output n) (h_operations : ∀ n, f.operations n = g.operations n) : f = g := ext_iff.mpr fun n => ⟨ h_output n, h_operations n ⟩
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name":...
[ { "name": "Circuit", "content": "def Circuit (F : Type) [Field F] (α : Type) := ℕ → α × List (Operation F)" }, { "name": "Operation", "content": "inductive Operation (F : Type) [Field F] where\n | witness : (m : ℕ) → (compute : Environment F → Vector F m) → Operation F\n | assert : Expression ...
[ { "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": "Circuit.ext_iff", "content": "theorem ext_iff {f g : Circuit F α} :\n (f = g) ↔ (∀ n, (f.output n = g.output n) ∧ (f.operations n = g.operations n))" } ]
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit
@[ext] theorem ext {f g : Circuit F α} (h_output : ∀ n, f.output n = g.output n) (h_operations : ∀ n, f.operations n = g.operations n) : f = g :=
:= ext_iff.mpr fun n => ⟨ h_output n, h_operations n ⟩
5
35
true
Applied verif.
161
Circomlib.MultiAND.subcircuitsConsistent
theorem subcircuitsConsistent (n : ℕ) (input : Var (fields n) (F p)) (offset : ℕ) : Operations.SubcircuitsConsistent offset ((main input).operations offset)
clean
Clean/Circomlib/Gates.lean
[ "import Clean.Circuit.Theorems", "import Clean.Utils.Field", "import Clean.Circuit", "import Mathlib.Data.Nat.Bitwise", "import Clean.Gadgets.Boolean", "import Clean.Utils.Bitwise", "import Clean.Utils.BinaryOps", "import Clean.Circuit.Basic", "import Clean.Utils.Vector" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let $x <...
[ { "name": "Nat.min_def", "module": "Init.Data.Nat.Basic" }, { "name": "Nat.strong_induction_on", "module": "Mathlib.Data.Nat.Init" } ]
[ { "name": "bind_forAll", "content": "@[circuit_norm]\ntheorem bind_forAll {f : Circuit F α} {g : α → Circuit F β} :\n ((f >>= g).operations n).forAll n prop ↔\n (f.operations n).forAll n prop ∧ (((g (f.output n)).operations (n + f.localLength n)).forAll (n + f.localLength n)) prop" }, { "name": ...
[ { "name": "Circomlib.AND.main", "content": "def main (input : Expression (F p) × Expression (F p)) := do\n let a := input.1\n let b := input.2\n let out <== a*b\n return out" }, { "name": "Circomlib.MultiAND.main", "content": "def main : {n : ℕ} → Vector (Expression (F p)) n → Circuit (F p) ...
[ { "name": "Circomlib.MultiAND.Circuit.subcircuitsConsistent_bind", "content": "theorem Circuit.subcircuitsConsistent_bind {α β : Type} (f : Circuit (F p) α) (g : α → Circuit (F p) β) (offset : ℕ)\n (hf : Operations.SubcircuitsConsistent offset (f.operations offset))\n (hg : Operations.SubcircuitsConsi...
import Clean.Circuit import Clean.Utils.Field import Clean.Gadgets.Boolean import Clean.Utils.Bitwise import Clean.Utils.Vector import Clean.Utils.BinaryOps import Clean.Circuit.Theorems import Mathlib.Data.Nat.Bitwise open IsBool namespace Circomlib variable {p : ℕ} [Fact p.Prime] open Circuit (bind_output_...
theorem subcircuitsConsistent (n : ℕ) (input : Var (fields n) (F p)) (offset : ℕ) : Operations.SubcircuitsConsistent offset ((main input).operations offset) :=
:= by induction n using Nat.strong_induction_on generalizing offset with | _ n IH => match n with | 0 => simp only [main, Circuit.operations, Circuit.pure_def] simp only [Operations.SubcircuitsConsistent, Operations.forAll] | 1 => simp only [main, Circuit.operations, Circuit.pure_def] ...
9
92
true
Applied verif.
162
Operations.forAll_toFlat_iff
lemma forAll_toFlat_iff (n : ℕ) (condition : Condition F) (ops : Operations F) : FlatOperation.forAll n condition ops.toFlat ↔ ops.forAllFlat n condition
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, ...
[ { "name": "ElaboratedCircuit", "content": "class ElaboratedCircuit (F : Type) (Input Output : TypeMap) [Field F] [ProvableType Input] [ProvableType Output] where\n main : Var Input F → Circuit F (Var Output F)\n\n \n localLength : Var Input F → ℕ\n\n \n localLength_eq : ∀ input offset, (main input).l...
[ { "name": "List.nil_append", "module": "Init.Data.List.Basic" }, { "name": "and_assoc", "module": "Init.SimpLemmas" }, { "name": "true_and", "module": "Init.SimpLemmas" }, { "name": "zero_add", "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": "FlatOperation.localLength_cons", "content": "lemma localLength_cons {F} {op : FlatOperation F} {ops : List (FlatOperation F)} :\n localLength (op :: ops) = op.singleLocalLength + localLength ops" }, { "name": "FlatOperation.forAll_cons", "content": "theorem forAll_cons {condition :...
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit end Circuit namespace FlatOperation end FlatOperation namespace Environment open FlatOperation (localLength localWitnesses) end Environment namespace Circ...
lemma forAll_toFlat_iff (n : ℕ) (condition : Condition F) (ops : Operations F) : FlatOperation.forAll n condition ops.toFlat ↔ ops.forAllFlat n condition :=
:= by induction ops using Operations.induct generalizing n with | empty => simp only [forAllFlat, forAll, toFlat, FlatOperation.forAll] | witness | assert | lookup => simp_all [forAllFlat, forAll, toFlat, FlatOperation.forAll] | subcircuit s ops ih => simp_all only [forAllFlat, forAll, toFlat] rw [F...
7
49
false
Applied verif.
163
Circuit.FoldlM.forAll_iff_const
theorem forAll_iff_const [NeZero m] (constant : ConstantLength (prod circuit)) (h_const_out : ConstantOutput (prod circuit)) : (xs.foldlM circuit init).forAll n prop ↔ (circuit init (xs[0]'(NeZero.pos m))).forAll n prop ∧ ∀ (i : ℕ) (hi : i + 1 < m), let acc := (circuit default xs[i]).output (n + i*(circui...
clean
Clean/Circuit/Loops.lean
[ "import Clean.Utils.Misc", "import Clean.Circuit.Subcircuit", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name":...
[ { "name": "Circuit", "content": "def Circuit (F : Type) [Field F] (α : Type) := ℕ → α × List (Operation F)" }, { "name": "Operation", "content": "inductive Operation (F : Type) [Field F] where\n | witness : (m : ℕ) → (compute : Environment F → Vector F m) → Operation F\n | assert : Expression ...
[ { "name": "List.foldlM_toArray", "module": "Init.Data.List.ToArray" }, { "name": "Vector.foldlM_mk", "module": "Init.Data.Vector.Lemmas" }, { "name": "List.foldlM_cons", "module": "Init.Data.List.Control" }, { "name": "Vector.toList_mk", "module": "Init.Data.Vector.Lemmas...
[ { "name": "bind_localLength_eq", "content": "theorem bind_localLength_eq (f : Circuit F α) (g : α → Circuit F β) (n : ℕ) :\n (f >>= g).localLength n = f.localLength n + (g (f.output n)).localLength (n + f.localLength n)" }, { "name": "append_localLength", "content": "@[circuit_norm]\ntheorem ...
[ { "name": "Circuit.FoldlM.prod", "content": "@[reducible]\ndef prod (circuit : β → α → Circuit F β) : β × α → Circuit F β := fun t => circuit t.1 t.2" }, { "name": "Circuit.FoldlM.foldlAcc", "content": "def foldlAcc (n : ℕ) (xs : Vector α m) (circuit : β → α → Circuit F β) (init : β) (j : Fin m)...
[ { "name": "Vector.foldlM_toList", "content": "lemma Vector.foldlM_toList (xs : Vector α n) {m : Type → Type} [Monad m] (body : β → α → m β) (init : β) :\n xs.foldlM body init = xs.toList.foldlM body init" }, { "name": "Circuit.ConstantLength.length_eq_default", "content": "lemma ConstantLengt...
import Clean.Circuit.Subcircuit import Clean.Utils.Misc variable {n m : ℕ} {F : Type} [Field F] {α β : Type} namespace Circuit variable {prop : Condition F} namespace ForM variable {circuit : α → Circuit F Unit} (xs : Vector α m) (constant : ConstantLength circuit) (n : ℕ) end ForM namespace MapM variable {cir...
theorem forAll_iff_const [NeZero m] (constant : ConstantLength (prod circuit)) (h_const_out : ConstantOutput (prod circuit)) : (xs.foldlM circuit init).forAll n prop ↔ (circuit init (xs[0]'(NeZero.pos m))).forAll n prop ∧ ∀ (i : ℕ) (hi : i + 1 < m), let acc :=
:= (circuit default xs[i]).output (n + i*(circuit default default).localLength); (circuit acc xs[i + 1]).forAll (n + (i + 1)*(circuit default default).localLength) prop := by rw [forAll_iff (constant:=constant)] set k := (circuit default default).localLength simp only constructor · intro h constructor...
8
97
true
Applied verif.
164
Gadgets.Rotation32.Theorems.rotation32_bits_soundness
theorem rotation32_bits_soundness {o : ℕ} (ho : o < 8) {x : U32 ℕ} : (rotRight32_u32 x o).valueNat = rotRight32 x.valueNat o
clean
Clean/Gadgets/Rotation32/Theorems.lean
[ "import Clean.Types.U32", "import Clean.Gadgets.ByteDecomposition.ByteDecomposition", "import Clean.Utils.Bitwise", "import Clean.Utils.Rotation", "import Clean.Utils.Field" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Nat.reducePow", "module": "Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat" } ]
[ { "name": "U32", "content": "structure U32 (T : Type) where\n x0 : T\n x1 : T\n x2 : T\n x3 : T\nderiving DecidableEq" }, { "name": "rotRight32", "content": "def rotRight32 (x : ℕ) (offset : ℕ) : ℕ :=\n let offset := offset % 32\n let low := x % (2^offset)\n let high := x / (2^offset)\n ...
[ { "name": "Nat.add_div_of_dvd_left", "module": "Mathlib.Data.Nat.ModEq" }, { "name": "Nat.add_one_sub_one", "module": "Init.Data.Nat.Basic" }, { "name": "Nat.lt_one_iff", "module": "Init.Data.Nat.Basic" }, { "name": "Nat.ofNat_pos", "module": "Mathlib.Data.Nat.Cast.Order....
[ { "name": "mul_div_256_off", "content": "lemma mul_div_256_off {offset : ℕ} (ho : offset < 8) {x : ℕ} (i : ℕ) (h : i > 0):\n (x * 256^i) / 2^offset = x * 256^(i-1) * 2^(8-offset)" }, { "name": "div_256_two_power", "content": "lemma div_256_two_power {offset : ℕ} (ho : offset < 8) {i : ℕ} (h :...
[ { "name": "Gadgets.Rotation32.Theorems.rotRight32_u32", "content": "def rotRight32_u32 : U32 ℕ → ℕ → U32 ℕ\n | ⟨ x0, x1, x2, x3 ⟩, o => ⟨\n (x0 / 2^o) + (x1 % 2^o) * 2^(8-o),\n (x1 / 2^o) + (x2 % 2^o) * 2^(8-o),\n (x2 / 2^o) + (x3 % 2^o) * 2^(8-o),\n (x3 / 2^o) + (x0 % 2^o) * 2^(8-o),\n ⟩" }...
[ { "name": "Gadgets.Rotation32.Theorems.h_mod32", "content": "lemma h_mod32 {o : ℕ} (ho : o < 8) {x0 x1 x2 x3 : ℕ} :\n (x0 + x1 * 256 + x2 * 256^2 + x3 * 256^3) % 2^o = x0 % 2^o" }, { "name": "Gadgets.Rotation32.Theorems.h_div32", "content": "lemma h_div32 {o : ℕ} (ho : o < 8) {x0 x1 x2 x3: ℕ}...
import Clean.Utils.Field import Clean.Utils.Bitwise import Clean.Utils.Rotation import Clean.Types.U32 import Clean.Gadgets.ByteDecomposition.ByteDecomposition variable {p : ℕ} [Fact p.Prime] variable [p_large_enough: Fact (p > 2^16 + 2^8)] namespace Gadgets.Rotation32.Theorems open Gadgets.ByteDecomposition.Th...
theorem rotation32_bits_soundness {o : ℕ} (ho : o < 8) {x : U32 ℕ} : (rotRight32_u32 x o).valueNat = rotRight32 x.valueNat o :=
:= by -- simplify the goal simp only [rotRight32, rotRight32_u32, U32.valueNat] have offset_mod_32 : o % 32 = o := Nat.mod_eq_of_lt (by linarith) simp only [offset_mod_32] rw [h_mod32 ho, h_div32 ho] -- proof technique: we care about only what happens to x0, all "internal" terms remain -- the same, and ...
3
43
true
Applied verif.
165
Circuit.FoldlM.operations_eq_const
theorem operations_eq_const [NeZero m] (constant : ConstantLength (prod circuit)) (h_const_out : ConstantOutput (prod circuit)) : (Vector.foldlM circuit init xs).operations n = (circuit init (xs[0]'(NeZero.pos m))).operations n ++ (List.ofFn fun (⟨i, _⟩ : Fin (m - 1)) => let k := (circuit default default)...
clean
Clean/Circuit/Loops.lean
[ "import Clean.Utils.Misc", "import Clean.Circuit.Subcircuit", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Unit", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name":...
[ { "name": "Circuit", "content": "def Circuit (F : Type) [Field F] (α : Type) := ℕ → α × List (Operation F)" }, { "name": "Operation", "content": "inductive Operation (F : Type) [Field F] where\n | witness : (m : ℕ) → (compute : Environment F → Vector F m) → Operation F\n | assert : Expression ...
[ { "name": "Fin.foldl_zero", "module": "Init.Data.Fin.Fold" }, { "name": "Fin.val_last", "module": "Init.Data.Fin.Lemmas" }, { "name": "List.foldlM_toArray", "module": "Init.Data.List.ToArray" }, { "name": "Vector.foldlM_mk", "module": "Init.Data.Vector.Lemmas" }, { ...
[ { "name": "Fin.foldl_const", "content": "theorem Fin.foldl_const (n : ℕ) (f : Fin n → α) (init : α) :\n Fin.foldl n (fun _ i => f i) init = match n with" }, { "name": "Fin.foldl_const_succ", "content": "theorem Fin.foldl_const_succ (n : ℕ) (f : Fin (n + 1) → α) (init : α) :\n Fin.foldl (n + ...
[ { "name": "Circuit.FoldlM.prod", "content": "@[reducible]\ndef prod (circuit : β → α → Circuit F β) : β × α → Circuit F β := fun t => circuit t.1 t.2" }, { "name": "Circuit.FoldlM.foldlAcc", "content": "def foldlAcc (n : ℕ) (xs : Vector α m) (circuit : β → α → Circuit F β) (init : β) (j : Fin m)...
[ { "name": "Vector.foldlM_toList", "content": "lemma Vector.foldlM_toList (xs : Vector α n) {m : Type → Type} [Monad m] (body : β → α → m β) (init : β) :\n xs.foldlM body init = xs.toList.foldlM body init" }, { "name": "Circuit.ConstantLength.length_eq_default", "content": "lemma ConstantLengt...
import Clean.Circuit.Subcircuit import Clean.Utils.Misc variable {n m : ℕ} {F : Type} [Field F] {α β : Type} namespace Circuit variable {prop : Condition F} namespace ForM variable {circuit : α → Circuit F Unit} (xs : Vector α m) (constant : ConstantLength circuit) (n : ℕ) end ForM namespace MapM variable {cir...
theorem operations_eq_const [NeZero m] (constant : ConstantLength (prod circuit)) (h_const_out : ConstantOutput (prod circuit)) : (Vector.foldlM circuit init xs).operations n = (circuit init (xs[0]'(NeZero.pos m))).operations n ++ (List.ofFn fun (⟨i, _⟩ : Fin (m - 1)) => let k := (circuit default default)...
:= by rw [operations_eq] simp only set k := (circuit default default).localLength set k' := constant.localLength have : k' = k := by simp only [k]; rw [constant.localLength_eq (_, _)] rw [this] rcases m with rfl | m · nomatch ‹NeZero 0› rw [List.ofFn_succ, List.flatten_cons] simp only [foldlAcc_zero...
6
88
true
Applied verif.
166
Gadgets.Rotation64.Theorems.rotation64_bits_soundness
theorem rotation64_bits_soundness {o : ℕ} (ho : o < 8) {x : U64 ℕ} : (rotRight64_u64 x o).valueNat = rotRight64 x.valueNat o
clean
Clean/Gadgets/Rotation64/Theorems.lean
[ "import Clean.Utils.Bitwise", "import Clean.Types.U64", "import Clean.Utils.Rotation", "import Clean.Utils.Field" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Nat.reducePow", "module": "Lean.Meta.Tactic.Simp.BuiltinSimprocs.Nat" } ]
[ { "name": "U64", "content": "structure U64 (T : Type) where\n x0 : T\n x1 : T\n x2 : T\n x3 : T\n x4 : T\n x5 : T\n x6 : T\n x7 : T\nderiving DecidableEq" }, { "name": "valueNat", "content": "def valueNat (x : U64 ℕ) :=\n x.x0 + x.x1 * 256 + x.x2 * 256^2 + x.x3 * 256^3 +\n x.x4 * 256^4...
[ { "name": "Nat.pow_add", "module": "Init.Data.Nat.Lemmas" }, { "name": "Nat.pow_mul", "module": "Init.Data.Nat.Lemmas" }, { "name": "pow_right_inj₀", "module": "Mathlib.Algebra.Order.GroupWithZero.Unbundled.Basic" }, { "name": "Nat.add_div_of_dvd_left", "module": "Mathlib...
[ { "name": "mul_div_256_off", "content": "lemma mul_div_256_off {offset : ℕ} (ho : offset < 8) {x : ℕ} (i : ℕ) (h : i > 0):\n (x * 256^i) / 2^offset = x * 256^(i-1) * 2^(8-offset)" }, { "name": "div_256_two_power", "content": "lemma div_256_two_power {offset : ℕ} (ho : offset < 8) {i : ℕ} (h :...
[ { "name": "Gadgets.Rotation64.Theorems.rotRight64_u64", "content": "def rotRight64_u64 : U64 ℕ → ℕ → U64 ℕ\n | ⟨ x0, x1, x2, x3, x4, x5, x6, x7 ⟩, o => ⟨\n (x0 / 2^o) + (x1 % 2^o) * 2^(8-o),\n (x1 / 2^o) + (x2 % 2^o) * 2^(8-o),\n (x2 / 2^o) + (x3 % 2^o) * 2^(8-o),\n (x3 / 2^o) + (x4 % 2^o) * 2^...
[ { "name": "Gadgets.Rotation64.Theorems.h_mod", "content": "lemma h_mod {o : ℕ} (ho : o < 8) {x0 x1 x2 x3 x4 x5 x6 x7 : ℕ} :\n (x0 + x1 * 256 + x2 * 256 ^ 2 + x3 * 256 ^ 3 + x4 * 256 ^ 4 + x5 * 256 ^ 5 + x6 * 256 ^ 6 + x7 * 256 ^ 7) %\n 2^o = x0 % 2^o" }, { "name": "Gadgets.Rotation64.Theorem...
import Clean.Utils.Field import Clean.Utils.Bitwise import Clean.Utils.Rotation import Clean.Types.U64 variable {p : ℕ} [Fact p.Prime] variable [p_large_enough: Fact (p > 2^16 + 2^8)] namespace Gadgets.Rotation64.Theorems open Utils.Rotation def rotRight64_u64 : U64 ℕ → ℕ → U64 ℕ | ⟨ x0, x1, x2, x3, x4, x5, x...
theorem rotation64_bits_soundness {o : ℕ} (ho : o < 8) {x : U64 ℕ} : (rotRight64_u64 x o).valueNat = rotRight64 x.valueNat o :=
:= by -- simplify the goal simp only [rotRight64, rotRight64_u64, U64.valueNat] have offset_mod_64 : o % 64 = o := Nat.mod_eq_of_lt (by linarith) simp only [offset_mod_64] rw [h_mod ho, h_div ho] -- proof technique: we care about only what happens to x0, all "internal" terms remain -- the same, and are ...
3
41
false
Applied verif.
167
Utils.StateTransition.exists_path_from_source_to_sink
theorem exists_path_from_source_to_sink (R : Run S) (s d : S) (h_source : R.netFlow s = 1) (h_others : ∀ x, x ≠ s → x ≠ d → R.netFlow x = 0) : ∃ (path : List S), path.head? = some s ∧ path.getLast? = some d ∧ path ≠ [] ∧ R.containsPath path ∧ path.Nodup
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "List.Sublist", "module": "Init.Data.List.Basic" }, { "name": "List.count", "module": "In...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.drop_succ_cons", "module": "Init.Data.List.Basic" }, { "name": "List.tail_cons", "module": "Init.Data.List.Basic" }, { "name": "List.zip_cons_cons", "module": "Init.Data.List.Basic" }, { "name": "List.Sublist.count_le", "module": "Init.Data.List.Count" }...
[ { "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.Run.netFlow", "content": "noncomputable def Run.netFlow {S...
[ { "name": "Utils.StateTransition.finset_ssubset_univ_of_not_mem", "content": "lemma finset_ssubset_univ_of_not_mem {α : Type*} [Fintype α] (s : Finset α) (x : α)\n (h : x ∉ s) :\n s ⊂ Finset.univ" }, { "name": "Utils.StateTransition.sum_decrease", "content": "lemma sum_decrease {α : Type*}...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
theorem exists_path_from_source_to_sink (R : Run S) (s d : S) (h_source : R.netFlow s = 1) (h_others : ∀ x, x ≠ s → x ≠ d → R.netFlow x = 0) : ∃ (path : List S), path.head? = some s ∧ path.getLast? = some d ∧ path ≠ [] ∧ R.containsPath path ∧ path.Nodup :=
:= by -- Reduce to acyclic case by removing cycles by_cases h_cyclic : R.hasCycle case pos => -- R has a cycle, remove it and recurse obtain ⟨R', h_netFlow_preserved, h_size_lt, h_R'_le_R⟩ := exists_smaller_run_with_same_netFlow R h_cyclic -- R' has the same net flows have h_source' : R'.netFlow s...
9
162
false
Applied verif.
168
FlatOperation.onlyAccessedBelow_all
theorem onlyAccessedBelow_all {ops : List (FlatOperation F)} (n : ℕ) : forAll n { witness n _ := Environment.OnlyAccessedBelow n } ops → Environment.OnlyAccessedBelow (n + localLength ops) (localWitnesses · ops)
clean
Clean/Circuit/Theorems.lean
[ "import Clean.Circuit.Provable", "import Clean.Circuit.Basic" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "List", "module": "Init.Prelude" }, ...
[ { "name": "Witnessable", "content": "class Witnessable (F : Type) [Field F] (value : outParam TypeMap) (var : TypeMap) [ProvableType value] where\n witness : ((Environment F) → value F) → Circuit F (var F)\n var_eq : var F = value (Expression F) := by admit /- proof elided -/" }, { "name": "FlatOp...
[ { "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": "FlatOperation.localLength_cons", "content": "lemma localLength_cons {F} {op : FlatOperation F} {ops : List (FlatOperation F)} :\n localLength (op :: ops) = op.singleLocalLength + localLength ops" }, { "name": "FlatOperation.forAll_cons", "content": "theorem forAll_cons {condition :...
import Clean.Circuit.Basic import Clean.Circuit.Provable variable {F : Type} [Field F] {α β : Type} namespace Operations end Operations namespace Circuit end Circuit namespace FlatOperation end FlatOperation namespace Environment open FlatOperation (localLength localWitnesses) end Environment namespace Circ...
theorem onlyAccessedBelow_all {ops : List (FlatOperation F)} (n : ℕ) : forAll n { witness n _ := Environment.OnlyAccessedBelow n } ops → Environment.OnlyAccessedBelow (n + localLength ops) (localWitnesses · ops) :=
:= by intro h_comp env env' h_env simp only induction ops generalizing n with | nil => simp [localWitnesses] | cons op ops ih => simp_all only [forAll_cons, localLength_cons] have h_ih := h_comp.right replace h_comp := h_comp.left replace h_ih := ih (op.singleLocalLength + n) h_ih ring_nf ...
4
37
true
Applied verif.
169
Gadgets.Addition8.Theorems.soundness
theorem soundness (x y out carry_in carry_out : F p): x.val < 256 -> y.val < 256 -> out.val < 256 -> IsBool carry_in -> IsBool carry_out -> (x + y + carry_in + -out + -(carry_out * 256) = 0) -> (out.val = (x.val + y.val + carry_in.val) % 256 ∧ carry_out.val = (x.val + y.val + carry_in.val) /...
clean
Clean/Gadgets/Addition8/Theorems.lean
[ "import Clean.Gadgets.Boolean", "import Clean.Utils.Field" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "ZMod.val", "module": "Mathlib.Data.ZMod.Basic" }, { "name": "Nat", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"field_to_nat\" : tactic", "content": "syntax \"field_to_nat\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|field_to_nat) =>\n `(tactic|(\n intros\n repeat rw [ZMod.val_add] \n repeat rw [ZMod.val_mul] \n repeat rw [val_eq_...
[ { "name": "Nat.div_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.div_eq_of_lt_le", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.mod_eq_of_lt", "module": "Init.Data.Nat.Div.Basic" }, { "name": "Nat.mod_eq_sub_mod", "module": "Init.Data.Nat.Div.B...
[ { "name": "byte_sum_and_bit_do_not_wrap", "content": "theorem byte_sum_and_bit_do_not_wrap (x y b : F p) [Fact (p > 512)]:\n x.val < 256 -> y.val < 256 -> b.val < 2 -> (b + x + y).val = b.val + x.val + y.val" }, { "name": "byte_sum_and_bit_do_not_wrap'", "content": "theorem byte_sum_and_bit_d...
[]
[ { "name": "Gadgets.Addition8.Theorems.soundness_zero_carry", "content": "theorem soundness_zero_carry (x y out carry_in : F p):\n x.val < 256 -> y.val < 256 -> out.val < 256 -> carry_in.val < 2 ->\n (carry_in + x + y - out = 0 -> (out.val = (carry_in.val + x.val + y.val) % 256\n ∧ (carry_in.val + ...
import Clean.Utils.Field import Clean.Gadgets.Boolean namespace Gadgets.Addition8.Theorems variable {p : ℕ} [Fact p.Prime] variable [p_large_enough: Fact (p > 512)]
theorem soundness (x y out carry_in carry_out : F p): x.val < 256 -> y.val < 256 -> out.val < 256 -> IsBool carry_in -> IsBool carry_out -> (x + y + carry_in + -out + -(carry_out * 256) = 0) -> (out.val = (x.val + y.val + carry_in.val) % 256 ∧ carry_out.val = (x.val + y.val + carry_in.val) /...
:= by intros hx hy hout carry_in_bool carry_out_bool h have carry_in_bound := IsBool.val_lt_two carry_in_bool rcases carry_out_bool with zero_carry | one_carry -- case with zero carry · rw [zero_carry] at h simp only [zero_mul, neg_zero, add_zero] at h rw [←sub_eq_add_neg] at h have h_spec : carr...
3
29
true
Applied verif.
170
MemoryAccessList.eq_of_perm_of_sorted
lemma MemoryAccessList.eq_of_perm_of_sorted {l1 l2 l3 : MemoryAccessList} (h_l1_sorted: l1.isTimestampSorted) (h_l2_sorted : l2.isAddressTimestampSorted) (h_l3_sorted : l3.isAddressTimestampSorted) (h_perm1 : l1.Perm l2) (h_perm2 : l1.Perm l3) : l2 = l3
clean
Clean/Utils/OfflineMemory.lean
[ "import Clean.Utils.Tactics", "import Clean.Circuit.Provable", "import Clean.Gadgets.Equality", "import Clean.Utils.Primes", "import Mathlib.Data.List.Sort", "import Clean.Circuit.Basic", "import Clean.Utils.Field" ]
[ { "name": "List", "module": "Init.Prelude" }, { "name": "List.Perm", "module": "Init.Data.List.Basic" }, { "name": "List.Sorted", "module": "Mathlib.Deprecated.Sort" }, { "name": "List.Pairwise", "module": "Init.Data.List.Basic" }, { "name": "Nat", "module": "...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.Pairwise.perm", "module": "Init.Data.List.Perm" }, { "name": "eq_comm", "module": "Init.Core" }, { "name": "ne_eq", "module": "Init.SimpLemmas" }, { "name": "not_false_eq_true", "module": "Init.SimpLemmas" }, { "name": "Nat.lt_of_le_of_ne", "mo...
[ { "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": "MemoryAccess", "content": "def MemoryAccess := ℕ × ℕ × ℕ × ℕ" }, { "name": "MemoryAccessList", "content": "def MemoryAccessList := List MemoryAccess" }, { "name": "timestamp_ordering", "content": "abbrev timestamp_ordering (x y : MemoryAccess) := match x, y with\n| (t2, _a...
[ { "name": "MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup", "content": "theorem MemoryAccessList.addressStrictTimestampSorted_of_AddressTimestampSorted_noTimestampDup\n (accesses : MemoryAccessList) (h_sorted : accesses.isAddressTimestampSorted)\n (h_no_timestam...
import Clean.Circuit.Basic import Clean.Circuit.Provable import Clean.Gadgets.Equality import Clean.Utils.Field import Clean.Utils.Primes import Clean.Utils.Tactics import Mathlib.Data.List.Sort def MemoryAccess := ℕ × ℕ × ℕ × ℕ def MemoryAccessList := List MemoryAccess abbrev timestamp_ordering (x y : Memory...
lemma MemoryAccessList.eq_of_perm_of_sorted {l1 l2 l3 : MemoryAccessList} (h_l1_sorted: l1.isTimestampSorted) (h_l2_sorted : l2.isAddressTimestampSorted) (h_l3_sorted : l3.isAddressTimestampSorted) (h_perm1 : l1.Perm l2) (h_perm2 : l1.Perm l3) : l2 = l3 :=
:= by simp [isAddressTimestampSorted] at * rw [List.perm_comm] at h_perm1 have l1_nodup := List.Sorted.nodup h_l1_sorted have thm1 := List.Sorted.insertionSort_eq h_l2_sorted have h_l2_nodup := (List.Perm.nodup_iff h_perm1).mpr l1_nodup have h_l3_nodup := (List.Perm.nodup_iff h_perm2).mp l1_nodup have l...
3
28
false
Applied verif.
171
Circomlib.MultiAND.main_output_binary_from_completeness
lemma main_output_binary_from_completeness (n : ℕ) (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields n) (F p)) (input : fields n (F p)) (h_eval : input = eval env input_var) (h_assumptions : Assumptions n input) (h_local_witnesses : env.UsesLocalWitnessesCompleteness offset ((main input_va...
clean
Clean/Circomlib/Gates.lean
[ "import Clean.Circuit.Theorems", "import Clean.Circuit.Provable", "import Clean.Utils.Field", "import Clean.Circuit", "import Mathlib.Data.Nat.Bitwise", "import Clean.Gadgets.Boolean", "import Clean.Utils.Bitwise", "import Clean.Utils.BinaryOps", "import Clean.Circuit.Basic", "import Clean.Utils.V...
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let $x <...
[ { "name": "Nat.min_def", "module": "Init.Data.Nat.Basic" }, { "name": "Nat.strong_induction_on", "module": "Mathlib.Data.Nat.Init" }, { "name": "List.getElem_toArray", "module": "Init.Data.Array.Basic" }, { "name": "Nat.add_zero", "module": "Init.Core" }, { "name"...
[ { "name": "bind_forAll", "content": "@[circuit_norm]\ntheorem bind_forAll {f : Circuit F α} {g : α → Circuit F β} :\n ((f >>= g).operations n).forAll n prop ↔\n (f.operations n).forAll n prop ∧ (((g (f.output n)).operations (n + f.localLength n)).forAll (n + f.localLength n)) prop" }, { "name": ...
[ { "name": "Circomlib.AND.main", "content": "def main (input : Expression (F p) × Expression (F p)) := do\n let a := input.1\n let b := input.2\n let out <== a*b\n return out" }, { "name": "Circomlib.MultiAND.main", "content": "def main : {n : ℕ} → Vector (Expression (F p)) n → Circuit (F p) ...
[ { "name": "Circomlib.MultiAND.Circuit.subcircuitsConsistent_bind", "content": "theorem Circuit.subcircuitsConsistent_bind {α β : Type} (f : Circuit (F p) α) (g : α → Circuit (F p) β) (offset : ℕ)\n (hf : Operations.SubcircuitsConsistent offset (f.operations offset))\n (hg : Operations.SubcircuitsConsi...
import Clean.Circuit import Clean.Utils.Field import Clean.Gadgets.Boolean import Clean.Utils.Bitwise import Clean.Utils.Vector import Clean.Utils.BinaryOps import Clean.Circuit.Theorems import Mathlib.Data.Nat.Bitwise open IsBool namespace Circomlib variable {p : ℕ} [Fact p.Prime] open Circuit (bind_output_...
lemma main_output_binary_from_completeness (n : ℕ) (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields n) (F p)) (input : fields n (F p)) (h_eval : input = eval env input_var) (h_assumptions : Assumptions n input) (h_local_witnesses : env.UsesLocalWitnessesCompleteness offset ((main input_va...
:= env ((main input_var).output offset) IsBool output := by apply main_output_binary · assumption · assumption apply Circuit.can_replace_completeness (n := offset) · apply subcircuitsConsistent · rw [main_usesLocalWitnesses_iff_completeness] · exact h_local_witnesses · rfl · exact h_completene...
9
165
true
Applied verif.
172
Circuit.MapM.operations_eq
theorem operations_eq : (xs.mapM circuit).operations n = (List.ofFn fun (i : Fin m) => (circuit xs[i.val]).operations (n + i * constant.localLength)).flatten
clean
Clean/Circuit/Loops.lean
[ "import Clean.Utils.Misc", "import Clean.Utils.Vector", "import Clean.Circuit.Subcircuit", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Vector.mk", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "List.ofFn", "module": "Init.Data.List.O...
[ { "name": "induct", "content": "def induct {motive : {n : ℕ} → Vector α n → Sort u}\n (nil : motive #v[])\n (cons: ∀ {n : ℕ} (a : α) (as : Vector α n), motive as → motive (cons a as))\n {n : ℕ} (v : Vector α n) : motive v :=\n match v with\n | ⟨ .mk [], h ⟩ => by admit /- proof elided -/\n | ⟨ ....
[ { "name": "add_mul", "module": "Mathlib.Algebra.Ring.Defs" }, { "name": "Array.toList_mapM", "module": "Init.Data.Array.Lemmas" }, { "name": "Functor.map_map", "module": "Init.Control.Lawful.Basic" }, { "name": "Vector.toArray_mapM", "module": "Init.Data.Vector.Lemmas" ...
[ { "name": "map_operations_eq", "content": "theorem map_operations_eq (f : Circuit F α) (g : α → β) (n : ℕ) :\n (g <$> f).operations n = f.operations n" }, { "name": "ext_iff", "content": "theorem ext_iff {f g : Circuit F α} :\n (f = g) ↔ (∀ n, (f.output n = g.output n) ∧ (f.operations n = g.op...
[]
[ { "name": "Vector.toList_mapM", "content": "lemma Vector.toList_mapM (xs : Vector α n) {m : Type → Type} [monad: Monad m] [LawfulMonad m] (body : α → m β) :\n Vector.toList <$> (xs.mapM body) = xs.toList.mapM body" }, { "name": "Circuit.ofFn_flatten_cons", "content": "private lemma ofFn_flatt...
import Clean.Circuit.Subcircuit import Clean.Utils.Misc variable {n m : ℕ} {F : Type} [Field F] {α β : Type} namespace Circuit variable {prop : Condition F} namespace ForM variable {circuit : α → Circuit F Unit} (xs : Vector α m) (constant : ConstantLength circuit) (n : ℕ) end ForM namespace MapM variable {cir...
theorem operations_eq : (xs.mapM circuit).operations n = (List.ofFn fun (i : Fin m) => (circuit xs[i.val]).operations (n + i * constant.localLength)).flatten :=
:= by induction xs using Vector.induct generalizing n case nil => simp [pure_operations_eq] case cons x xs ih => rw [mapM_cons, bind_operations_eq, bind_operations_eq, pure_operations_eq, ih, constant.localLength_eq, List.append_nil, ofFn_flatten_cons]
6
70
false
Applied verif.
173
Utils.StateTransition.exists_smaller_run_with_same_netFlow
lemma exists_smaller_run_with_same_netFlow (R : Run S) (h_cycle : R.hasCycle) : ∃ (R' : Run S), (∀ x, R'.netFlow x = R.netFlow x) ∧ R'.size < R.size ∧ (∀ t, R' t ≤ R t)
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Fintype", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Finset", "module": "Mathlib.Data.Finset.Defs" }, { "name": "Finset.univ", "module": "Mat...
[ { "name": "...", "content": "..." } ]
[ { "name": "Finset.mem_univ", "module": "Mathlib.Data.Fintype.Defs" }, { "name": "Finset.sum_erase_add", "module": "Mathlib.Algebra.BigOperators.Group.Finset.Basic" }, { "name": "Finset.sum_le_sum", "module": "Mathlib.Algebra.Order.BigOperators.Group.Finset" }, { "name": "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.Run.netFlow", "content": "noncomputable def Run.netFlow {S...
[ { "name": "Utils.StateTransition.sum_decrease", "content": "lemma sum_decrease {α : Type*} [Fintype α] [DecidableEq α] (f g : α → ℕ) (a : α)\n (h_a_decrease : g a < f a)\n (h_others_le : ∀ x, g x ≤ f x) :\n ∑ x : α, g x < ∑ x : α, f x" }, { "name": "Utils.StateTransition.path_has_transition...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma exists_smaller_run_with_same_netFlow (R : Run S) (h_cycle : R.hasCycle) : ∃ (R' : Run S), (∀ x, R'.netFlow x = R.netFlow x) ∧ R'.size < R.size ∧ (∀ t, R' t ≤ R t) :=
:= by -- Extract the cycle from the hypothesis obtain ⟨cycle, h_len, h_cycle_prop, h_contains⟩ := h_cycle -- Use R.removeCycle as the witness use R.removeCycle cycle constructor · -- Net flow is preserved intro x apply netFlow_removeCycle_eq <;> aesop constructor · -- Size decreases apply si...
6
62
false
Applied verif.
174
Utils.StateTransition.acyclic_has_leaf
lemma acyclic_has_leaf (R : Run S) (root : S) (h_acyclic : R.isAcyclic) (h_has_out : ∃ y, R (root, y) > 0) : ∃ leaf, R.isLeaf root leaf
clean
Clean/Utils/SourceSinkPath.lean
[ "import Mathlib.Algebra.Order.BigOperators.Group.Finset", "import Mathlib.Data.Fintype.Prod", "import Mathlib.Data.List.Basic", "import Mathlib.Algebra.BigOperators.Group.Finset.Basic", "import Mathlib.Data.Finset.Basic", "import Mathlib.Algebra.BigOperators.Ring.Finset", "import Mathlib.Algebra.BigOper...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "BEq", "module": "Init.Prelude" }, { "name": "List.count", "module": "Init.Data.List.Basic" }, { "name": "List.tail", "module": "Init.Data.List.Basic" ...
[ { "name": "...", "content": "..." } ]
[ { "name": "List.countP_cons_of_pos", "module": "Init.Data.List.Count" }, { "name": "List.countP_nil", "module": "Init.Data.List.Count" }, { "name": "List.count_cons", "module": "Init.Data.List.Count" }, { "name": "List.count_nil", "module": "Init.Data.List.Count" }, {...
[ { "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": "Utils.StateTransition.Transition", "content": "def Transition (S : Type*) := S × S" }, { "name": "Utils.StateTransition.Run", "content": "def Run (S : Type*) := Transition S → ℕ" }, { "name": "Utils.StateTransition.countTransitionInPath", "content": "def countTransitionInP...
[ { "name": "Utils.StateTransition.finset_ssubset_univ_of_not_mem", "content": "lemma finset_ssubset_univ_of_not_mem {α : Type*} [Fintype α] (s : Finset α) (x : α)\n (h : x ∉ s) :\n s ⊂ Finset.univ" }, { "name": "Utils.StateTransition.zip_drop_sublist", "content": "lemma zip_drop_sublist (l ...
import Mathlib.Data.Finset.Basic import Mathlib.Data.Fintype.Basic import Mathlib.Data.Fintype.Prod import Mathlib.Data.List.Basic import Mathlib.Algebra.BigOperators.Group.Finset.Basic import Mathlib.Algebra.Order.BigOperators.Group.Finset import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise import Mathli...
lemma acyclic_has_leaf (R : Run S) (root : S) (h_acyclic : R.isAcyclic) (h_has_out : ∃ y, R (root, y) > 0) : ∃ leaf, R.isLeaf root leaf :=
:= by -- Start with path = [root] have h_root_start : [root].head? = some root := by simp have h_root_end : [root].getLast? = some root := by simp have h_root_nonempty : [root] ≠ [] := by simp have h_root_contains : R.containsPath [root] := by intro t simp [countTransitionInPath] -- Apply the auxil...
8
98
false
Applied verif.
175
Circuit.constraintsHold_toFlat_iff
theorem Circuit.constraintsHold_toFlat_iff : ∀ {ops : Operations F}, ∀ {env : Environment F}, ConstraintsHoldFlat env ops.toFlat ↔ ConstraintsHold env ops
clean
Clean/Circuit/Subcircuit.lean
[ "import Clean.Circuit.Basic", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(tactic|infer_constant_length) => `(tactic|(\n apply ConstantLength.fromConstantLength\n try simp only [circuit_norm]\n ...
[ { "name": "and_self", "module": "Init.SimpLemmas" }, { "name": "List.cons_append", "module": "Init.Data.List.Basic" }, { "name": "List.nil_append", "module": "Init.Data.List.Basic" }, { "name": "and_true", "module": "Init.SimpLemmas" }, { "name": "true_and", "...
[ { "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": "FlatOperation.constraintsHold_cons", "content": "lemma constraintsHold_cons : ∀ {op : FlatOperation F}, ∀ {ops : List (FlatOperation F)}, ∀ {env : Environment F},\n ConstraintsHoldFlat env (op :: ops) ↔ ConstraintsHoldFlat env [op] ∧ ConstraintsHoldFlat env ops" }, { "name": "FlatOpera...
import Clean.Circuit.Basic import Clean.Circuit.Theorems variable {F : Type} [Field F] namespace FlatOperation open Circuit (ConstraintsHold.Completeness ConstraintsHold) end FlatOperation variable {α β: TypeMap} [ProvableType α] [ProvableType β] section open Circuit open FlatOperation (constraintsHold_cons co...
theorem Circuit.constraintsHold_toFlat_iff : ∀ {ops : Operations F}, ∀ {env : Environment F}, ConstraintsHoldFlat env ops.toFlat ↔ ConstraintsHold env ops :=
:= by intro ops env induction ops using Operations.induct with | empty => trivial -- we can handle all non-empty cases at once | witness | assert | lookup | subcircuit => dsimp only [Operations.toFlat] try rw [constraintsHold_cons] try rw [constraintsHold_append] simp_all only [ConstraintsHold...
8
75
false
Applied verif.
176
Circuit.FoldlM.output_eq
theorem output_eq : (xs.foldlM circuit init).output n = Fin.foldl m (fun acc i => (circuit acc xs[i.val]).output (n + i * constant.localLength)) init
clean
Clean/Circuit/Loops.lean
[ "import Clean.Utils.Misc", "import Clean.Circuit.Subcircuit", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Vector.mk", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Fin.foldl", "module": "Init.Data.Fin.Fo...
[ { "name": "induct", "content": "def induct {motive : {n : ℕ} → Vector α n → Sort u}\n (nil : motive #v[])\n (cons: ∀ {n : ℕ} (a : α) (as : Vector α n), motive as → motive (cons a as))\n {n : ℕ} (v : Vector α n) : motive v :=\n match v with\n | ⟨ .mk [], h ⟩ => by admit /- proof elided -/\n | ⟨ ....
[ { "name": "Fin.foldl_succ", "module": "Init.Data.Fin.Fold" }, { "name": "Fin.val_succ", "module": "Init.Data.Fin.Lemmas" }, { "name": "Fin.val_zero", "module": "Init.Data.Fin.Lemmas" }, { "name": "add_assoc", "module": "Mathlib.Algebra.Group.Defs" }, { "name": "ad...
[ { "name": "bind_output_eq", "content": "theorem bind_output_eq (f : Circuit F α) (g : α → Circuit F β) (n : ℕ) :\n (f >>= g).output n = (g (f.output n)).output (n + f.localLength n)" } ]
[]
[ { "name": "Vector.foldlM_toList", "content": "lemma Vector.foldlM_toList (xs : Vector α n) {m : Type → Type} [Monad m] (body : β → α → m β) (init : β) :\n xs.foldlM body init = xs.toList.foldlM body init" }, { "name": "Circuit.FoldlM.foldlM_cons", "content": "lemma foldlM_cons (x : α) :\n (V...
import Clean.Circuit.Subcircuit import Clean.Utils.Misc variable {n m : ℕ} {F : Type} [Field F] {α β : Type} namespace Circuit variable {prop : Condition F} namespace ForM variable {circuit : α → Circuit F Unit} (xs : Vector α m) (constant : ConstantLength circuit) (n : ℕ) end ForM namespace MapM variable {cir...
theorem output_eq : (xs.foldlM circuit init).output n = Fin.foldl m (fun acc i => (circuit acc xs[i.val]).output (n + i * constant.localLength)) init :=
:= by induction xs using Vector.induct generalizing init n case nil => rfl case cons x xs ih => rw [foldlM_cons, bind_output_eq, ih, constant.localLength_eq (init, x), finFoldl_cons_succ]
8
60
true
Applied verif.
177
Circuit.ForM.operations_eq
theorem operations_eq : (xs.forM circuit).operations n = (List.ofFn fun (i : Fin m) => (circuit xs[i.val]).operations (n + i * constant.localLength)).flatten
clean
Clean/Circuit/Loops.lean
[ "import Clean.Utils.Misc", "import Clean.Circuit.Subcircuit", "import Clean.Circuit.Theorems" ]
[ { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Vector.mk", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "List.ofFn", "module": "Init.Data.List.O...
[ { "name": "induct", "content": "def induct {motive : {n : ℕ} → Vector α n → Sort u}\n (nil : motive #v[])\n (cons: ∀ {n : ℕ} (a : α) (as : Vector α n), motive as → motive (cons a as))\n {n : ℕ} (v : Vector α n) : motive v :=\n match v with\n | ⟨ .mk [], h ⟩ => by admit /- proof elided -/\n | ⟨ ....
[ { "name": "add_mul", "module": "Mathlib.Algebra.Ring.Defs" }, { "name": "List.forM_eq_forM", "module": "Init.Data.List.Control" }, { "name": "List.forM_toArray", "module": "Init.Data.List.ToArray" }, { "name": "Vector.forM_eq_forM", "module": "Init.Data.Vector.Basic" },...
[ { "name": "bind_operations_eq", "content": "theorem bind_operations_eq (f : Circuit F α) (g : α → Circuit F β) (n : ℕ) :\n (f >>= g).operations n = f.operations n ++ (g (f.output n)).operations (n + f.localLength n)" } ]
[]
[ { "name": "Vector.forM_toList", "content": "lemma Vector.forM_toList (xs : Vector α n) {m : Type → Type} [Monad m] (body : α → m Unit) :\n xs.forM body = forM xs.toList body" }, { "name": "Circuit.ofFn_flatten_cons", "content": "private lemma ofFn_flatten_cons {circuit : α → Circuit F β} (con...
import Clean.Circuit.Subcircuit import Clean.Utils.Misc variable {n m : ℕ} {F : Type} [Field F] {α β : Type} namespace Circuit variable {prop : Condition F} namespace ForM variable {circuit : α → Circuit F Unit} (xs : Vector α m) (constant : ConstantLength circuit) (n : ℕ)
theorem operations_eq : (xs.forM circuit).operations n = (List.ofFn fun (i : Fin m) => (circuit xs[i.val]).operations (n + i * constant.localLength)).flatten :=
:= by induction xs using Vector.induct generalizing n case nil => rfl case cons x xs ih => rw [ofFn_flatten_cons, Vector.forM_toList, Vector.cons, Vector.toList_mk, List.forM_cons, ←Vector.forM_toList, bind_operations_eq, ih, constant.localLength_eq]
6
56
false
Applied verif.
178
Gadgets.Xor32.completeness
theorem completeness : Completeness (F p) elaborated Assumptions
clean
Clean/Gadgets/Xor/Xor32.lean
[ "import Clean.Gadgets.Xor.ByteXorTable", "import Clean.Circuit.Provable", "import Clean.Circuit.Expression", "import Clean.Utils.Field", "import Clean.Types.U32", "import Mathlib.Data.ZMod.Basic", "import Clean.Utils.Primes", "import Mathlib.Algebra.Field.Basic", "import Clean.Circuit.Basic", "imp...
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "String", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"let \" ident \" <== \" term : doElem", "content": "syntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem\n\nsyntax \"infer_constant_length\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let ...
[ { "name": "Fact.elim", "module": "Mathlib.Logic.Basic" }, { "name": "Nat.xor_lt_two_pow", "module": "Init.Data.Nat.Bitwise.Lemmas" }, { "name": "Fin.forall_iff", "module": "Init.Data.Fin.Lemmas" } ]
[ { "name": "val_lt_p", "content": "theorem val_lt_p {p : ℕ} (x : ℕ) : (x < p) → (x : F p).val = x" } ]
[ { "name": "Gadgets.Xor32.Inputs", "content": "structure Inputs (F : Type) where\n x: U32 F\n y: U32 F" }, { "name": "Gadgets.Xor32.main", "content": "def main (input : Var Inputs (F p)) : Circuit (F p) (Var U32 (F p)) := do\n let ⟨x, y⟩ := input\n let z ← witness fun env =>\n let z0 := (...
[ { "name": "Gadgets.Xor32.xor_val", "content": "lemma xor_val {x y : F p} (hx : x.val < 256) (hy : y.val < 256) :\n (x.val ^^^ y.val : F p).val = x.val ^^^ y.val" } ]
import Mathlib.Algebra.Field.Basic import Mathlib.Data.ZMod.Basic import Clean.Utils.Primes import Clean.Utils.Vector import Clean.Circuit.Expression import Clean.Circuit.Provable import Clean.Circuit.Basic import Clean.Utils.Field import Clean.Types.U32 import Clean.Gadgets.Xor.ByteXorTable section variable...
theorem completeness : Completeness (F p) elaborated Assumptions :=
:= by intro i0 env input_var h_env input h_input as let ⟨⟨ x0_var, x1_var, x2_var, x3_var ⟩, ⟨ y0_var, y1_var, y2_var, y3_var ⟩⟩ := input_var let ⟨⟨ x0, x1, x2, x3 ⟩, ⟨ y0, y1, y2, y3 ⟩⟩ := input simp only [circuit_norm, explicit_provable_type, Inputs.mk.injEq, U32.mk.injEq] at h_input simp onl...
7
99
true
Applied verif.
179
Circomlib.MultiAND.completeness_two
lemma completeness_two {p : ℕ} [Fact p.Prime] (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields 2) (F p)) (input : fields 2 (F p)) (h_local_witnesses : env.UsesLocalWitnessesCompleteness offset ((main input_var).operations offset)) (h_env : input = eval env input_var) (h_assumptions : ...
clean
Clean/Circomlib/Gates.lean
[ "import Clean.Circuit.Theorems", "import Clean.Utils.Field", "import Clean.Circuit", "import Mathlib.Data.Nat.Bitwise", "import Clean.Gadgets.Boolean", "import Clean.Utils.Bitwise", "import Clean.Utils.BinaryOps", "import Clean.Utils.Vector" ]
[ { "name": "ZMod", "module": "Mathlib.Data.ZMod.Defs" }, { "name": "Vector", "module": "Init.Data.Vector.Basic" }, { "name": "One", "module": "Init.Prelude" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { ...
[ { "name": "syntax \"infer_constant_length\" : tactic", "content": "syntax \"infer_constant_length\" : tactic\n\nsyntax \"let \" ident \" <== \" term : doElem\n\nsyntax \"let \" ident \" : \" term \" <== \" term : doElem" }, { "name": "macro_rules", "content": "macro_rules\n | `(doElem| let $x <...
[ { "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": "Circomlib.AND.main", "content": "def main (input : Expression (F p) × Expression (F p)) := do\n let a := input.1\n let b := input.2\n let out <== a*b\n return out" }, { "name": "Circomlib.MultiAND.main", "content": "def main : {n : ℕ} → Vector (Expression (F p)) n → Circuit (F p) ...
[]
import Clean.Circuit import Clean.Utils.Field import Clean.Gadgets.Boolean import Clean.Utils.Bitwise import Clean.Utils.Vector import Clean.Utils.BinaryOps import Clean.Circuit.Theorems import Mathlib.Data.Nat.Bitwise open IsBool namespace Circomlib variable {p : ℕ} [Fact p.Prime] open Circuit (bind_output_...
lemma completeness_two {p : ℕ} [Fact p.Prime] (offset : ℕ) (env : Environment (F p)) (input_var : Var (fields 2) (F p)) (input : fields 2 (F p)) (h_local_witnesses : env.UsesLocalWitnessesCompleteness offset ((main input_var).operations offset)) (h_env : input = eval env input_var) (h_assumptions : ...
:= by simp only [main, circuit_norm] at h_local_witnesses ⊢ have h_binary0 : IsBool input[0] := h_assumptions 0 (by norm_num) have h_binary1 : IsBool input[1] := h_assumptions 1 (by norm_num) apply AND.circuit.completeness · exact h_local_witnesses · subst h_env rfl · simp only [Assumptions] at h_as...
9
85
false
Applied verif.
180
xfor_inv_lemma
lemma xfor_inv_lemma (I : Int -> hProp) (a b : Int) (F : val -> formula) (Q : val -> hProp) : structural_pred F -> a <= b -> (∃ H', H ==> I a ∗ H' ∧ (∀ i, a <= i ∧ i < b -> I i ==> F i fun _ => I (i + 1)) ∧ (fun _ => I b ∗ H') ===> Q) -> H ==> wpgen_for a b F 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 \"∃ʰ\" xs:Lean.explicitBinders \", \" b:term : term => Lea", "content": "macro \"∃ʰ\" xs:Lean.explicitBinders \", \" b:term : term => Lean.expandExplicitBinders ``hexists xs b\n\nsyntax \"fun\" ident+ \" => \" lang : lang" }, { "name": "notation:max \"emp\" => hempty", "content"...
[ { "name": "Int.le_induction_down", "module": "Mathlib.Data.Int.Init" } ]
[ { "name": "himpl_trans", "content": "lemma himpl_trans H2 H1 H3 :\n (H1 ==> H2) → (H2 ==> H3) → (H1 ==> H3)" } ]
[ { "name": "Theories.formula", "content": "abbrev formula := (val → hProp) → hProp" }, { "name": "Theories.mkstruct", "content": "def mkstruct (F : formula) :=\n fun (Q : val -> hProp) ↦ ∃ʰ Q', F Q' ∗ (Q' -∗ Q)" }, { "name": "Theories.structural", "content": "def structural (F : form...
[ { "name": "Theories.mkstruct_erase", "content": "lemma mkstruct_erase Q F :\n F Q ==> mkstruct F 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_inv_lemma (I : Int -> hProp) (a b : Int) (F : val -> formula) (Q : val -> hProp) : structural_pred F -> a <= b -> (∃ H', H ==> I a ∗ H' ∧ (∀ i, a <= i ∧ i < b -> I i ==> F i fun _ => I (i + 1)) ∧ (fun _ => I b ∗ H') ===> Q) -> H ==> wpgen_for a b F Q :=
:= by move=> sF L ![H' Ma Mb Mc] unfold wpgen_for apply himpl_trans; rotate_left; apply mkstruct_erase unfold_let xsimp[a,b]=> //== ls srw OfNat.ofNat instOfNat instOfNatNat /== => hs -- shave-> ls hs: i + (OfNat.ofNat 1) = i + 1; sdone shave P: ∀ i, a <= i ∧ i <= b -> I i ==> S i fun _ => I b { move=...
8
40
false
Framework
181
Matrix.PosSemidef.PosDef_iff_det_ne_zero
lemma PosSemidef.PosDef_iff_det_ne_zero [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosSemidef) : M.PosDef ↔ M.det ≠ 0
CvxLean
CvxLean/Lib/Math/Subadditivity.lean
[ "import Mathlib.LinearAlgebra.Matrix.DotProduct", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "import CvxLean.Lib.Math.LinearAlgebra.Eigenspace", "import Mathlib.LinearAlgebra.Matrix.LDL", "import Mathlib.LinearAlgebra.Matrix.PosDef", "...
[ { "name": "Matrix", "module": "Mathlib.LinearAlgebra.Matrix.Defs" }, { "name": "Matrix.IsHermitian", "module": "Mathlib.LinearAlgebra.Matrix.Hermitian" }, { "name": "A", "module": "examples.CircleOptimisation" }, { "name": "Matrix.diagonal", "module": "Mathlib.Data.Matrix...
[ { "name": "PosDef.Invertible", "content": "noncomputable instance PosDef.Invertible [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) :\n Invertible M :=\n invertibleOfIsUnitDet M (isUnit_iff_ne_zero.2 hM.det_ne_zero)" }, { "name": "det", "content": "def det {n : ℕ} (A : Matrix (Fin n) (Fi...
[ { "name": "Real.sqrt_nonneg", "module": "Mathlib.Data.Real.Sqrt" }, { "name": "Matrix.mul_assoc", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.one_mul", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.diagonal_mul_diagonal", "module": "Mathlib.Data.Ma...
[ { "name": "PosSemidef_diagonal", "content": "lemma PosSemidef_diagonal [DecidableEq n] {f : n → ℝ} (hf : ∀ i, 0 ≤ f i) :\n (diagonal f).PosSemidef" }, { "name": "PosSemidef.conjTranspose_mul_mul", "content": "lemma PosSemidef.conjTranspose_mul_mul (M N : Matrix n n 𝕜) (hM : M.PosSemidef) :\n...
[ { "name": "Matrix.IsHermitian.sqrt", "content": "noncomputable def IsHermitian.sqrt {A : Matrix n n ℝ} (hA : A.IsHermitian) : Matrix n n ℝ :=\n hA.eigenvectorMatrix * Matrix.diagonal (fun i => (hA.eigenvalues i).sqrt) * hA.eigenvectorMatrixᵀ" } ]
[ { "name": "Matrix.IsHermitian.eigenvectorMatrix_inv_mul", "content": "lemma eigenvectorMatrix_inv_mul : hA.eigenvectorMatrixInv * hA.eigenvectorMatrix = 1" }, { "name": "Matrix.IsHermitian.spectral_theorem''", "content": "theorem spectral_theorem'' :\n hA.eigenvectorMatrix * diagonal (RCLike....
import Mathlib.LinearAlgebra.Matrix.PosDef import Mathlib.LinearAlgebra.Matrix.Spectrum import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.LinearAlgebra.Matrix.LDL import Mathlib.LinearAlgebra.Matrix.DotProduct import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef import CvxLean.Lib.Math.LinearAlgebra.Mat...
lemma PosSemidef.PosDef_iff_det_ne_zero [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosSemidef) : M.PosDef ↔ M.det ≠ 0 :=
:= by refine' ⟨PosDef.det_ne_zero, _⟩; intro hdet; refine' ⟨hM.1, _⟩ intros x hx apply lt_of_le_of_ne' (hM.2 x) rw [← hM.sqrt_mul_sqrt, ← mulVec_mulVec, dotProduct_mulVec, ← transpose_transpose hM.1.sqrt, vecMul_transpose, transpose_transpose, ← conjTranspose_eq_transpose, hM.PosSemidef_sqrt.1.eq] sim...
4
58
false
Applied verif.
182
Theories.wp_ref
lemma wp_ref x v t Q : (h∀ p, (p ~~> v) -∗ wp (subst x p t) (Q ∗ ∃ʰ v', (p ~~> v'))) ==> wp (trm_ref x v 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": "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 \"h∀\"...
[ { "name": "Finmap.union_comm_of_disjoint", "module": "Mathlib.Data.Finmap" }, { "name": "Finmap.Disjoint.symm", "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": "hwand_inv", "content": "lemma hwand_inv h1 h2 H1 H2 :\n (H1 -∗ H2) h2 →\n H1 h1 →\n Finmap.Disjoint h1 h2 →\n H2 (h1 ∪ h2)" }, { "name": "hsingl_inv", ...
[ { "name": "Theories.wp", "content": "def wp (t : trm) (Q : val → hProp) : hProp :=\n fun s ↦ eval s 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 wp_ref x v t Q : (h∀ p, (p ~~> v) -∗ wp (subst x p t) (Q ∗ ∃ʰ v', (p ~~> v'))) ==> wp (trm_ref x v t) Q :=
:= by move=> > /hforall_inv hwp apply (eval.eval_ref _ _ _ _ _ (fun v' s' ↦ v' = v ∧ s' = h))=> //== > ? apply (eval_conseq _ _ (Q ∗ ∃ʰ v', p ~~> v' )) { move: (hwp p)=> {hwp} /(hwand_inv (Finmap.singleton p v)) srw union_singleton_eq_insert=> wp apply wp=> // sby unfold Finmap.Disjoint=> > /== -> }...
5
49
false
Framework
183
exact_imp_eval
lemma exact_imp_eval : evalExact s t Q → eval s t Q
splean
SPLean/Theories/Lang.lean
[ "import Mathlib.Data.Finmap", "import SPLean.Common.Heap", "import Mathlib.Data.Real.Basic", "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": "...", "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": "prim", "content": "inductive prim where\n \n | val_get : prim\n | val_set : prim\n \n | val_neg : prim\n | val_opp : prim\n | val_eq : prim\n | val_add : prim\n | val_neq : prim\n | val_sub : prim\n | val_mul : prim\n | val_div : prim\n | val_mod : prim\n \n | val_le : prim\n | va...
[]
import Mathlib.Data.Finmap import Mathlib.Data.Real.Basic import SPLean.Common.Util import SPLean.Common.Heap open Classical inductive prim where | val_get : prim | val_set : prim | val_neg : prim | val_opp : prim | val_eq : prim | val_add : prim | val_neq : prim | val_sub : prim | val_mul ...
lemma exact_imp_eval : evalExact s t Q → eval s t Q :=
:= by elim=> > { sby constructor } { sby constructor } { sby constructor } { move=> * ; sby constructor } { move=> * ; sby apply eval.eval_app_arg2 } { move=> * ; sby apply eval.eval_app_fun } { move=> * ; sby apply eval.eval_app_fix } { move=> ??? h ; apply (eval.eval_seq Q1)=>// ; exact h } { move...
6
36
false
Framework
184
Matrix.LogDetAtom.cond_elim
lemma LogDetAtom.cond_elim {t : n → ℝ} {Y Z D : Matrix n n ℝ} (ht : ∀ i, (t i).exp ≤ Y.diag i) (hD : D = Matrix.diagonal (Y.diag)) (hZ : Z = Y.toUpperTri) (hPSD : (fromBlocks D Z Zᵀ A).PosSemidef) : A.PosDef
CvxLean
CvxLean/Lib/Math/LogDet.lean
[ "import CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "import Mathlib.LinearAlgebra.Matrix.LDL", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular", "import CvxLean.Lib.Math.SchurCompleme...
[ { "name": "Fin", "module": "Init.Prelude" }, { "name": "Float", "module": "Init.Data.Float" }, { "name": "Matrix", "module": "Mathlib.LinearAlgebra.Matrix.Defs" }, { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Invertible", "module": "Mathlib....
[ { "name": "toUpperTri", "content": "def toUpperTri (A : Matrix (Fin n) (Fin n) Float) : Matrix (Fin n) (Fin n) Float :=\n fun i j => if i ≤ j then A i j else 0" }, { "name": "PosDef.Invertible", "content": "noncomputable instance PosDef.Invertible [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.Pos...
[ { "name": "congr_fun", "module": "Batteries.Logic" }, { "name": "Matrix.fromBlocks_mulVec", "module": "Mathlib.Data.Matrix.Block" }, { "name": "Finset.prod_ne_zero_iff", "module": "Mathlib.Algebra.BigOperators.GroupWithZero.Finset" }, { "name": "Matrix.det_diagonal", "mod...
[ { "name": "Real.one_sub_div_exp_pos_of_pos", "content": "lemma Real.one_sub_div_exp_pos_of_pos {x : ℝ} : 0 < x → 0 < 1 - 1 / Real.exp x" }, { "name": "evalOneSubDivExp", "content": "@[positivity (1 - (1 / (Real.exp (_ : ℝ))))]\ndef evalOneSubDivExp : PositivityExt where eval {_ _α} zα pα e := do...
[]
[ { "name": "Matrix.IsHermitian₁₁_of_IsHermitian_toBlock", "content": "lemma IsHermitian₁₁_of_IsHermitian_toBlock {A B C D : Matrix n n ℝ}\n (h : (fromBlocks A B C D).IsHermitian) : IsHermitian A" }, { "name": "Matrix.IsHermitian₂₂_of_IsHermitian_toBlock", "content": "lemma IsHermitian₂₂_of_IsH...
import Mathlib.LinearAlgebra.Matrix.LDL import CvxLean.Lib.Math.SchurComplement import CvxLean.Lib.Math.Subadditivity import CvxLean.Lib.Math.LinearAlgebra.Matrix.Triangular import CvxLean.Lib.Math.LinearAlgebra.Matrix.ToUpperTri import CvxLean.Lib.Math.LinearAlgebra.Matrix.LDL namespace Matrix open Matrix BigOp...
lemma LogDetAtom.cond_elim {t : n → ℝ} {Y Z D : Matrix n n ℝ} (ht : ∀ i, (t i).exp ≤ Y.diag i) (hD : D = Matrix.diagonal (Y.diag)) (hZ : Z = Y.toUpperTri) (hPSD : (fromBlocks D Z Zᵀ A).PosSemidef) : A.PosDef :=
:= by have h_D_pd : D.PosDef := LogDetAtom.optimality_D_posdef ht hD hZ hPSD have h_A_psd : A.PosSemidef := PosSemidef₂₂_of_PosSemidef_toBlock hPSD have h_Ddet_le_Adet : D.det ≤ A.det := LogDetAtom.optimality_Ddet_le_Adet ht hD hZ hPSD have h_Adet_pos : 0 < A.det := lt_of_lt_of_le h_D_pd.det_pos h_Ddet_le_Adet ...
6
87
false
Applied verif.
185
Tm.ren_den_eq
theorem Tm.ren_den_eq (e : Γ ⊢ τ) : ∀ {Δ}, (r : Ren Γ Δ) → ⟦e.ren r⟧ = (⟦e⟧) ∘' (⟦r⟧)
pcf-lean
PCF/Denotation.lean
[ "import PCF.Utility", "import «PCF».Flat", "import PCF.Domain", "import «PCF».Context" ]
[ { "name": "Cont", "module": "Mathlib.Control.Monad.Cont" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "And", "module": "Init.Prelude" }, { "name": "Prod", "module": "Init.Prelude" }, { "name": "Prod.fst", "module": "Init.Prelude" }, { "nam...
[ { "name": "notation:max \"⟦\" τ \" ty⟧\" => Ty.den τ", "content": "notation:max \"⟦\" τ \" ty⟧\" => Ty.den τ" }, { "name": "notation:max \"⟦\" Γ \" cx⟧\" => Ev Γ", "content": "notation:max \"⟦\" Γ \" cx⟧\" => Ev Γ" }, { "name": "notation:100 \"⟦\" t \"⟧\" => Tm.den t", "content": "no...
[ { "name": "congrArg", "module": "Init.Prelude" }, { "name": "funext {α : Sort u} {β : α → Sort v} {f g : (x : α) → β x} (h : ∀ x, f x = g x) : f = g", "module": "" } ]
[ { "name": "Domain.sup_is_mono", "content": "theorem Domain.sup_is_mono [Order α] [Domain α] {c d : Chain α} (p : c ⊑ d) : ⨆ c ⊑ ⨆ d" }, { "name": "Mono.ext", "content": "@[ext] theorem Mono.ext [Order α] [Order β] {f g : Mono α β} (p : f.act = g.act) : f = g" }, { "name": "Cont.ext", ...
[ { "name": "Ty.den", "content": "noncomputable def Ty.den : Ty → DomainType\n | .bool => ⟨Flat Bool, _, inferInstance⟩\n | .nat => ⟨Flat Nat, _, inferInstance⟩\n | .pow T₀ T₁ => by admit /- proof elided -/" }, { "name": "Ev", "content": "def Ev (Γ : Cx) : Type := ∀ τ, Var Γ τ → ↑⟦τ ty⟧" }, ...
[]
import «PCF».Flat import «PCF».Context noncomputable def Ty.den : Ty → DomainType | .bool => ⟨Flat Bool, _, inferInstance⟩ | .nat => ⟨Flat Nat, _, inferInstance⟩ | .pow T₀ T₁ => by admit /- proof elided -/ notation:max "⟦" τ " ty⟧" => Ty.den τ def Ev (Γ : Cx) : Type := ∀ τ, Var Γ τ → ↑⟦τ ty⟧ notation:max "⟦"...
theorem Tm.ren_den_eq (e : Γ ⊢ τ) : ∀ {Δ}, (r : Ren Γ Δ) → ⟦e.ren r⟧ = (⟦e⟧) ∘' (⟦r⟧) :=
:= by induction e with | fn e Φ => intro _ r calc ⟦e.fn.ren r⟧ _ = Cont.curry ((⟦e.ren (r.keep _)⟧) ∘ Ev.from) := rfl _ = Cont.curry (((⟦e⟧) ∘' ⟦r.keep _⟧) ∘ Ev.from) := by rw [Φ (r.keep _)] _ = (⟦e.fn⟧) ∘' ⟦r⟧ := by { apply Cont.ext ∘ funext intro ρ apply Cont.ext ...
12
89
false
Semantics
186
wtRename
theorem wtRename {ξ : ℕ → ℕ} {Γ Δ} {a A : Term} (hξ : Δ ⊢ ξ ∶ Γ) (hΔ : ⊢ Δ) (h : Γ ⊢ a ∶ A) : Δ ⊢ rename ξ a ∶ rename ξ 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...
[]
[]
import «src».typing open Nat open Term variable [LevelClass]
theorem wtRename {ξ : ℕ → ℕ} {Γ Δ} {a A : Term} (hξ : Δ ⊢ ξ ∶ Γ) (hΔ : ⊢ Δ) (h : Γ ⊢ a ∶ A) : Δ ⊢ rename ξ a ∶ rename ξ A :=
:= by induction h generalizing ξ Δ case var => constructor; assumption; apply_rules [hξ] case 𝒰 ih => exact Wt.𝒰 (ih hξ hΔ) case pi ihA ihB => let ihA' := ihA hξ hΔ refine Wt.pi ihA' ?_ rw [renameLiftRename] exact ihB (wRenameLift hξ) (Wf.cons hΔ ihA') case abs ihPi ihA ihb => let ihPi' ...
5
51
false
Type systems
187
Matrix.PosDef.nonsingular_inv
lemma PosDef.nonsingular_inv [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) : M⁻¹.PosDef
CvxLean
CvxLean/Lib/Math/LinearAlgebra/Matrix/PosDef.lean
[ "import Mathlib.LinearAlgebra.Matrix.PosDef", "import Mathlib.Algebra.Star.Pi" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Invertible", "module": "Mathlib.Algebra.Group.Invertible.Defs" }, { "name": "Matrix", "module": "Mathlib.LinearAlgebra.Matrix.Defs" }, { "name": "Matrix.invertibleOfIsUnitDet", "module": "Mathlib.LinearAlgebr...
[ { "name": "...", "content": "..." } ]
[ { "name": "Matrix.nondegenerate_iff_det_ne_zero", "module": "Mathlib.LinearAlgebra.Matrix.ToLinearEquiv" }, { "name": "star_eq_zero", "module": "Mathlib.Algebra.Star.Basic" }, { "name": "star_star", "module": "Mathlib.Algebra.Star.Basic" }, { "name": "Matrix.conjTranspose_non...
[ { "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": "Matrix.PosDef", "content": "noncomputable instance PosDef.Invertible [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) :\n Invertible M :=\n invertibleOfIsUnitDet M (isUnit_iff_ne_zero.2 hM.det_ne_zero)" } ]
[ { "name": "Matrix.PosDef.det_ne_zero", "content": "lemma PosDef.det_ne_zero [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) : M.det ≠ 0" }, { "name": "Matrix.IsHermitian.nonsingular_inv", "content": "lemma IsHermitian.nonsingular_inv [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.IsHermitian)\n...
import Mathlib.LinearAlgebra.Matrix.PosDef import Mathlib.Algebra.Star.Pi namespace Matrix variable {m n : Type _} [Fintype m] [Fintype n] variable {𝕜 : Type _} variable [NormedField 𝕜] [PartialOrder 𝕜] [StarRing 𝕜] [StarOrderedRing 𝕜] variable [RCLike 𝕜] noncomputable instance PosDef.Invertible [Decidable...
lemma PosDef.nonsingular_inv [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) : M⁻¹.PosDef :=
:= by refine' ⟨hM.1.nonsingular_inv (isUnit_iff_ne_zero.2 hM.det_ne_zero), _⟩ intros x hx have hMMinv := mul_nonsing_inv _ (isUnit_iff_ne_zero.2 hM.det_ne_zero) have hMinvdet : M⁻¹.det ≠ 0 := det_ne_zero_of_left_inverse hMMinv have hres := hM.2 (M⁻¹.mulVec x) (fun h => hx (eq_zero_of_mulVec_eq_zero hMinvd...
3
29
false
Applied verif.
188
Matrix.PosSemidef.sqrt_mul_sqrt
@[simp] lemma PosSemidef.sqrt_mul_sqrt {A : Matrix n n ℝ} (hA : A.PosSemidef) : hA.1.sqrt * hA.1.sqrt = A := calc hA.1.sqrt * hA.1.sqrt = hA.1.eigenvectorMatrix * (Matrix.diagonal (fun i => (hA.1.eigenvalues i).sqrt) * (hA.1.eigenvectorMatrixᵀ * hA.1.eigenvectorMatrix) * Matrix.diagonal (fun...
CvxLean
CvxLean/Lib/Math/Subadditivity.lean
[ "import Mathlib.LinearAlgebra.Matrix.DotProduct", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "import CvxLean.Lib.Math.LinearAlgebra.Eigenspace", "import Mathlib.LinearAlgebra.Matrix.LDL", "import Mathlib.LinearAlgebra.Matrix.PosDef", "...
[ { "name": "Matrix", "module": "Mathlib.LinearAlgebra.Matrix.Defs" }, { "name": "Matrix.IsHermitian", "module": "Mathlib.LinearAlgebra.Matrix.Hermitian" }, { "name": "A", "module": "examples.CircleOptimisation" }, { "name": "Matrix.diagonal", "module": "Mathlib.Data.Matrix...
[ { "name": "...", "content": "..." } ]
[ { "name": "Matrix.mul_assoc", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.one_mul", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.diagonal_mul_diagonal", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.mul_one", "module": "Mathlib.Data.Mat...
[ { "name": "spectral_theorem", "content": "theorem spectral_theorem (xs : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n)) (as : n → ℝ)\n (hxs : ∀ j, Module.End.HasEigenvector (Matrix.toLin' A) (as j) (xs j)) :\n xs.toBasis.toMatrix (Pi.basisFun 𝕜 n) * A =\n diagonal (RCLike.ofReal ∘ as) * xs.toBasis.t...
[ { "name": "Matrix.IsHermitian.sqrt", "content": "noncomputable def IsHermitian.sqrt {A : Matrix n n ℝ} (hA : A.IsHermitian) : Matrix n n ℝ :=\n hA.eigenvectorMatrix * Matrix.diagonal (fun i => (hA.eigenvalues i).sqrt) * hA.eigenvectorMatrixᵀ" } ]
[ { "name": "Matrix.IsHermitian.eigenvectorMatrix_inv_mul", "content": "lemma eigenvectorMatrix_inv_mul : hA.eigenvectorMatrixInv * hA.eigenvectorMatrix = 1" }, { "name": "Matrix.IsHermitian.spectral_theorem''", "content": "theorem spectral_theorem'' :\n hA.eigenvectorMatrix * diagonal (RCLike....
import Mathlib.LinearAlgebra.Matrix.PosDef import Mathlib.LinearAlgebra.Matrix.Spectrum import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.LinearAlgebra.Matrix.LDL import Mathlib.LinearAlgebra.Matrix.DotProduct import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef import CvxLean.Lib.Math.LinearAlgebra.Mat...
@[simp] lemma PosSemidef.sqrt_mul_sqrt {A : Matrix n n ℝ} (hA : A.PosSemidef) : hA.1.sqrt * hA.1.sqrt = A :=
:= calc hA.1.sqrt * hA.1.sqrt = hA.1.eigenvectorMatrix * (Matrix.diagonal (fun i => (hA.1.eigenvalues i).sqrt) * (hA.1.eigenvectorMatrixᵀ * hA.1.eigenvectorMatrix) * Matrix.diagonal (fun i => (hA.1.eigenvalues i).sqrt)) * hA.1.eigenvectorMatrixᵀ := by simp [IsHermitian.sqrt, Matrix.mul_ass...
3
27
false
Applied verif.
189
log_prod_gaussianPdf
lemma log_prod_gaussianPdf {N n : ℕ} (y : Fin N → Fin n → ℝ) (R : Matrix (Fin n) (Fin n) ℝ) (hR : R.PosDef) : log (∏ i : Fin N, gaussianPdf R (y i)) = ∑ i : Fin N, (- (log (sqrt ((2 * π) ^ n)) + log (sqrt R.det)) + - R⁻¹.quadForm (y i) / 2)
CvxLean
CvxLean/Lib/Math/CovarianceEstimation.lean
[ "import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef" ]
[ { "name": "Array", "module": "Init.Prelude" }, { "name": "Fin", "module": "Init.Prelude" }, { "name": "Float", "module": "Init.Data.Float" }, { "name": "Array.range", "module": "Init.Data.Array.Basic" }, { "name": "Array.zipWith", "module": "Init.Data.Array.Ba...
[ { "name": "mulVec", "content": "def mulVec (M : Matrix (Fin n) (Fin m) Float) (v : (Fin m) → Float) : Fin n → Float :=\n fun i => (fun j => M i j) ⬝ᵥᶜ v" }, { "name": "dotProduct", "content": "def dotProduct (v w : Fin n → Float) : Float :=\n (Array.zipWith (Vec.Computable.toArray v) (Vec.Comp...
[ { "name": "Real.exp_pos", "module": "Mathlib.Analysis.Complex.Exponential" }, { "name": "Real.pi_pos", "module": "Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic" }, { "name": "Real.sqrt_pos", "module": "Mathlib.Data.Real.Sqrt" }, { "name": "div_pos", "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": "Matrix.quadForm", "content": "def Matrix.quadForm {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : ℝ :=\n x ⬝ᵥ R.mulVec x" }, { "name": "gaussianPdf", "content": "def gaussianPdf {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : ℝ :=\n (1 / sqrt (((2 * π) ^ n) * R.det...
[ { "name": "gaussianPdf_pos", "content": "lemma gaussianPdf_pos {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (y : Fin n → ℝ) (h : R.PosDef) :\n 0 < gaussianPdf R y" } ]
import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef noncomputable section CovarianceEstimation open Real open Matrix open BigOperators def Matrix.quadForm {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : ℝ := x ⬝ᵥ R.mulVec x def gaussianPdf {n : ℕ} (R : Matrix (Fin n) (Fin n) ℝ) (x : Fin n → ℝ) : ℝ := ...
lemma log_prod_gaussianPdf {N n : ℕ} (y : Fin N → Fin n → ℝ) (R : Matrix (Fin n) (Fin n) ℝ) (hR : R.PosDef) : log (∏ i : Fin N, gaussianPdf R (y i)) = ∑ i : Fin N, (- (log (sqrt ((2 * π) ^ n)) + log (sqrt R.det)) + - R⁻¹.quadForm (y i) / 2) :=
:= by have : ∀ i, i ∈ Finset.univ → gaussianPdf R (y i) ≠ 0 := fun i _ => ne_of_gt (gaussianPdf_pos _ _ hR) have sqrt_2_pi_n_R_det_ne_zero: sqrt ((2 * π) ^ n * R.det) ≠ 0 := by refine' ne_of_gt (sqrt_pos.2 (mul_pos _ hR.det_pos)) exact (pow_pos (mul_pos (by positivity) pi_pos) _) rw [log_prod Finset.u...
5
52
false
Applied verif.
190
wp_mono_part
@[local simp] lemma wp_mono_part (x : NonDetT DivM α) (post₁ post₂ : α -> Prop) : (post₁ ≤ post₂) → ([totl|wp x post₁]) ≤ ([part| wp x post₂])
loom
CaseStudies/Velvet/VelvetTheory.lean
[ "import Loom.MonadAlgebras.WP.Basic", "import Loom.MonadAlgebras.NonDetT.Basic", "import Loom.MonadAlgebras.NonDetT.Extract" ]
[ { "name": "LE", "module": "Init.Prelude" }, { "name": "OrderBot", "module": "Mathlib.Order.BoundedOrder.Basic" }, { "name": "OrderTop", "module": "Mathlib.Order.BoundedOrder.Basic" }, { "name": "Cont", "module": "Mathlib.Control.Monad.Cont" }, { "name": "f", "...
[ { "name": "macro \"⌜\" p:term \"⌝\" : term => `(LE.pure $p)", "content": "macro \"⌜\" p:term \"⌝\" : term => `(LE.pure $p)" }, { "name": "open", "content": "notation \"[part|\" t \"]\" => open PartialCorrectness PartialCorrectness.DemonicChoice in t" }, { "name": "open", "content": "...
[ { "name": "le_trans", "module": "Mathlib.Order.Defs.PartialOrder" } ]
[ { "name": "TotalCorrectness.DivM.wp_eq", "content": "lemma TotalCorrectness.DivM.wp_eq (α : Type) (x : DivM α) (post : α -> Prop) :\n wp x post =\n match x with" }, { "name": "PartialCorrectness.DivM.wp_eq", "content": "lemma PartialCorrectness.DivM.wp_eq (α : Type) (x : DivM α) (post : α ->...
[]
[]
import Loom.MonadAlgebras.NonDetT.Extract notation "[totl|" t "]" => open TotalCorrectness TotalCorrectness.DemonicChoice in t notation "[part|" t "]" => open PartialCorrectness PartialCorrectness.DemonicChoice in t
@[local simp] lemma wp_mono_part (x : NonDetT DivM α) (post₁ post₂ : α -> Prop) : (post₁ ≤ post₂) → ([totl|wp x post₁]) ≤ ([part| wp x post₂]) :=
:= by intro le simp [loomLogicSimp] simp [loomLogicSimp] at le unhygienic induction x <;> try simp [loomLogicSimp] { exact le ret } { simp [[totl| DivM.wp_eq], [part| DivM.wp_eq]] intro wp1 match x_1 with | .div => trivial | .res a => simp; simp at wp1; exact f_ih a post₁...
4
43
false
Framework
191
Matrix.det_add_det_le_det_add
lemma det_add_det_le_det_add [Nonempty n] (A B : Matrix n n ℝ) (hA : A.PosSemidef) (hB : B.PosSemidef) : A.det + B.det ≤ (A + B).det
CvxLean
CvxLean/Lib/Math/Subadditivity.lean
[ "import Mathlib.LinearAlgebra.Matrix.DotProduct", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef", "import CvxLean.Lib.Math.LinearAlgebra.Matrix.Spectrum", "import CvxLean.Lib.Math.LinearAlgebra.Eigenspace", "import Mathlib.LinearAlgebra.Matrix.LDL", "import Mathlib.LinearAlgebra.Matrix.PosDef", "...
[ { "name": "Fin", "module": "Init.Prelude" }, { "name": "Float", "module": "Init.Data.Float" }, { "name": "Matrix", "module": "Mathlib.LinearAlgebra.Matrix.Defs" }, { "name": "Fin.elim0", "module": "Init.Data.Fin.Basic" }, { "name": "Float.ofNat", "module": "In...
[ { "name": "det", "content": "def det {n : ℕ} (A : Matrix (Fin n) (Fin n) Float) : Float :=\n if h : 0 < n then\n if n == 1 then A ⟨0, h⟩ ⟨0, h⟩ else\n (List.finRange n).foldl (fun s i =>\n s + (-1) ^ (Float.ofNat i.val) * A i ⟨0, h⟩ * det (minor A i ⟨0, h⟩)) 0\n else 0" }, { "name":...
[ { "name": "Real.sqrt_nonneg", "module": "Mathlib.Data.Real.Sqrt" }, { "name": "Matrix.mul_assoc", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.one_mul", "module": "Mathlib.Data.Matrix.Mul" }, { "name": "Matrix.diagonal_mul_diagonal", "module": "Mathlib.Data.Ma...
[ { "name": "PosSemidef_diagonal", "content": "lemma PosSemidef_diagonal [DecidableEq n] {f : n → ℝ} (hf : ∀ i, 0 ≤ f i) :\n (diagonal f).PosSemidef" }, { "name": "PosSemidef.conjTranspose_mul_mul", "content": "lemma PosSemidef.conjTranspose_mul_mul (M N : Matrix n n 𝕜) (hM : M.PosSemidef) :\n...
[ { "name": "Matrix.IsHermitian.sqrt", "content": "noncomputable def IsHermitian.sqrt {A : Matrix n n ℝ} (hA : A.IsHermitian) : Matrix n n ℝ :=\n hA.eigenvectorMatrix * Matrix.diagonal (fun i => (hA.eigenvalues i).sqrt) * hA.eigenvectorMatrixᵀ" } ]
[ { "name": "Finset.one_add_prod_le_prod_one_add", "content": "lemma one_add_prod_le_prod_one_add {n : Type _} [Fintype n] [Nonempty n]\n (f : n → ℝ) (hf : ∀ i, 0 ≤ f i) : 1 + (∏ i, f i) ≤ ∏ i, (1 + f i)" }, { "name": "Matrix.IsHermitian.eigenvectorMatrix_inv_mul", "content": "lemma eigenvector...
import Mathlib.LinearAlgebra.Matrix.PosDef import Mathlib.LinearAlgebra.Matrix.Spectrum import Mathlib.LinearAlgebra.Eigenspace.Basic import Mathlib.LinearAlgebra.Matrix.LDL import Mathlib.LinearAlgebra.Matrix.DotProduct import CvxLean.Lib.Math.LinearAlgebra.Matrix.PosDef import CvxLean.Lib.Math.LinearAlgebra.Mat...
lemma det_add_det_le_det_add [Nonempty n] (A B : Matrix n n ℝ) (hA : A.PosSemidef) (hB : B.PosSemidef) : A.det + B.det ≤ (A + B).det :=
:= by by_cases hA' : A.det = 0 { by_cases hB' : B.det = 0 { simp [hA', hB'] apply (hA.add hB).det_nonneg } { rw [add_comm A B, add_comm A.det B.det] apply det_add_det_le_det_add' _ _ (hB.PosDef_iff_det_ne_zero.2 hB') hA } } { apply det_add_det_le_det_add' _ _ (hA.PosDef_iff_det_ne_zero.2 hA') ...
5
105
false
Applied verif.
192
Vec.le_div_iff
lemma le_div_iff (hc : StrongLT 0 c) : a ≤ b / c ↔ a * c ≤ b
CvxLean
CvxLean/Lib/Math/Data/Vec.lean
[ "import CvxLean.Lib.Math.Data.Real", "import Mathlib.Analysis.NormedSpace.PiLp", "import CvxLean.Lib.Math.Data.Fin", "import Mathlib.Analysis.InnerProductSpace.PiL2" ]
[ { "name": "StrongLT", "module": "Mathlib.Order.Basic" } ]
[ { "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]" } ]
[]
[]
import Mathlib.Analysis.NormedSpace.PiLp import Mathlib.Analysis.InnerProductSpace.PiL2 import CvxLean.Lib.Math.Data.Real import CvxLean.Lib.Math.Data.Fin namespace Vec variable {m : Type u} {n : Type v} [Fintype m] [Fintype n] {α : Type w} section AddCommMonoid variable [AddCommMonoid α] {m : Nat} {n : Nat} (x ...
lemma le_div_iff (hc : StrongLT 0 c) : a ≤ b / c ↔ a * c ≤ b :=
:= by constructor · intro h i; have hi := h i; simp at hi; rw [_root_.le_div_iff (hc i)] at hi; exact hi · intro h i; have hi := h i; simp at hi; dsimp; rw [_root_.le_div_iff (hc i)]; exact hi
1
1
false
Applied verif.
193
Vec.div_le_iff
lemma div_le_iff (hb : StrongLT 0 b) : a / b ≤ c ↔ a ≤ c * b
CvxLean
CvxLean/Lib/Math/Data/Vec.lean
[ "import CvxLean.Lib.Math.Data.Real", "import Mathlib.Analysis.NormedSpace.PiLp", "import CvxLean.Lib.Math.Data.Fin", "import Mathlib.Analysis.InnerProductSpace.PiL2" ]
[ { "name": "StrongLT", "module": "Mathlib.Order.Basic" } ]
[ { "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]" } ]
[]
[]
import Mathlib.Analysis.NormedSpace.PiLp import Mathlib.Analysis.InnerProductSpace.PiL2 import CvxLean.Lib.Math.Data.Real import CvxLean.Lib.Math.Data.Fin namespace Vec variable {m : Type u} {n : Type v} [Fintype m] [Fintype n] {α : Type w} section AddCommMonoid variable [AddCommMonoid α] {m : Nat} {n : Nat} (x ...
lemma div_le_iff (hb : StrongLT 0 b) : a / b ≤ c ↔ a ≤ c * b :=
:= by constructor · intro h i; have hi := h i; simp at hi; rw [_root_.div_le_iff (hb i)] at hi; exact hi · intro h i; have hi := h i; simp at hi; dsimp; rw [_root_.div_le_iff (hb i)]; exact hi
1
1
false
Applied verif.
194
DemonicChoice.ExtractNonDet.extract_refines_wp
lemma ExtractNonDet.extract_refines_wp (s : NonDetT m α) (inst : ExtractNonDet Findable s) : wp s post ⊓ s.prop ⊤ <= wp s.extract post
loom
Loom/MonadAlgebras/NonDetT'/Extract.lean
[ "import Loom.MonadAlgebras.WP.Gen", "import Loom.MonadAlgebras.WP.Liberal", "import Mathlib.Order.CompleteBooleanAlgebra", "import Mathlib.Logic.Function.Basic", "import Mathlib.Data.W.Basic", "import Loom.MonadAlgebras.NonDetT'.Basic", "import Loom.MonadAlgebras.WP.Basic", "import Mathlib.Order.Latti...
[ { "name": "DecidablePred", "module": "Init.Prelude" }, { "name": "Nat", "module": "Init.Prelude" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "Encodable", "module": "Mathlib.Logic.Encodable.Basic" }, { "name": "Encodable.decode", "module": "Mat...
[ { "name": "macro \"⌜\" p:term \"⌝\" : term => `(LE.pure $p)", "content": "macro \"⌜\" p:term \"⌝\" : term => `(LE.pure $p)" }, { "name": "MonadNonDet", "content": "class MonadNonDet (m : Type u → Type v) where\n pick : (τ : Type u) → [Inhabited τ] → m τ\n \n pickSuchThat : (τ : Type u) → (p :...
[ { "name": "iInf_const", "module": "Mathlib.Order.CompleteLattice.Basic" }, { "name": "iInf_inf_eq", "module": "Mathlib.Order.CompleteLattice.Basic" }, { "name": "iInf_le_of_le", "module": "Mathlib.Order.CompleteLattice.Basic" }, { "name": "iSup_const", "module": "Mathlib....
[ { "name": "wp_pure", "content": "lemma wp_pure (x : α) (post : α -> l) : wp (m := m) (pure x) post = post x" }, { "name": "wp_bind", "content": "lemma wp_bind {β} (x : m α) (f : α -> m β) (post : β -> l) :\n wp (x >>= f) post = wp x (fun x => wp (f x) post)" }, { "name": "wlp_join_wp"...
[ { "name": "findNat", "content": "def findNat (p : Nat -> Prop) [DecidablePred p] : Option Nat :=\n let rec aux i :=\n if p i then\n some i\n else\n aux (i + 1)\n partial_fixpoint\n aux 0" }, { "name": "find", "content": "def find [Encodable α] (p : α -> Prop) [DecidablePred p]...
[]
import Mathlib.Logic.Function.Basic import Mathlib.Order.CompleteBooleanAlgebra import Mathlib.Order.Lattice import Mathlib.Order.Basic import Mathlib.Data.W.Basic import Mathlib.Data.FinEnum import Loom.MonadAlgebras.WP.Gen import Loom.MonadAlgebras.WP.Liberal import Loom.MonadAlgebras.NonDetT'.Basic open Lea...
lemma ExtractNonDet.extract_refines_wp (s : NonDetT m α) (inst : ExtractNonDet Findable s) : wp s post ⊓ s.prop ⊤ <= wp s.extract post :=
:= by unhygienic induction inst { simp [wp_pure, NonDetT.extract] } { simp [NonDetT.wp_vis, NonDetT.prop]; rw [inf_comm, wlp_join_wp] simp [NonDetT.extract, wp_bind] apply wp_cons; aesop (add norm inf_comm) } { simp [NonDetT.wp_pickCont, NonDetT.prop, NonDetT.extract]; split { have := Findable.find_...
5
77
true
Framework
195
Matrix.isUnit_det_of_PosDef_inv
lemma isUnit_det_of_PosDef_inv [DecidableEq n] {M : Matrix n n ℝ} (h : M⁻¹.PosDef) : IsUnit M.det
CvxLean
CvxLean/Lib/Math/LinearAlgebra/Matrix/PosDef.lean
[ "import Mathlib.LinearAlgebra.Matrix.PosDef", "import Mathlib.Algebra.Star.Pi" ]
[ { "name": "DecidableEq", "module": "Init.Prelude" }, { "name": "Invertible", "module": "Mathlib.Algebra.Group.Invertible.Defs" }, { "name": "Matrix", "module": "Mathlib.LinearAlgebra.Matrix.Defs" }, { "name": "Matrix.invertibleOfIsUnitDet", "module": "Mathlib.LinearAlgebr...
[ { "name": "...", "content": "..." } ]
[ { "name": "Matrix.nondegenerate_iff_det_ne_zero", "module": "Mathlib.LinearAlgebra.Matrix.ToLinearEquiv" }, { "name": "star_eq_zero", "module": "Mathlib.Algebra.Star.Basic" }, { "name": "star_star", "module": "Mathlib.Algebra.Star.Basic" }, { "name": "isUnit_iff_ne_zero", ...
[ { "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": "Matrix.PosDef", "content": "noncomputable instance PosDef.Invertible [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) :\n Invertible M :=\n invertibleOfIsUnitDet M (isUnit_iff_ne_zero.2 hM.det_ne_zero)" } ]
[ { "name": "Matrix.PosDef.det_ne_zero", "content": "lemma PosDef.det_ne_zero [DecidableEq n] {M : Matrix n n 𝕜} (hM : M.PosDef) : M.det ≠ 0" }, { "name": "Matrix.PosDef.isUnit_det", "content": "lemma PosDef.isUnit_det [DecidableEq n] {M : Matrix n n ℝ} (hM : M.PosDef) : IsUnit M.det" } ]
import Mathlib.LinearAlgebra.Matrix.PosDef import Mathlib.Algebra.Star.Pi namespace Matrix variable {m n : Type _} [Fintype m] [Fintype n] variable {𝕜 : Type _} variable [NormedField 𝕜] [PartialOrder 𝕜] [StarRing 𝕜] [StarOrderedRing 𝕜] variable [RCLike 𝕜] noncomputable instance PosDef.Invertible [Decidable...
lemma isUnit_det_of_PosDef_inv [DecidableEq n] {M : Matrix n n ℝ} (h : M⁻¹.PosDef) : IsUnit M.det :=
:= by apply isUnit_iff_ne_zero.2 have := h.isUnit_det rw [det_nonsing_inv, isUnit_ring_inverse] at this apply IsUnit.ne_zero this
3
15
false
Applied verif.
196
Lipmaa.soundness
lemma soundness {F : Type} [Field F] {n_stmt n_wit n_var : ℕ} {u_stmt : Fin n_stmt → (Polynomial F) } {u_wit : Fin n_wit → (Polynomial F) } {v_stmt : Fin n_stmt → (Polynomial F) } {v_wit : Fin n_wit → (Polynomial F) } {w_stmt : Fin n_stmt → (Polynomial F) } {w_wit : Fin n_wit → (Polynomi...
formal-snarks-project
FormalSnarksProject/SNARKs/Lipmaa/Soundness.lean
[ "import FormalSnarksProject.ToMathlib.OptionEquivRight", "import FormalSnarksProject.SNARKs.Lipmaa.Defs" ]
[ { "name": "BEq", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "MvPolynomial", "module": "Mathlib.Algebra.MvPolynomial.Basic" }, { "name": "Option", "module": ...
[ { "name": "syntax \"integral_domain_tactic\" : tactic", "content": "syntax \"integral_domain_tactic\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n| `(tactic| simplify_mvpoly_option_eqn) =>\n `(tactic|\n simp only [monomial_zero', List.singleton_append, List.cons_append, Li...
[ { "name": "dvd_mul_right", "module": "Mathlib.Algebra.Divisibility.Basic" }, { "name": "EquivLike.apply_eq_iff_eq", "module": "Mathlib.Data.FunLike.Equiv" }, { "name": "Finsupp.add_apply", "module": "Mathlib.Algebra.Group.Finsupp" }, { "name": "Finsupp.single_apply", "mod...
[ { "name": "Vars.finsupp_eq_ext", "content": "lemma Vars.finsupp_eq_ext (f g : Vars →₀ ℕ) : f = g ↔\n f Vars.y = g Vars.y" }, { "name": "MvPolynomial.sum_map_C", "content": "lemma MvPolynomial.sum_map_C {σ A R : Type} [CommSemiring R] (l : List A) (f : A → R) :\n (l.map (fun (x : A) => C (σ...
[]
[ { "name": "Lipmaa.Polynomial.mul_self_modByMonic", "content": "lemma Polynomial.mul_self_modByMonic {F : Type} [Field F] (t p : Polynomial F) (mt : t.Monic) : (t * p) %ₘ t = 0" } ]
import FormalSnarksProject.SNARKs.Lipmaa.Defs open scoped BigOperators Classical section Lipmaa open MvPolynomial Option AGMProofSystemInstantiation namespace Lipmaa section soundness
lemma soundness {F : Type} [Field F] {n_stmt n_wit n_var : ℕ} {u_stmt : Fin n_stmt → (Polynomial F) } {u_wit : Fin n_wit → (Polynomial F) } {v_stmt : Fin n_stmt → (Polynomial F) } {v_wit : Fin n_wit → (Polynomial F) } {w_stmt : Fin n_stmt → (Polynomial F) } {w_wit : Fin n_wit → (Polynomi...
:= by unfold soundness verify check_poly pairing_poly proof_element_G1_as_poly proof_element_G2_as_poly -- TODO namespcace AGMProofSystemInstantiation eliminate intros stmt prover eqns' rcases eqns' with ⟨eqns, null⟩ intro t have eqn := eqns () clear eqns null -- let C_m := fun i => prover.fst Proof_...
6
124
false
Applied verif.
197
ToySnark.soundness
lemma soundness {F : Type} [Field F] : (AGMProofSystemInstantiation.soundness F (ToySnark (F := F)) (WitEntries -> F) (fun (stmt : StmtEntries → F) (wit : WitEntries -> F) => wit WitEntries.A * stmt StmtEntries.y = stmt StmtEntries.z -- - wit WitEntries.I ∨ ...
formal-snarks-project
FormalSnarksProject/SNARKs/ToySnark.lean
[ "import Mathlib.Algebra.Polynomial.Div", "import FormalSnarksProject.ToMathlib.OptionEquivRight", "import Mathlib.Algebra.MvPolynomial.Equiv", "import FormalSnarksProject.Models.AGMProofSystemInstantiation", "import FormalSnarksProject.SoundnessTactic.SoundnessProver" ]
[ { "name": "Empty", "module": "Init.Prelude" }, { "name": "BEq", "module": "Init.Prelude" }, { "name": "Repr", "module": "Init.Data.Repr" }, { "name": "Field", "module": "Mathlib.Algebra.Field.Defs" }, { "name": "List", "module": "Init.Prelude" }, { "na...
[ { "name": "syntax \"integral_domain_tactic\" : tactic", "content": "syntax \"integral_domain_tactic\" : tactic" }, { "name": "macro_rules", "content": "macro_rules\n| `(tactic| simplify_mvpoly_option_eqn) =>\n `(tactic|\n simp only [monomial_zero', List.singleton_append, List.cons_append, Li...
[ { "name": "DFunLike.ext_iff", "module": "Mathlib.Data.FunLike.Basic" }, { "name": "and_self", "module": "Init.SimpLemmas" }, { "name": "Finsupp.add_apply", "module": "Mathlib.Algebra.Group.Finsupp" }, { "name": "Finsupp.single_apply", "module": "Mathlib.Data.Finsupp.Singl...
[ { "name": "MvPolynomial.sum_map_C", "content": "lemma MvPolynomial.sum_map_C {σ A R : Type} [CommSemiring R] (l : List A) (f : A → R) :\n (l.map (fun (x : A) => C (σ := σ) (f x))).sum = C ((l.map f).sum)" }, { "name": "AlgEquiv.list_map_sum", "content": "theorem AlgEquiv.list_map_sum {R : Typ...
[ { "name": "ToySnark.Vars", "content": "inductive Vars : Type where\n | α : Vars\n | β : Vars\nderiving Repr, BEq" }, { "name": "ToySnark.StmtEntries", "content": "inductive StmtEntries : Type where\n | x : StmtEntries\n | y : StmtEntries\n | z : StmtEntries\nderiving Repr, BEq" }, { ...
[ { "name": "ToySnark.Vars.finsupp_eq_ext", "content": "lemma Vars.finsupp_eq_ext (f g : Vars →₀ ℕ) : f = g ↔\n f Vars.α = g Vars.α\n ∧ f Vars.β = g Vars.β" } ]
import FormalSnarksProject.Models.AGMProofSystemInstantiation import Mathlib.Algebra.Polynomial.Div import FormalSnarksProject.ToMathlib.OptionEquivRight import Mathlib.Algebra.MvPolynomial.Equiv import FormalSnarksProject.SoundnessTactic.SoundnessProver open scoped BigOperators Classical section ToySnark open M...
lemma soundness {F : Type} [Field F] : (AGMProofSystemInstantiation.soundness F (ToySnark (F := F)) (WitEntries -> F) (fun (stmt : StmtEntries → F) (wit : WitEntries -> F) => wit WitEntries.A * stmt StmtEntries.y = stmt StmtEntries.z -- - wit WitEntries.I ∨ ...
:= by unfold AGMProofSystemInstantiation.soundness AGMProofSystemInstantiation.verify AGMProofSystemInstantiation.proof_element_G1_as_poly AGMProofSystemInstantiation.proof_element_G2_as_poly intros stmt prover eqns' rcases eqns' with ⟨eqns, null⟩ have eqn := eqns () clear eqns null -- Step 1: Obtain the c...
5
129
false
Applied verif.
198
Intmax.theorem1
theorem theorem1 : ¬adversaryWon (attackGame requests) := λ contra ↦ by /- PAPER: Suppose an adversary and a challenger have interacted in Attack game 1. We will show that either the resulting contract balance is positive (the adver- sary lost the game), or the adversary has been able to either break the ...
FVIntmax
FVIntmax/Theorem1.lean
[ "import FVIntmax.Lemma5", "import FVIntmax.Wheels.AuthenticatedDictionary", "import FVIntmax.Request", "import FVIntmax.AttackGame", "import FVIntmax.Wheels", "import FVIntmax.Propositions", "import Mathlib", "import FVIntmax.Balance", "import FVIntmax.Lemma4", "import FVIntmax.Wheels.Dictionary",...
[ { "name": "Preorder", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Finite", "module": "Mathlib.Data.Finite.Defs" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Pre...
[ { "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": "notation:51 (priority := high) a:52 \" ≅ \" b:52 => iso a b", "content": "notation:51 (priority ...
[ { "name": "List.foldl_assoc", "module": "Init.Data.List.Lemmas" }, { "name": "List.foldl_append", "module": "Init.Data.List.Lemmas" }, { "name": "Set.mem_insert_iff", "module": "Mathlib.Data.Set.Insert" }, { "name": "Set.mem_setOf_eq", "module": "Mathlib.Data.Set.Operatio...
[ { "name": "proposition6", "content": "lemma proposition6 [Setoid' Y] {D₁ D₂ : Dict X Y} :\n (∃ join, IsLUB {D₁, D₂} join) ↔ ∀ x, D₁ x ≠ .none ∧ D₂ x ≠ .none → D₁ x ≅ D₂ x" }, { "name": "proposition4", "content": "lemma proposition4 [Setoid' X] {x y : Option X} :\n (∃ join : Option X, IsLUB {x,...
[ { "name": "Intmax.mergeR''", "content": "def mergeR'' (πs : List (BalanceProof K₁ K₂ C Pi V)) (acc : BalanceProof K₁ K₂ C Pi V) : BalanceProof K₁ K₂ C Pi V :=\n match πs with\n | [] => acc\n | π :: πs => Dict.Merge acc (mergeR'' πs π)" }, { "name": "Intmax.mergeR'''", "content": "def mergeR''...
[ { "name": "Intmax.mergeR''_eq_foldl", "content": "lemma mergeR''_eq_foldl :\n mergeR'' πs acc = mergeR''' πs acc" }, { "name": "Intmax.mergeR''_cons", "content": "@[simp]\nlemma mergeR''_cons :\n mergeR'' (π :: πs) acc = Dict.Merge acc (mergeR'' πs π)" }, { "name": "Intmax.mergeR''_app...
import FVIntmax.AttackGame import FVIntmax.Lemma3 import FVIntmax.Lemma4 import FVIntmax.Lemma5 import FVIntmax.Propositions import FVIntmax.Request import FVIntmax.Wheels import FVIntmax.Wheels.AuthenticatedDictionary import FVIntmax.Wheels.SignatureAggregation import Mathlib namespace Intmax open Classical...
theorem theorem1 : ¬adversaryWon (attackGame requests) :=
:= λ contra ↦ by /- PAPER: Suppose an adversary and a challenger have interacted in Attack game 1. We will show that either the resulting contract balance is positive (the adver- sary lost the game), or the adversary has been able to either break the bind- ing property of the authenticated dictionary ...
14
290
false
Applied verif.
199
Intmax.prop6_general
lemma prop6_general (h : ∀ i : Fin πs.length, IsLUB {mergeR'' (πs.take i.1) .initial, πs[i]} (mergeR'' (πs.take (i.1 + 1)) .initial)) : IsLUB {π | π ∈ πs} (mergeR'' πs .initial)
FVIntmax
FVIntmax/Theorem1.lean
[ "import FVIntmax.Lemma5", "import FVIntmax.Wheels.AuthenticatedDictionary", "import FVIntmax.Request", "import FVIntmax.AttackGame", "import FVIntmax.Wheels", "import FVIntmax.Propositions", "import Mathlib", "import FVIntmax.Balance", "import FVIntmax.Lemma4", "import FVIntmax.Wheels.Dictionary",...
[ { "name": "Preorder", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "Finite", "module": "Mathlib.Data.Finite.Defs" }, { "name": "Option", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Pre...
[ { "name": "notation:51 (priority := high) a:52 \" ≅ \" b:52 => iso a b", "content": "notation:51 (priority := high) a:52 \" ≅ \" b:52 => iso a b" }, { "name": "notation:65 π₁:65 \" <+> \" π₂:66 => Dict.Merge π₁ π₂", "content": "notation:65 π₁:65 \" <+> \" π₂:66 => Dict.Merge π₁ π₂" }, { ...
[ { "name": "List.foldl_assoc", "module": "Init.Data.List.Lemmas" }, { "name": "List.foldl_append", "module": "Init.Data.List.Lemmas" }, { "name": "Set.mem_insert_iff", "module": "Mathlib.Data.Set.Insert" }, { "name": "Set.mem_setOf_eq", "module": "Mathlib.Data.Set.Operatio...
[ { "name": "proposition6", "content": "lemma proposition6 [Setoid' Y] {D₁ D₂ : Dict X Y} :\n (∃ join, IsLUB {D₁, D₂} join) ↔ ∀ x, D₁ x ≠ .none ∧ D₂ x ≠ .none → D₁ x ≅ D₂ x" }, { "name": "proposition4", "content": "lemma proposition4 [Setoid' X] {x y : Option X} :\n (∃ join : Option X, IsLUB {x,...
[ { "name": "Intmax.mergeR''", "content": "def mergeR'' (πs : List (BalanceProof K₁ K₂ C Pi V)) (acc : BalanceProof K₁ K₂ C Pi V) : BalanceProof K₁ K₂ C Pi V :=\n match πs with\n | [] => acc\n | π :: πs => Dict.Merge acc (mergeR'' πs π)" }, { "name": "Intmax.mergeR'''", "content": "def mergeR''...
[ { "name": "Intmax.mergeR''_eq_foldl", "content": "lemma mergeR''_eq_foldl :\n mergeR'' πs acc = mergeR''' πs acc" }, { "name": "Intmax.mergeR''_cons", "content": "@[simp]\nlemma mergeR''_cons :\n mergeR'' (π :: πs) acc = Dict.Merge acc (mergeR'' πs π)" }, { "name": "Intmax.mergeR''_app...
import FVIntmax.AttackGame import FVIntmax.Lemma3 import FVIntmax.Lemma4 import FVIntmax.Lemma5 import FVIntmax.Propositions import FVIntmax.Request import FVIntmax.Wheels import FVIntmax.Wheels.AuthenticatedDictionary import FVIntmax.Wheels.SignatureAggregation import Mathlib namespace Intmax open Classical...
lemma prop6_general (h : ∀ i : Fin πs.length, IsLUB {mergeR'' (πs.take i.1) .initial, πs[i]} (mergeR'' (πs.take (i.1 + 1)) .initial)) : IsLUB {π | π ∈ πs} (mergeR'' πs .initial) :=
:= by replace h : ∀ (i : ℕ) (h : i < πs.length), IsLUB {mergeR'' (List.take i πs) .initial, πs[↑i]} (mergeR'' (List.take (i + 1) πs) .initial) := λ i hi ↦ h ⟨i, hi⟩ apply prop6_general_aux by_contra contra simp at contra let min₁ : Finset (Fin πs.length) := {n | ∃ i, n < ...
9
120
false
Applied verif.
200
Intmax.senderReceiver_transactionsInBlocks
lemma senderReceiver_transactionsInBlocks {s r v} {s' r' v'} {eq₁ eq₂} {i} (h₀ : i < (TransactionsInBlocks π bs).length) (h₁ : (TransactionsInBlocks π bs)[i] = ⟨(s, r, v), eq₁⟩) (h₂ : (TransactionsInBlocks π' bs)[i]'(by blast with π) = ⟨(s', r', v'), eq₂⟩) : s = s' ∧ r = r'
FVIntmax
FVIntmax/Lemma4.lean
[ "import FVIntmax.Balance" ]
[ { "name": "Preorder", "module": "Mathlib.Order.Defs.PartialOrder" }, { "name": "Zero", "module": "Init.Prelude" }, { "name": "List", "module": "Init.Prelude" }, { "name": "Finite", "module": "Mathlib.Data.Finite.Defs" }, { "name": "Fin", "module": "Init.Prelud...
[ { "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": "TransactionsInBlocks", "content": "def TransactionsInBlocks\n (π : BalanceProof K₁ K₂ C Pi V) (...
[ { "name": "List.ext_get_iff", "module": "Mathlib.Data.List.Basic" } ]
[ { "name": "receiver_transactionsInBlocks", "content": "lemma receiver_transactionsInBlocks {bs : List (Block K₁ K₂ C Sigma V)}\n {π₁ π₂ : BalanceProof K₁ K₂ C Pi V} :\n (TransactionsInBlocks π₁ bs).map (λ s ↦ s.1.2.1) =\n (TransactionsInBlocks π₂ bs).map (λ s ↦ s.1.2.1)"...
[]
[]
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 senderReceiver_transactionsInBlocks {s r v} {s' r' v'} {eq₁ eq₂} {i} (h₀ : i < (TransactionsInBlocks π bs).length) (h₁ : (TransactionsInBlocks π bs)[i] = ⟨(s, r, v), eq₁⟩) (h₂ : (TransactionsInBlocks π' bs)[i]'(by blast with π) = ⟨(s', r', v'), eq₂⟩) : s = s' ∧ r = r' :=
:= by have eq₁ := sender_transactionsInBlocks (Sigma := Sigma) (bs := bs) (π₁ := π) (π₂ := π') have eq₂ := receiver_transactionsInBlocks (Sigma := Sigma) (bs := bs) (π₁ := π) (π₂ := π') simp [List.ext_get_iff, length_transactionsInBlocks (π₁ := π') (π₂ := π)] at eq₁ eq₂ specialize eq₁ i h₀ h₀; specialize eq₂ i ...
7
49
false
Applied verif.