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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
201 | Intmax.isLUB_union_Merge_of_isLUB_isLUB_compat | lemma isLUB_union_Merge_of_isLUB_isLUB_compat {A B : Set (BalanceProof Kβ Kβ C Pi V)}
(hβ : IsLUB A jβ) (hβ : IsLUB B jβ) (hβ : jβ <β
> jβ) : IsLUB (A βͺ B) (jβ <+> jβ) | 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.SignatureAgg... | [
{
"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": "IsLUB",
"module": "Mathlib... | [
{
"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:51 Οβ:52 \" <β
> \" Οβ:52 => BalanceProof.compat Οβ Οβ",
"content": "notation:51 Οβ:52 \" <β
> \" Οβ:52 => BalanceProof.compat Οβ... | [
{
"name": "Set.mem_insert_iff",
"module": "Mathlib.Data.Set.Insert"
},
{
"name": "Set.mem_setOf_eq",
"module": "Mathlib.Data.Set.Operations"
},
{
"name": "Set.mem_singleton_iff",
"module": "Mathlib.Data.Set.Insert"
},
{
"name": "Set.mem_union",
"module": "Mathlib.Data.Set... | [
{
"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.existsLUB_iff_compat",
"content": "lemma existsLUB_iff_compat :\n (β join, IsLUB {Οβ, Οβ} join) β Οβ <β
> Οβ"
},
{
"name": "Intmax.merge_le",
"content": "lemma merge_le (hβ : Οβ β€ Οβ) (hβ : Οβ β€ Οβ) : Οβ <+> Οβ β€ Οβ"
}
] | 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 isLUB_union_Merge_of_isLUB_isLUB_compat {A B : Set (BalanceProof Kβ Kβ C Pi V)}
(hβ : IsLUB A jβ) (hβ : IsLUB B jβ) (hβ : jβ <β
> jβ) : IsLUB (A βͺ B) (jβ <+> jβ) := | := by
have hβ'' := hβ
obtain β¨j, hββ© := existsLUB_iff_compat.2 hβ
split_ands
Β· simp only [IsLUB, IsLeast, upperBounds, Set.mem_insert_iff, Set.mem_singleton_iff,
forall_eq_or_imp, forall_eq, Set.mem_setOf_eq, lowerBounds, and_imp, Set.mem_union] at hβ hβ hβ β’
rcases hβ with β¨hβ, hβ'β©
rcases hβ with ... | 7 | 52 | false | Applied verif. |
202 | Intmax.Vec.le_trans | lemma le_trans (hβ : vβ β€ vβ) (hβ : vβ β€ vβ) : vβ β€ vβ | FVIntmax | FVIntmax/Wheels.lean | [
"import Mathlib.Logic.Embedding.Basic",
"import FVIntmax.Wheels.Wheels",
"import Mathlib.Tactic",
"import Mathlib.Algebra.Order.Ring.Unbundled.Nonneg",
"import Mathlib.Data.Finmap",
"import Mathlib.Data.Set.Image",
"import Mathlib.Data.Finite.Defs",
"import Mathlib.Data.List.Intervals"
] | [
{
"name": "Vector",
"module": "Init.Data.Vector.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]"
}
] | [
{
"name": "Intmax.CryptoAssumptions.Injective",
"content": "class Injective {Ξ± Ο : Type} (f : Ξ± β Ο) where\n h : ComputationallyInfeasible (Β¬ Function.Injective f)"
},
{
"name": "Intmax.Vec.le",
"content": "def le (vβ vβ : Vector Ξ± n) :=\n β x β (vβ.1.zip vβ.1), x.1 β€ x.2"
}
] | [] | import Mathlib.Algebra.Order.Ring.Unbundled.Nonneg
import Mathlib.Data.Finite.Defs
import Mathlib.Data.Finmap
import Mathlib.Data.List.Intervals
import Mathlib.Data.Set.Image
import Mathlib.Logic.Embedding.Basic
import Mathlib.Tactic
import FVIntmax.Wheels.Wheels
namespace Intmax
namespace CryptoAssumptions
s... | lemma le_trans (hβ : vβ β€ vβ) (hβ : vβ β€ vβ) : vβ β€ vβ := | := by
dsimp [(Β·β€Β·), le] at *
rcases vβ with β¨lβ, hlββ©
rcases vβ with β¨lβ, hlββ©
rcases vβ with β¨lβ, hlββ©
simp at *
induction' lβ with hdβ tlβ ih generalizing lβ lβ n
Β· rcases lβ; exact hβ; simp_all; omega
Β· rcases lβ with _ | β¨hdβ, tlββ© <;> [simp; skip]
rcases lβ with _ | β¨hdβ, tlββ© <;> simp at *
... | 2 | 3 | false | Applied verif. |
203 | Intmax.monotone_TransactionsInBlocksFixed | lemma monotone_TransactionsInBlocksFixed :
Monotone Ξ» (Ο : BalanceProof Kβ Kβ C Pi V) β¦ TransactionsInBlocksFixed Ο Bstar | FVIntmax | FVIntmax/Lemma4.lean | [
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.Wheels",
"import FVIntmax.Balance"
] | [
{
"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": "BalanceProof",
"content": "abbrev BalanceProof (Kβ Kβ : Type) [Finite Kβ] [Finite Kβ]\n ... | [
{
"name": "not_and_or",
"module": "Mathlib.Logic.Basic"
},
{
"name": "congr_fun",
"module": "Batteries.Logic"
},
{
"name": "List.ext_get_iff",
"module": "Mathlib.Data.List.Basic"
}
] | [
{
"name": "le_of_ext_le",
"content": "lemma le_of_ext_le {Ξ± : Type} [Preorder Ξ±] {vβ vβ : Vector Ξ± n}\n (h : β i : Fin n, vβ.1[i] β€ vβ.1[i]) : vβ β€ vβ"
},
{
"name": "mem_dict_iff_mem_keys",
"content": "lemma mem_dict_iff_mem_keys {dict : Dict Ξ± Ο} : k β dict β k β dict.keys"
},
{
"name"... | [
{
"name": "Intmax.length_of_TransactionsInBlocks",
"content": "private abbrev length_of_TransactionsInBlocks (bs : List (Block Kβ Kβ C Sigma V)) :\n { n : β // n = (TransactionsInBlocks (Classical.arbitrary _ : BalanceProof Kβ Kβ C Pi V) bs).length } :=\n β¨(TransactionsInBlocks (Classical.arbitrary _ : Ba... | [
{
"name": "Intmax.TransactionsInBlocksFixed_le_of_TransactionsInBlocks",
"content": "lemma TransactionsInBlocksFixed_le_of_TransactionsInBlocks\n (h : β i : Fin (length_of_TransactionsInBlocks bs).1,\n (TransactionsInBlocks Ο bs)[i]'(by blast with Ο i) β€\n (TransactionsInBlocks Ο' bs)[i]'(by blast wi... | 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 monotone_TransactionsInBlocksFixed :
Monotone Ξ» (Ο : BalanceProof Kβ Kβ C Pi V) β¦ TransactionsInBlocksFixed Ο Bstar := | := by
intros Ο Ο' h
dsimp
apply TransactionsInBlocksFixed_le_of_TransactionsInBlocks; rintro β¨i, hiβ©; simp
generalize eq : (TransactionsInBlocks Ο Bstar)[i]'(by blast with Ο) = Tstar
generalize eq' : (TransactionsInBlocks Ο' Bstar)[i]'(by clear eq; blast with Ο') = Tstar'
rcases Tstar with β¨β¨s, r, vβ©, hββ©
... | 9 | 73 | false | Applied verif. |
204 | Intmax.compat_merge_of_compat | lemma compat_merge_of_compat :
(β Ο', Ο' β Ο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.Lemma4",
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.Wheels.Si... | [
{
"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:51 Οβ:52 \" <β
> \" Οβ:52 => BalanceProof.compat Οβ Οβ",
"content": "notation:51 Οβ:52 \" <β
> \" Οβ:52 => BalanceProof.compat Οβ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Merge_assoc",
"content": "lemma Merge_assoc {Dβ : Dict Ξ± Ο} :\n Merge (Merge Dβ Dβ) Dβ = Merge Dβ (Merge Dβ Dβ)"
}
] | [
{
"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.BalanceProof.compat",
"content": "de... | [
{
"name": "Intmax.merge_lem_aux",
"content": "private lemma merge_lem_aux :\n mergeR'' (Ο :: Οs) acc = acc <+> Ο <+> (mergeR'' Οs BalanceProof.initial)"
},
{
"name": "Intmax.merge_lem",
"content": "lemma merge_lem :\n mergeR'' (Ο :: Οs) BalanceProof.initial = Ο <+> (mergeR'' Οs BalanceProof.in... | 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 compat_merge_of_compat :
(β Ο', Ο' β Οs β Ο <β
> Ο') β Ο <β
> (mergeR'' Οs .initial) := | := by
induction Οs generalizing Ο with
| nil =>
intros Ο
unfold BalanceProof.compat BalanceProof.initial
simp
| cons Ο Οs ih =>
intros Ο_1 h
rw [merge_lem]
apply compat_lem <;> aesop | 5 | 22 | false | Applied verif. |
205 | Intmax.aggregateDeposits_cons | @[simp]
lemma aggregateDeposits_cons {hd} {tl : List (Block Kβ Kβ C Sigma V)} :
aggregateDeposits (hd :: tl) =
(if h : hd.isDepositBlock
then (hd.getDeposit h).2.1
else 0) +
aggregateDeposits tl | FVIntmax | FVIntmax/AttackGame.lean | [
"import FVIntmax.Wheels.AuthenticatedDictionary",
"import FVIntmax.Request",
"import FVIntmax.Block",
"import FVIntmax.Wheels.SignatureAggregation",
"import FVIntmax.BalanceProof",
"import FVIntmax.Wheels"
] | [
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Zero",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Sigma",
"module": "Init.Core"
},
{
"name": "Fin",
"module": "Init.Prelude"
},
{
... | [
{
"name": "Injective",
"content": "class Injective {Ξ± Ο : Type} (f : Ξ± β Ο) where\n h : ComputationallyInfeasible (Β¬ Function.Injective f)"
},
{
"name": "Scontract",
"content": "abbrev Scontract (Kβ Kβ V : Type) [PreWithZero V] (C Sigma : Type) :=\n List (Block Kβ Kβ C Sigma V)"
},
{
"... | [
{
"name": "Finset.mem_range",
"module": "Mathlib.Data.Finset.Range"
},
{
"name": "Finset.sum_bij",
"module": "Mathlib.Algebra.BigOperators.Group.Finset.Defs"
},
{
"name": "Finset.sum_dite_of_true",
"module": "Mathlib.Algebra.BigOperators.Group.Finset.Piecewise"
},
{
"name": "... | [
{
"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": "Intmax.aggregateDeposits",
"content": "def aggregateDeposits (Ο : Scontract Kβ Kβ V C Sigma) : V :=\n β i : Fin Ο.length,\n if h : Ο[i].isDepositBlock\n then (Ο[i.1].getDeposit h).2.1\n else 0"
},
{
"name": "Intmax.reindex",
"content": "@[simp]\nprivate def reindex : (a : β)... | [
{
"name": "Intmax.reindex_mem",
"content": "private lemma reindex_mem :\n β (a : β) (ha : a β Finset.range (k + 1) \\ {0}), reindex a ha β Finset.range k"
},
{
"name": "Intmax.reindex_inj",
"content": "private lemma reindex_inj :\n β (aβ : β) (haβ : aβ β Finset.range (k + 1) \\ {0})\n (aβ :... | import FVIntmax.Wheels.AuthenticatedDictionary
import FVIntmax.Wheels.SignatureAggregation
import FVIntmax.BalanceProof
import FVIntmax.Block
import FVIntmax.Request
import FVIntmax.Wheels
namespace Intmax
noncomputable section Intmax
section RollupContract
open Classical
section
variable {C : Type} [Nonempt... | @[simp]
lemma aggregateDeposits_cons {hd} {tl : List (Block Kβ Kβ C Sigma V)} :
aggregateDeposits (hd :: tl) =
(if h : hd.isDepositBlock
then (hd.getDeposit h).2.1
else 0) +
aggregateDeposits tl := | := by
simp [aggregateDeposits]
rw [
Finset.sum_fin_eq_sum_range,
Finset.sum_eq_sum_diff_singleton_add (i := 0),
dif_pos (show 0 < tl.length + 1 by omega)
]
simp_rw [List.getElem_cons_zero (h := _)]; case h => exact Finset.mem_range.2 (by omega)
let F : β β V := Ξ» i β¦
if h : i < tl.length
t... | 5 | 28 | false | Applied verif. |
206 | Intmax.f_transfer_source'' | lemma f_transfer_source''
(h : b.isTransferBlock) (hβ : T β TransactionsInBlock Ο b) :
(f Ο T) .Source = Ο .Source := f_transfer_source β¨β¨b, hβ©, hββ© | FVIntmax | FVIntmax/Balance.lean | [
"import FVIntmax.BalanceProof",
"import FVIntmax.Wheels",
"import FVIntmax.Propositions",
"import Mathlib",
"import FVIntmax.Key",
"import FVIntmax.Block",
"import Mathlib.Algebra.Group.Int",
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.State",
"import FVIntmax.Transaction"
] | [
{
"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": "Block",
"content": "inductive Block (Kβ Kβ : Type) (C Sigma : Type) (V : Type) [PreWithZero V] w... | [
{
"name": "Set.image_eq_range",
"module": "Mathlib.Data.Set.Image"
},
{
"name": "if_pos",
"module": "Init.Core"
},
{
"name": "Finset.mem_filter",
"module": "Mathlib.Data.Finset.Filter"
},
{
"name": "Finset.mem_sort",
"module": "Mathlib.Data.Finset.Sort"
},
{
"name... | [
{
"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": "Intmax.TransactionsInBlock_deposit",
"content": "def TransactionsInBlock_deposit\n (b : { b : Block Kβ Kβ C Sigma V // b.isDepositBlock }) : List (Ξ€ Kβ Kβ V) :=\n match h : b.1 with\n | .deposit r v => [β¨(.Source, r, v), by admit /- proof elided -/\n β©]\n | .withdrawal .. | .transfer .. => b... | [
{
"name": "Intmax.V'_eq_range",
"content": "private lemma V'_eq_range {b : S Kβ Kβ V} {T : Ξ€ Kβ Kβ V} {k : Kbar Kβ Kβ} :\n V' b T k =\n Set.range Ξ» (x : { x : (Ξ€c Kβ Kβ V Γ S Kβ Kβ V) // (T, b) β€ (βx.1, x.2) }) β¦ fc βx k"
},
{
"name": "Intmax.f_eq_f'",
"content": "lemma f_eq_f' : f = f' (Kβ :=... | import Mathlib
import Mathlib.Algebra.Group.Int
import FVIntmax.BalanceProof
import FVIntmax.Block
import FVIntmax.Key
import FVIntmax.Propositions
import FVIntmax.State
import FVIntmax.Transaction
import FVIntmax.Wheels
import FVIntmax.Wheels.Dictionary
namespace Intmax
noncomputable section
open Classical... | lemma f_transfer_source''
(h : b.isTransferBlock) (hβ : T β TransactionsInBlock Ο b) :
(f Ο T) .Source = Ο .Source := | := f_transfer_source β¨β¨b, hβ©, hββ© | 6 | 90 | false | Applied verif. |
207 | Intmax.sum_f_le_sum | lemma sum_f_le_sum : β (k : Kbar Kβ Kβ), f b T k β€ β (k : Kbar Kβ Kβ), b k | FVIntmax | FVIntmax/Lemma3.lean | [
"import FVIntmax.Balance"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Zero",
"module": "Init.Prelude"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Set",
"module": "Mathlib.Data.Set... | [
{
"name": "isComplete",
"content": "def isComplete (Ο : Ξ€ Kβ Kβ V) :=\n match Ο with | β¨(_, _, v), _β© => v.isSome"
},
{
"name": "Ξ€",
"content": "abbrev Ξ€ (Kβ Kβ V : Type) [PreWithZero V] := { Ο : Ξ€' Kβ Kβ V // Ο.isValid }"
},
{
"name": "Ξ€'",
"content": "abbrev Ξ€' (Kβ Kβ V : Type) [P... | [
{
"name": "Finset.sum_add_distrib",
"module": "Mathlib.Algebra.BigOperators.Group.Finset.Basic"
},
{
"name": "Finset.sum_smul",
"module": "Mathlib.Algebra.Module.BigOperators"
},
{
"name": "Finset.sum_le_sum",
"module": "Mathlib.Algebra.Order.BigOperators.Group.Finset"
},
{
"... | [
{
"name": "f_IsGLB_of_V'",
"content": "lemma f_IsGLB_of_V' {b : S Kβ Kβ V} {T : Ξ€ Kβ Kβ V} {k : Kbar Kβ Kβ} :\n IsGLB (V' b T k) (f b T k)"
}
] | [] | [
{
"name": "Intmax.sum_fc_eq_sum",
"content": "@[simp]\nlemma sum_fc_eq_sum : β (k : Kbar Kβ Kβ), fc (Tc, b) k = β (k : Kbar Kβ Kβ), b k"
}
] | import FVIntmax.Balance
namespace Intmax
section Lemma3
variable
{Pi C Sigma : Type}
{Kβ : Type} [Finite Kβ]
{Kβ : Type} [Finite Kβ]
{V : Type} [Lattice V] [AddCommGroup V]
[CovariantClass V V (Β· + Β·) (Β· β€ Β·)]
[CovariantClass V V (Function.swap (Β· + Β·)) (Β· β€ Β·)]
variable {Tc : Ξ€c K... | lemma sum_f_le_sum : β (k : Kbar Kβ Kβ), f b T k β€ β (k : Kbar Kβ Kβ), b k := | := by
by_cases eq : T.isComplete
Β· conv_rhs => rw [βsum_fc_eq_sum (Tc := β¨T, eqβ©)]
refine' Finset.sum_le_sum (Ξ» k _ β¦ _)
have fcInV' : fc (β¨T, eqβ©, b) k β V' b T k := by
dsimp [V']
rw [Set.mem_image]
use (β¨T, eqβ©, b)
simp
exact f_IsGLB_of_V'.1 fcInV'
Β· rcases T with β¨β¨s, r, vβ©,... | 5 | 38 | false | Applied verif. |
208 | Intmax.v_transactionsInBlocks | lemma v_transactionsInBlocks {s r v v'} {eqβ eqβ} {i}
(h : Ο β€ Ο')
(hβ : i < (TransactionsInBlocks Ο Bstar).length)
(hβ : (TransactionsInBlocks Ο Bstar)[i] = β¨(s, r, v), eqββ©)
(hβ : (TransactionsInBlocks Ο' Bstar)[i]'(by blast with Ο) = β¨(s, r, v'), eqββ©) :
v β€ v' | FVIntmax | FVIntmax/Lemma4.lean | [
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.Wheels",
"import FVIntmax.Balance"
] | [
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Zero",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Finite",
"module": "Mathlib.Data.Fi... | [
{
"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": "v'",
"content": "def v' (v : Vβ) (b : S Kβ Kβ V) (s : Kbar Kβ Kβ) : Vβ :=\n match h : s with\n ... | [
{
"name": "not_and_or",
"module": "Mathlib.Logic.Basic"
},
{
"name": "congr_fun",
"module": "Batteries.Logic"
}
] | [
{
"name": "mem_dict_iff_mem_keys",
"content": "lemma mem_dict_iff_mem_keys {dict : Dict Ξ± Ο} : k β dict β k β dict.keys"
},
{
"name": "eq_of_BalanceProof_le",
"content": "lemma eq_of_BalanceProof_le (h : Ο β€ Ο') (hβ : k β Ο) (hβ : k β Ο') :\n ((Ο k).get hβ).2 = ((Ο' k).get hβ).2"
},
{
"... | [] | [
{
"name": "Intmax.delta_TransactionsInBlock_transfer",
"content": "private lemma delta_TransactionsInBlock_transfer\n {b : { b : Block Kβ Kβ C Sigma V // b.isTransferBlock }}\n (h : Ο β€ Ο') : \n β i : β, (hlen : i < (TransactionsInBlock_transfer Ο b).length) β\n (TransactionsInBlock_transfer Ο b)[i]'h... | 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 v_transactionsInBlocks {s r v v'} {eqβ eqβ} {i}
(h : Ο β€ Ο')
(hβ : i < (TransactionsInBlocks Ο Bstar).length)
(hβ : (TransactionsInBlocks Ο Bstar)[i] = β¨(s, r, v), eqββ©)
(hβ : (TransactionsInBlocks Ο' Bstar)[i]'(by blast with Ο) = β¨(s, r, v'), eqββ©) :
v β€ v' := | := by
unfold TransactionsInBlocks at hβ hβ
apply List.map_eq_project_triple at hβ
apply List.map_eq_project_triple at hβ
rw [βhβ, βhβ]
apply List.map_join_unnecessarily_specific (by ext x; simp; rw [length_transactionsInBlock])
intros b i hβ
unfold TransactionsInBlock
match h' : b with
| Block.transfe... | 7 | 57 | false | Applied verif. |
209 | Intmax.lemma3 | lemma lemma3 : Bal Ο bs .Source β€ 0 | FVIntmax | FVIntmax/Lemma3.lean | [
"import FVIntmax.Balance"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Zero",
"module": "Init.Prelude"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Set",
"module": "Mathlib.Data.Set... | [
{
"name": "local macro:max (priority := high) \"βͺ\" b:term : term => `(β¨$",
"content": "local macro:max (priority := high) \"βͺ\" b:term : term => `(β¨$b, by admit /- proof elided -/\nβ©)"
},
{
"name": "fStar",
"content": "def fStar (Ts : List (Ξ€ Kβ Kβ V)) (sβ : S Kβ Kβ V) : S Kβ Kβ V :=\n Ts.fold... | [
{
"name": "Finset.sum_add_distrib",
"module": "Mathlib.Algebra.BigOperators.Group.Finset.Basic"
},
{
"name": "Finset.sum_smul",
"module": "Mathlib.Algebra.Module.BigOperators"
},
{
"name": "Finset.sum_le_sum",
"module": "Mathlib.Algebra.Order.BigOperators.Group.Finset"
},
{
"... | [
{
"name": "f_IsGLB_of_V'",
"content": "lemma f_IsGLB_of_V' {b : S Kβ Kβ V} {T : Ξ€ Kβ Kβ V} {k : Kbar Kβ Kβ} :\n IsGLB (V' b T k) (f b T k)"
}
] | [] | [
{
"name": "Intmax.sum_fc_eq_sum",
"content": "@[simp]\nlemma sum_fc_eq_sum : β (k : Kbar Kβ Kβ), fc (Tc, b) k = β (k : Kbar Kβ Kβ), b k"
},
{
"name": "Intmax.sum_f_le_sum",
"content": "lemma sum_f_le_sum : β (k : Kbar Kβ Kβ), f b T k β€ β (k : Kbar Kβ Kβ), b k"
},
{
"name": "Intmax.sum_fS... | import FVIntmax.Balance
namespace Intmax
section Lemma3
variable
{Pi C Sigma : Type}
{Kβ : Type} [Finite Kβ]
{Kβ : Type} [Finite Kβ]
{V : Type} [Lattice V] [AddCommGroup V]
[CovariantClass V V (Β· + Β·) (Β· β€ Β·)]
[CovariantClass V V (Function.swap (Β· + Β·)) (Β· β€ Β·)]
variable {Tc : Ξ€c K... | lemma lemma3 : Bal Ο bs .Source β€ 0 := | := by
dsimp [Bal]
generalize eq : TransactionsInBlocks Ο _ = blocks
generalize eqβ : S.initial Kβ Kβ V = sβ
generalize eqβ : fStar blocks sβ = f
have : β x β {Kbar.Source}, f x =
β x : Kbar Kβ Kβ, f x - β x β Finset.univ \ {Kbar.Source}, f x := by simp
rw [βFinset.sum_singleton (a := Kbar.Source) ... | 9 | 75 | false | Applied verif. |
210 | Intmax.proposition4 | lemma proposition4 [Setoid' X] {x y : Option X} :
(β join : Option X, IsLUB {x, y, .none} join) β (x β .none β§ y β .none β x β
y) | FVIntmax | FVIntmax/Propositions.lean | [
"import Mathlib.Order.Bounds.Basic",
"import FVIntmax.Wheels.Dictionary",
"import Aesop",
"import Mathlib.Order.Bounds.Defs",
"import Mathlib.Order.Defs"
] | [
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "IsLUB",
"module": "Mathlib.Order.Bounds.Defs"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Iff",
"module": "Init.Core"
},
{
"name": "IsLeast",
"module": "Mathlib.O... | [
{
"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": "le_trans",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "mem_upperBounds",
"module": "Mathlib.Order.Bounds.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": "Intmax.iso",
"content": "def iso {X : Type} [Preorder X] (a b : X) := a β€ b β§ b β€ a"
},
{
"name": "Intmax.IsEquivRel",
"content": "def IsEquivRel {X : Type} [Preorder X] := β a b : X, a β€ b β a β
b"
},
{
"name": "Intmax.Setoid'",
"content": "class Setoid' (X : Type) extend... | [
{
"name": "Intmax.iso_rfl",
"content": "@[simp, refl]\nlemma iso_rfl : a β
a"
},
{
"name": "Intmax.iso_trans",
"content": "@[trans]\nlemma iso_trans : (a β
b) β (b β
c) β a β
c"
},
{
"name": "Intmax.proposition2",
"content": "lemma proposition2 [Setoid' X] {x y : X} :\n (β join : X,... | import Mathlib.Order.Bounds.Basic
import Mathlib.Order.Bounds.Defs
import Mathlib.Order.Defs
import Aesop
import FVIntmax.Wheels.Dictionary
namespace Intmax
def iso {X : Type} [Preorder X] (a b : X) := a β€ b β§ b β€ a
notation:51 (priority := high) a:52 " β
" b:52 => iso a b
section iso
variable {X : Type} [Preo... | lemma proposition4 [Setoid' X] {x y : Option X} :
(β join : Option X, IsLUB {x, y, .none} join) β (x β .none β§ y β .none β x β
y) := | := by
refine' Iff.intro (Ξ» h β¨hβ, hββ© β¦ _) (Ξ» h β¦ _)
Β· rcases x with _ | x <;> rcases y with _ | y <;> [rfl; simp at hβ; simp at hβ; skip]
simp
rw [βproposition3'] at h
rcases h with β¨join, hβ©
obtain β¨hβ, hββ© := proposition2' h
exact iso_trans hβ hβ.symm
Β· rcases x with _ | x <;> rcases y with... | 3 | 19 | false | Applied verif. |
211 | Intmax.sender_transactionsInBlock | lemma sender_transactionsInBlock :
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.1) =
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.1) | FVIntmax | FVIntmax/Balance.lean | [
"import FVIntmax.BalanceProof",
"import FVIntmax.Wheels",
"import FVIntmax.Propositions",
"import Mathlib",
"import FVIntmax.Key",
"import FVIntmax.Block",
"import Mathlib.Algebra.Group.Int",
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.State",
"import FVIntmax.Transaction"
] | [
{
"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": "Block",
"content": "inductive Block (Kβ Kβ : Type) (C Sigma : Type) (V : Type) [PreWithZero V] w... | [
{
"name": "Finset.length_sort",
"module": "Mathlib.Data.Finset.Sort"
},
{
"name": "List.length_attach",
"module": "Init.Data.List.Attach"
},
{
"name": "List.length_map",
"module": "Init.Data.List.Lemmas"
},
{
"name": "exists_and_left",
"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": "Intmax.TransactionsInBlock_deposit",
"content": "def TransactionsInBlock_deposit\n (b : { b : Block Kβ Kβ C Sigma V // b.isDepositBlock }) : List (Ξ€ Kβ Kβ V) :=\n match h : b.1 with\n | .deposit r v => [β¨(.Source, r, v), by admit /- proof elided -/\n β©]\n | .withdrawal .. | .transfer .. => b... | [
{
"name": "Intmax.length_TransactionsInBlock_transfer",
"content": "lemma length_TransactionsInBlock_transfer\n {b : { b : Block Kβ Kβ C Sigma V // b.isTransferBlock }} :\n β (Οβ Οβ : BalanceProof Kβ Kβ C Pi V),\n (TransactionsInBlock_transfer Οβ b).length =\n (TransactionsInBlock_transfer Οβ b).len... | import Mathlib
import Mathlib.Algebra.Group.Int
import FVIntmax.BalanceProof
import FVIntmax.Block
import FVIntmax.Key
import FVIntmax.Propositions
import FVIntmax.State
import FVIntmax.Transaction
import FVIntmax.Wheels
import FVIntmax.Wheels.Dictionary
namespace Intmax
noncomputable section
open Classical... | lemma sender_transactionsInBlock :
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.1) =
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.1) := | := by
apply List.ext_get (by simp; rw [length_transactionsInBlock])
intros n hβ hβ
simp; unfold TransactionsInBlock
match b with
| Block.deposit .. => simp [TransactionsInBlock_deposit]
| Block.transfer .. => simp [TransactionsInBlock_transfer]
| Block.withdrawal .. => simp [TransactionsInBlock_withd... | 5 | 48 | false | Applied verif. |
212 | Intmax.receiver_transactionsInBlock | lemma receiver_transactionsInBlock :
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.2.1) =
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.2.1) | FVIntmax | FVIntmax/Balance.lean | [
"import FVIntmax.BalanceProof",
"import FVIntmax.Wheels",
"import FVIntmax.Propositions",
"import Mathlib",
"import FVIntmax.Key",
"import FVIntmax.Block",
"import Mathlib.Algebra.Group.Int",
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.State",
"import FVIntmax.Transaction"
] | [
{
"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": "Block",
"content": "inductive Block (Kβ Kβ : Type) (C Sigma : Type) (V : Type) [PreWithZero V] w... | [
{
"name": "Finset.length_sort",
"module": "Mathlib.Data.Finset.Sort"
},
{
"name": "List.length_attach",
"module": "Init.Data.List.Attach"
},
{
"name": "List.length_map",
"module": "Init.Data.List.Lemmas"
},
{
"name": "exists_and_left",
"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": "Intmax.TransactionsInBlock_deposit",
"content": "def TransactionsInBlock_deposit\n (b : { b : Block Kβ Kβ C Sigma V // b.isDepositBlock }) : List (Ξ€ Kβ Kβ V) :=\n match h : b.1 with\n | .deposit r v => [β¨(.Source, r, v), by admit /- proof elided -/\n β©]\n | .withdrawal .. | .transfer .. => b... | [
{
"name": "Intmax.length_TransactionsInBlock_transfer",
"content": "lemma length_TransactionsInBlock_transfer\n {b : { b : Block Kβ Kβ C Sigma V // b.isTransferBlock }} :\n β (Οβ Οβ : BalanceProof Kβ Kβ C Pi V),\n (TransactionsInBlock_transfer Οβ b).length =\n (TransactionsInBlock_transfer Οβ b).len... | import Mathlib
import Mathlib.Algebra.Group.Int
import FVIntmax.BalanceProof
import FVIntmax.Block
import FVIntmax.Key
import FVIntmax.Propositions
import FVIntmax.State
import FVIntmax.Transaction
import FVIntmax.Wheels
import FVIntmax.Wheels.Dictionary
namespace Intmax
noncomputable section
open Classical... | lemma receiver_transactionsInBlock :
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.2.1) =
(TransactionsInBlock Οβ b).map (Ξ» s β¦ s.1.2.1) := | := by
apply List.ext_get (by simp; rw [length_transactionsInBlock])
intros n hβ hβ
simp; unfold TransactionsInBlock
match b with
| Block.deposit .. => simp [TransactionsInBlock_deposit]
| Block.transfer .. => simp [TransactionsInBlock_transfer]
| Block.withdrawal .. => simp [TransactionsInBlock_withd... | 5 | 48 | false | Applied verif. |
213 | Intmax.f_withdrawal_block_source | lemma f_withdrawal_block_source (h : b.isWithdrawalBlock) :
((TransactionsInBlock Ο b).foldl f Ο) .Source = Ο .Source + β k : Kβ, (b.getWithdrawal h k).1 β Ο k | FVIntmax | FVIntmax/Balance.lean | [
"import FVIntmax.BalanceProof",
"import FVIntmax.Wheels",
"import FVIntmax.Propositions",
"import Mathlib",
"import FVIntmax.Key",
"import FVIntmax.Block",
"import Mathlib.Algebra.Group.Int",
"import FVIntmax.Wheels.Dictionary",
"import FVIntmax.State",
"import FVIntmax.Transaction"
] | [
{
"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": "Block",
"content": "inductive Block (Kβ Kβ : Type) (C Sigma : Type) (V : Type) [PreWithZero V] w... | [
{
"name": "Finset.filter_eq'",
"module": "Mathlib.Data.Finset.Basic"
},
{
"name": "Finset.filter_or",
"module": "Mathlib.Data.Finset.Basic"
},
{
"name": "Finset.mem_univ",
"module": "Mathlib.Data.Fintype.Defs"
},
{
"name": "Finset.sum_congr",
"module": "Mathlib.Algebra.Bi... | [
{
"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": "Intmax.TransactionsInBlock_deposit",
"content": "def TransactionsInBlock_deposit\n (b : { b : Block Kβ Kβ C Sigma V // b.isDepositBlock }) : List (Ξ€ Kβ Kβ V) :=\n match h : b.1 with\n | .deposit r v => [β¨(.Source, r, v), by admit /- proof elided -/\n β©]\n | .withdrawal .. | .transfer .. => b... | [
{
"name": "Intmax.e_def",
"content": "@[simp]\nlemma e_def : e i = Ξ» j β¦ if i = j then 1 else 0"
},
{
"name": "Intmax.v'_key_eq_meet",
"content": "@[simp]\nlemma v'_key_eq_meet {k : Key Kβ Kβ} : v' v b (Kbar.key k) = β¨v β b k, by simpβ©"
},
{
"name": "Intmax.V'_eq_range",
"content": "... | import Mathlib
import Mathlib.Algebra.Group.Int
import FVIntmax.BalanceProof
import FVIntmax.Block
import FVIntmax.Key
import FVIntmax.Propositions
import FVIntmax.State
import FVIntmax.Transaction
import FVIntmax.Wheels
import FVIntmax.Wheels.Dictionary
namespace Intmax
noncomputable section
open Classical... | lemma f_withdrawal_block_source (h : b.isWithdrawalBlock) :
((TransactionsInBlock Ο b).foldl f Ο) .Source = Ο .Source + β k : Kβ, (b.getWithdrawal h k).1 β Ο k := | := by
simp only [TransactionsInBlock]
split <;> [simp at h; simp at h; skip]
next B =>
simp only [f_eq_f', TransactionsInBlock_withdrawal, List.pure_def, List.bind_eq_flatMap,
exists_eq, Set.setOf_true, Set.toFinset_univ, Finset.mem_sort, Finset.mem_univ, forall_const,
List.flatMap_subtype, List.unattac... | 6 | 105 | false | Applied verif. |
214 | Intmax.monotone_f | lemma monotone_f (hβ : bβ β€ bβ) (hβ : Tβ β€ Tβ) : f bβ Tβ k β€ f bβ Tβ k | FVIntmax | FVIntmax/Lemma4.lean | [
"import FVIntmax.Balance"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Zero",
"module": "Init.Prelude"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Set",
"module": "Mathlib.Data.Set... | [
{
"name": "f",
"content": "def f (b : S Kβ Kβ V) (T : Ξ€ Kβ Kβ V) : S Kβ Kβ V :=\n β¨\n Ξ» k β¦\n have : InfSet V := infV b T k\n β¨
x : boundedBelow b T, fc x.1 k,\n by admit /- proof elided -/\n β©"
},
{
"name": "infV",
"content": "def infV (b : S Kβ Kβ V) (T : Ξ€ Kβ Kβ V) (k : Kbar... | [
{
"name": "le_isGLB_iff",
"module": "Mathlib.Order.Bounds.Basic"
},
{
"name": "mem_lowerBounds",
"module": "Mathlib.Order.Bounds.Basic"
}
] | [
{
"name": "V'_sset_V'_of_le",
"content": "lemma V'_sset_V'_of_le {bβ bβ : S Kβ Kβ V} {Tβ Tβ : Ξ€ Kβ Kβ V} {k : Kbar Kβ Kβ}\n (h : bβ β€ bβ) (hβ : Tβ β€ Tβ) : \n V' bβ Tβ k β V' bβ Tβ k"
},
{
"name": "boundedBelow_sset_boundedBelow_of_le",
"content": "lemma boundedBelow_sset_boundedBelow_of_le {bβ... | [] | [] | 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 monotone_f (hβ : bβ β€ bβ) (hβ : Tβ β€ Tβ) : f bβ Tβ k β€ f bβ Tβ k := | := by
obtain β¨infβ, -β© := f_IsGLB_of_V' (b := bβ) (T := Tβ) (k := k)
have infβ := f_IsGLB_of_V' (b := bβ) (T := Tβ) (k := k)
have := V'_sset_V'_of_le (k := k) hβ hβ
rw [le_isGLB_iff infβ, mem_lowerBounds]
aesop | 8 | 36 | false | Applied verif. |
215 | Intmax.proposition6 | lemma proposition6 [Setoid' Y] {Dβ Dβ : Dict X Y} :
(β join, IsLUB {Dβ, Dβ} join) β β x, Dβ x β .none β§ Dβ x β .none β Dβ x β
Dβ x | FVIntmax | FVIntmax/Propositions.lean | [
"import Mathlib.Order.Bounds.Basic",
"import FVIntmax.Wheels.Dictionary",
"import Aesop",
"import Mathlib.Order.Bounds.Defs",
"import Mathlib.Order.Defs"
] | [
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "IsLUB",
"module": "Mathlib.Order.Bounds.Defs"
},
{
"name": "IsLeast",
"module": "Mathlib.Order.Bounds.Defs"
},
{
"name": "Prod",
"mo... | [
{
"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": "Merge",
"content": "def Merge (Dβ Dβ : Dict Ξ± Ο) : Dict Ξ± Ο := D\n where D := Ξ» x β¦ First (Dβ x) (Dβ x)"
},
{
"name": "First",
... | [
{
"name": "le_trans",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "mem_upperBounds",
"module": "Mathlib.Order.Bounds.Basic"
},
{
"name": "isLUB_pi",
"module": "Mathlib.Order.Bounds.Image"
}
] | [
{
"name": "mem_iff_isSome",
"content": "lemma mem_iff_isSome {m : Dict Ξ± Ο} {x : Ξ±} : x β m β (m x).isSome"
}
] | [
{
"name": "Intmax.iso",
"content": "def iso {X : Type} [Preorder X] (a b : X) := a β€ b β§ b β€ a"
},
{
"name": "Intmax.IsEquivRel",
"content": "def IsEquivRel {X : Type} [Preorder X] := β a b : X, a β€ b β a β
b"
},
{
"name": "Intmax.Setoid'",
"content": "class Setoid' (X : Type) extend... | [
{
"name": "Intmax.iso_rfl",
"content": "@[simp, refl]\nlemma iso_rfl : a β
a"
},
{
"name": "Intmax.iso_trans",
"content": "@[trans]\nlemma iso_trans : (a β
b) β (b β
c) β a β
c"
},
{
"name": "Intmax.proposition2",
"content": "lemma proposition2 [Setoid' X] {x y : X} :\n (β join : X,... | import Mathlib.Order.Bounds.Basic
import Mathlib.Order.Bounds.Defs
import Mathlib.Order.Defs
import Aesop
import FVIntmax.Wheels.Dictionary
namespace Intmax
def iso {X : Type} [Preorder X] (a b : X) := a β€ b β§ b β€ a
notation:51 (priority := high) a:52 " β
" b:52 => iso a b
section iso
variable {X : Type} [Preo... | lemma proposition6 [Setoid' Y] {Dβ Dβ : Dict X Y} :
(β join, IsLUB {Dβ, Dβ} join) β β x, Dβ x β .none β§ Dβ x β .none β Dβ x β
Dβ x := | := by
refine' β¨Ξ» h β¦ _, Ξ» h β¦ _β©
simp_rw [proposition5] at h
simp_rw [βproposition4]
aesop
use Dβ.Merge Dβ
exact proposition6_aux h | 4 | 30 | false | Applied verif. |
216 | Intmax.proposition6' | lemma proposition6' [Setoid' Y] {Dβ Dβ join : Dict X Y} (h : IsLUB {Dβ, Dβ} join) :
join β
Dict.Merge Dβ Dβ | FVIntmax | FVIntmax/Propositions.lean | [
"import Mathlib.Order.Bounds.Basic",
"import FVIntmax.Wheels.Dictionary",
"import Aesop",
"import Mathlib.Order.Bounds.Defs",
"import Mathlib.Order.Defs"
] | [
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "IsLUB",
"module": "Mathlib.Order.Bounds.Defs"
},
{
"name": "Function.eval",
"module": "Mathlib.Logic.Function.Basic"
},
{
"name": "Set",... | [
{
"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": "Merge",
"content": "def Merge (Dβ Dβ : Dict Ξ± Ο) : Dict Ξ± Ο := D\n where D := Ξ» x β¦ First (Dβ x) (Dβ x)"
},
{
"name": "First",
... | [
{
"name": "isLUB_pi",
"module": "Mathlib.Order.Bounds.Image"
},
{
"name": "le_trans",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "mem_upperBounds",
"module": "Mathlib.Order.Bounds.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": "Intmax.iso",
"content": "def iso {X : Type} [Preorder X] (a b : X) := a β€ b β§ b β€ a"
},
{
"name": "Intmax.IsEquivRel",
"content": "def IsEquivRel {X : Type} [Preorder X] := β a b : X, a β€ b β a β
b"
},
{
"name": "Intmax.Setoid'",
"content": "class Setoid' (X : Type) extend... | [
{
"name": "Intmax.iso_rfl",
"content": "@[simp, refl]\nlemma iso_rfl : a β
a"
},
{
"name": "Intmax.iso_symm",
"content": "@[symm]\nlemma iso_symm : (a β
b) β b β
a"
},
{
"name": "Intmax.iso_trans",
"content": "@[trans]\nlemma iso_trans : (a β
b) β (b β
c) β a β
c"
},
{
"name"... | import Mathlib.Order.Bounds.Basic
import Mathlib.Order.Bounds.Defs
import Mathlib.Order.Defs
import Aesop
import FVIntmax.Wheels.Dictionary
namespace Intmax
def iso {X : Type} [Preorder X] (a b : X) := a β€ b β§ b β€ a
notation:51 (priority := high) a:52 " β
" b:52 => iso a b
section iso
variable {X : Type} [Preo... | lemma proposition6' [Setoid' Y] {Dβ Dβ join : Dict X Y} (h : IsLUB {Dβ, Dβ} join) :
join β
Dict.Merge Dβ Dβ := | := by
unfold Dict.Merge Dict.Merge.D
apply proposition5' (hβ := h)
intros x
rw [iso_symm]
apply proposition4'
revert x
rw [proposition5] at h
simpa | 5 | 30 | false | Applied verif. |
217 | Intmax.computeBalance'_eq_zero | lemma computeBalance'_eq_zero : computeBalance' Ο v = v + computeBalance' Ο 0 | FVIntmax | FVIntmax/AttackGame.lean | [
"import FVIntmax.Wheels.AuthenticatedDictionary",
"import FVIntmax.Request",
"import FVIntmax.Block",
"import FVIntmax.Wheels.SignatureAggregation",
"import FVIntmax.BalanceProof",
"import FVIntmax.Wheels"
] | [
{
"name": "Sigma",
"module": "Init.Core"
},
{
"name": "Preorder",
"module": "Mathlib.Order.Defs.PartialOrder"
},
{
"name": "Zero",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
}
] | [
{
"name": "Block",
"content": "inductive Block (Kβ Kβ : Type) (C Sigma : Type) (V : Type) [PreWithZero V] where\n \n | deposit (recipient : Kβ) (amount : Vβ)\n \n | transfer (aggregator : Kβ) (extradata : ExtraDataT) (commitment : C) (senders : List Kβ) (sigma : Sigma)\n \n | withdrawal (withdrawal... | [
{
"name": "sub_eq_add_neg",
"module": "Mathlib.Algebra.Group.Defs"
},
{
"name": "add_assoc",
"module": "Mathlib.Algebra.Group.Defs"
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Intmax.Block.updateBalance",
"content": "def Block.updateBalance (bal : V) (block : Block Kβ Kβ C Sigma V) : V :=\n match block with\n \n | .deposit _ v => bal + v\n \n | .transfer .. => bal\n \n | .withdrawal B => bal - β k : Kβ, (B k).1"
},
{
"name": "Intmax.computeBalance'"... | [
{
"name": "Intmax.Block.updateBalance_eq_zero",
"content": "lemma Block.updateBalance_eq_zero :\n block.updateBalance v = v + block.updateBalance 0"
},
{
"name": "Intmax.computeBalance'_cons",
"content": "@[simp]\nlemma computeBalance'_cons : computeBalance' (hd :: Ο) v =\n ... | import FVIntmax.Wheels.AuthenticatedDictionary
import FVIntmax.Wheels.SignatureAggregation
import FVIntmax.BalanceProof
import FVIntmax.Block
import FVIntmax.Request
import FVIntmax.Wheels
namespace Intmax
noncomputable section Intmax
section RollupContract
open Classical
section
variable {C : Type} [Nonempt... | lemma computeBalance'_eq_zero : computeBalance' Ο v = v + computeBalance' Ο 0 := | := by
induction' Ο with hd tl ih generalizing v
Β· simp
Β· rw [computeBalance'_cons, computeBalance'_cons, ih, Block.updateBalance_eq_zero]
nth_rw 2 [ih]
exact add_assoc v _ _ | 3 | 15 | false | Applied verif. |
218 | evalFuel_sound | theorem evalFuel_sound : evalFuel n c = some v β c β€³β v | IntroEffects | IntroEffects/Eval.lean | [
"import IntroEffects.SmallStep"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "Vector",
"module": "Init.Data.Vector.Basic"
},
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name":... | [
{
"name": "scoped syntax num : embedded",
"content": "scoped syntax num : embedded"
},
{
"name": "instantiateComp",
"content": "def instantiateComp (what : Value) (comp : Computation) : Computation :=\n instantiateComputationLvl what 0 comp"
},
{
"name": "instantiateComputationLvl",
... | [
{
"name": "List.find?_some",
"module": "Init.Data.List.Find"
}
] | [
{
"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": "evalSingleStep",
"content": "def evalSingleStep : Computation β Option Computation\n \n| .app (.lam body) v => some <| instantiateComp v body\n \n| .app (.recfun body) v => some <| instantiate2 (.recfun body) v body\n| .ite (.bool true) cβ _ => some cβ\n| .ite (.bool false) _ cβ => some cβ\n \n| ... | [
{
"name": "evalSingleStep_sound",
"content": "theorem evalSingleStep_sound {c c' : Computation} :\n evalSingleStep c = some c' β c β€³ c'"
}
] | import IntroEffects.SmallStep
def evalSingleStep : Computation β Option Computation
| .app (.lam body) v => some <| instantiateComp v body
| .app (.recfun body) v => some <| instantiate2 (.recfun body) v body
| .ite (.bool true) cβ _ => some cβ
| .ite (.bool false) _ cβ => some cβ
| .bind (.ret v) c => some <| i... | theorem evalFuel_sound : evalFuel n c = some v β c β€³β v := | := by
induction h : n generalizing c with
| zero => simp [evalFuel]
| succ n ih =>
cases hstep : evalSingleStep c with
| none =>
cases c <;> try grind [evalFuel]
all_goals
( simp [evalFuel]
intro h; rw [βh]; constructor)
| some c' =>
cases c with
| ret | opCall =>... | 8 | 34 | false | Semantics |
219 | evalFuelRet_complete_aux | theorem evalFuelRet_complete_aux (h : c β€³β r) :
βv, r= .ret v β βn, evalFuel n c = some (.ret v) | IntroEffects | IntroEffects/Eval.lean | [
"import IntroEffects.SmallStep"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "Vector",
"module": "Init.Data.Vector.Basic"
},
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name":... | [
{
"name": "scoped syntax num : embedded",
"content": "scoped syntax num : embedded"
},
{
"name": "instantiateComp",
"content": "def instantiateComp (what : Value) (comp : Computation) : Computation :=\n instantiateComputationLvl what 0 comp"
},
{
"name": "instantiateComputationLvl",
... | [
{
"name": "trans",
"module": "Mathlib.Order.Defs.Unbundled"
}
] | [
{
"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": "evalSingleStep",
"content": "def evalSingleStep : Computation β Option Computation\n \n| .app (.lam body) v => some <| instantiateComp v body\n \n| .app (.recfun body) v => some <| instantiate2 (.recfun body) v body\n| .ite (.bool true) cβ _ => some cβ\n| .ite (.bool false) _ cβ => some cβ\n \n| ... | [
{
"name": "evalSingleStep_complete",
"content": "theorem evalSingleStep_complete {c c' : Computation} :\n c β€³ c' β evalSingleStep c = (some c')"
},
{
"name": "evalFuel_step",
"content": "theorem evalFuel_step (h : c β€³ c') : evalFuel (n + 1) c = evalFuel n c'"
}
] | import IntroEffects.SmallStep
def evalSingleStep : Computation β Option Computation
| .app (.lam body) v => some <| instantiateComp v body
| .app (.recfun body) v => some <| instantiate2 (.recfun body) v body
| .ite (.bool true) cβ _ => some cβ
| .ite (.bool false) _ cβ => some cβ
| .bind (.ret v) c => some <| i... | theorem evalFuelRet_complete_aux (h : c β€³β r) :
βv, r= .ret v β βn, evalFuel n c = some (.ret v) := | := by
induction h with
| refl c' =>
intro v hv
exact β¨1, by grind [evalFuel]β©
| @trans c1 c2 c3 hStep hTail ih =>
intro v hv
obtain β¨n, ihFuelβ© := ih v hv
refine β¨n+1, ?_β©
simp [evalFuel_step hStep, ihFuel] | 8 | 34 | false | Semantics |
220 | evalFuelOpCall_complete_aux | theorem evalFuelOpCall_complete_aux (h : c β€³β r) :
βv, r = .opCall name v comp β βn, evalFuel n c = some (.opCall name v comp) | IntroEffects | IntroEffects/Eval.lean | [
"import IntroEffects.SmallStep"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "Vector",
"module": "Init.Data.Vector.Basic"
},
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name":... | [
{
"name": "scoped syntax num : embedded",
"content": "scoped syntax num : embedded"
},
{
"name": "instantiateComp",
"content": "def instantiateComp (what : Value) (comp : Computation) : Computation :=\n instantiateComputationLvl what 0 comp"
},
{
"name": "instantiateComputationLvl",
... | [
{
"name": "trans",
"module": "Mathlib.Order.Defs.Unbundled"
}
] | [
{
"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": "evalSingleStep",
"content": "def evalSingleStep : Computation β Option Computation\n \n| .app (.lam body) v => some <| instantiateComp v body\n \n| .app (.recfun body) v => some <| instantiate2 (.recfun body) v body\n| .ite (.bool true) cβ _ => some cβ\n| .ite (.bool false) _ cβ => some cβ\n \n| ... | [
{
"name": "evalSingleStep_complete",
"content": "theorem evalSingleStep_complete {c c' : Computation} :\n c β€³ c' β evalSingleStep c = (some c')"
},
{
"name": "evalFuel_step",
"content": "theorem evalFuel_step (h : c β€³ c') : evalFuel (n + 1) c = evalFuel n c'"
}
] | import IntroEffects.SmallStep
def evalSingleStep : Computation β Option Computation
| .app (.lam body) v => some <| instantiateComp v body
| .app (.recfun body) v => some <| instantiate2 (.recfun body) v body
| .ite (.bool true) cβ _ => some cβ
| .ite (.bool false) _ cβ => some cβ
| .bind (.ret v) c => some <| i... | theorem evalFuelOpCall_complete_aux (h : c β€³β r) :
βv, r = .opCall name v comp β βn, evalFuel n c = some (.opCall name v comp) := | := by
induction h with
| refl c' =>
intro v hv
exact β¨1, by grind [evalFuel]β©
| @trans c1 c2 c3 hStep hTail ih =>
intro v hv
obtain β¨n, ihFuelβ© := ih v hv
refine β¨n+1, ?_β©
simp [evalFuel_step hStep, ihFuel] | 8 | 34 | false | Semantics |
221 | Iris.Agree.op_inv | theorem Agree.op_inv {x y : Agree Ξ±} : (x.op y).valid β x β‘ y | iris-lean | src/Iris/Algebra/Agree.lean | [
"import Iris.Algebra.CMRA",
"import src.Iris.Algebra.CMRA",
"import src.Iris.Algebra.OFE",
"import Iris.Algebra.OFE"
] | [
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
}
] | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x",
"content": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x"
},
{
"name": "n... | [
{
"name": "List.mem_append",
"module": "Init.Data.List.Lemmas"
}
] | [
{
"name": "_root_.Iris.OFE.Dist.validN",
"content": "theorem _root_.Iris.OFE.Dist.validN : (x : Ξ±) β‘{n}β‘ y β (β{n} x β β{n} y)"
},
{
"name": "validN_iff",
"content": "theorem validN_iff {x y : Ξ±} (e : x β‘{n}β‘ y) : β{n} x β β{n} y"
},
{
"name": "IncludedN.validN",
"content": "theorem ... | [
{
"name": "Iris.Agree",
"content": "@[ext]\nstructure Agree where\n car : List Ξ±\n not_nil : car β []"
},
{
"name": "Iris.Agree.dist",
"content": "def Agree.dist (n : Nat) (x y : Agree Ξ±) : Prop :=\n (β a β x.car, β b β y.car, a β‘{n}β‘ b) β§\n (β b β y.car, β a β x.car, a β‘{n}β‘ b)"
},
{
... | [
{
"name": "Iris.mem_of_agree",
"content": "theorem mem_of_agree (x : Agree Ξ±) : β a, a β x.car"
},
{
"name": "Iris.Agree.equiv_def",
"content": "theorem Agree.equiv_def {x y : Agree Ξ±} : x β‘ y β β n, Agree.dist n x y"
},
{
"name": "Iris.Agree.validN_iff",
"content": "theorem Agree.va... | import Iris.Algebra.CMRA
import Iris.Algebra.OFE
namespace Iris
section agree
variable {Ξ± : Type u}
variable (Ξ±) in
@[ext]
structure Agree where
car : List Ξ±
not_nil : car β []
variable [OFE Ξ±]
def Agree.dist (n : Nat) (x y : Agree Ξ±) : Prop :=
(β a β x.car, β b β y.car, a β‘{n}β‘ b) β§
(β b β y.car, β a β... | theorem Agree.op_inv {x y : Agree Ξ±} : (x.op y).valid β x β‘ y := | := by
simp [valid, equiv_def]
intro h n
exact op_invN (h n) | 8 | 58 | false | Framework |
222 | Iris.OFE.ContractiveHom.fixpoint_ind | @[elab_as_elim]
theorem OFE.ContractiveHom.fixpoint_ind [COFE Ξ±] [Inhabited Ξ±] (f : Ξ± -c> Ξ±)
(P : Ξ± β Prop) (HProper : β A B : Ξ±, A β‘ B β P A β P B) (x : Ξ±) (Hbase : P x)
(Hind : β x, P x β P (f x)) (Hlim : LimitPreserving P) :
P f.fixpoint | iris-lean | src/Iris/Algebra/OFE.lean | [
"import src/Iris/Algebra/Excl.lean",
"import src/Iris/Algebra/Agree.lean",
"import src/Iris/Algebra/UPred.lean",
"import src/Iris/Algebra/COFESolver.lean",
"import src/Iris/Instances/UPred/Instance.lean",
"import src/Iris/Algebra/Agree_task.lean",
"import src/Iris/Algebra/CMRA.lean",
"import src/Iris/... | [
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y",
"content": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y"
},
... | [
{
"name": "Nat.lt_of_le_of_ne",
"module": "Init.Prelude"
},
{
"name": "Nat.le_of_lt_succ",
"module": "Init.Prelude"
},
{
"name": "Nat.lt_succ_self",
"module": "Init.Prelude"
}
] | [
{
"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": "Iris.OFE",
"content": "class OFE (Ξ± : Type _) where\n Equiv : Ξ± β Ξ± β Prop\n Dist : Nat β Ξ± β Ξ± β Prop\n dist_eqv : Equivalence (Dist n)\n equiv_dist : Equiv x y β β n, Dist n x y\n dist_lt : Dist n x y β m < n β Dist m x y"
},
{
"name": "Iris.OFE.NonExpansive",
"content": "class... | [
{
"name": "Iris.OFE.Dist.lt",
"content": "theorem Dist.lt [OFE Ξ±] {m n} {x y : Ξ±} : x β‘{n}β‘ y β m < n β x β‘{m}β‘ y"
},
{
"name": "Iris.OFE.Dist.le",
"content": "theorem Dist.le [OFE Ξ±] {m n} {x y : Ξ±} (h : x β‘{n}β‘ y) (h' : m β€ n) : x β‘{m}β‘ y"
},
{
"name": "Iris.OFE.Dist.rfl",
"content... | namespace Iris
class OFE (Ξ± : Type _) where
Equiv : Ξ± β Ξ± β Prop
Dist : Nat β Ξ± β Ξ± β Prop
dist_eqv : Equivalence (Dist n)
equiv_dist : Equiv x y β β n, Dist n x y
dist_lt : Dist n x y β m < n β Dist m x y
open OFE
scoped infix:40 " β‘ " => OFE.Equiv
scoped notation:40 x " β‘{" n "}β‘ " y:41 => OFE.Dist n x ... | @[elab_as_elim]
theorem OFE.ContractiveHom.fixpoint_ind [COFE Ξ±] [Inhabited Ξ±] (f : Ξ± -c> Ξ±)
(P : Ξ± β Prop) (HProper : β A B : Ξ±, A β‘ B β P A β P B) (x : Ξ±) (Hbase : P x)
(Hind : β x, P x β P (f x)) (Hlim : LimitPreserving P) :
P f.fixpoint := | := by
let chain : Chain Ξ± := by
refine β¨fun i => Nat.repeat f (i + 1) x, fun {n i} H => ?_β©
induction n generalizing i with
| zero => simp [Nat.repeat]
| succ _ IH =>
cases i <;> simp at H
exact Contractive.succ _ <| IH H
refine HProper _ _ (fixpoint_unique (x := COFE.compl chain) ?_) ?_... | 5 | 47 | true | Framework |
223 | Iris.BI.wand_iff_exists_persistently | theorem wand_iff_exists_persistently [BI PROP] [BIAffine PROP] {P Q : PROP} :
(P -β Q) β£β’ β R, R β <pers> (P β R β Q) | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_elim_l'",
"content": "theorem and_elim_l' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_elim_r'",
"content": "theorem and_elim_r' [BI PROP] {P Q R : PROP} (h : Q β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.imp_elim'",
"content": "theor... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem wand_iff_exists_persistently [BI PROP] [BIAffine PROP] {P Q : PROP} :
(P -β Q) β£β’ β R, R β <pers> (P β R β Q) := | := by
constructor
Β· refine (sep_true.2.trans ?_).trans (exists_intro iprop(P -β Q))
exact sep_mono_r <| persistently_pure.2.trans <| persistently_intro' <|
imp_intro <| (and_mono persistently_pure.1 wand_elim_r).trans and_elim_r
Β· exact exists_elim fun R => wand_intro' <| sep_assoc.2.trans <|
and_... | 6 | 89 | false | Framework |
224 | Iris.COFE.OFunctor.Fix.Impl.Tower.embed_up | theorem Tower.embed_up (x : A F k) :
Tower.embed (k+1) (up F k x) β‘ Tower.embed k x | iris-lean | src/Iris/Algebra/COFESolver.lean | [
"import Iris.Algebra.OFE"
] | [
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "ULift",
"module": "Init.Prelude"
},
{
"name": "Unit",
"module": "Init.Prelude"
},
{
"name": "Option"... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "COFE.OFunctor.constOF_RFunctor",
"content": "instance COFE.OFunctor.constOF_RFunctor [CMRA B] : RFunctor (constOF B) where\n map f ... | [
{
"name": "congrArg",
"module": "Init.Prelude"
},
{
"name": "symm",
"module": "Mathlib.Order.Defs.Unbundled"
},
{
"name": "Nat.add_assoc",
"module": "Init.Data.Nat.Basic"
},
{
"name": "Nat.add_left_cancel",
"module": "Init.Data.Nat.Basic"
},
{
"name": "Nat.add_lef... | [
{
"name": "exact",
"content": "theorem exact [BI PROP] (Q : PROP) : Q β’ Q"
}
] | [
{
"name": "Iris.COFE.OFunctor.Fix.Impl.A'",
"content": "def A' : Nat β Ξ£ Ξ± : Type u, COFE Ξ±\n | 0 => β¨ULift Unit, inferInstanceβ©\n | n+1 => let β¨A, _β© := A' n; β¨F A A, inferInstanceβ©"
},
{
"name": "Iris.COFE.OFunctor.Fix.Impl.A",
"content": "def A (n : Nat) : Type u := (A' F n).1"
},
{
... | [
{
"name": "Iris.COFE.OFunctor.Fix.Impl.down_up",
"content": "theorem down_up : β {k} x, down F k (up F k x) β‘ x\n | 0, β¨()β© => .rfl\n | _+1, _ => (map_comp ..).symm.trans <|\n (map_ne.eqv down_up down_up _).trans (map_id _)"
},
{
"name": "Iris.COFE.OFunctor.Fix.Impl.eqToHom_up",
"content": ... | import Iris.Algebra.OFE
namespace Iris.COFE.OFunctor
open OFE
variable {F : β Ξ± Ξ² [OFE Ξ±] [OFE Ξ²], Type u} [OFunctorContractive F]
variable [β Ξ± [COFE Ξ±], IsCOFE (F Ξ± Ξ±)]
variable [inh : Inhabited (F (ULift Unit) (ULift Unit))]
namespace Fix.Impl
variable (F) in
def A' : Nat β Ξ£ Ξ± : Type u, COFE Ξ±
| 0 => β¨ULi... | theorem Tower.embed_up (x : A F k) :
Tower.embed (k+1) (up F k x) β‘ Tower.embed k x := | := by
refine equiv_dist.2 fun n i => ?_
dsimp [Tower.embed, embed]; split <;> rename_i hβ
Β· simp [Nat.le_of_succ_le hβ]
suffices β a b (eβ : k + 1 + a = i) (eβ : k+b = i),
eqToHom eβ (upN F a (up F k x)) = eqToHom eβ (upN F b x) from this .. βΈ .rfl
rintro a b eq rfl
rw [Nat.add_right_comm, Nat.a... | 8 | 43 | false | Framework |
225 | Iris.not_add_le_self | theorem not_add_le_self {a b : Ξ±} : Β¬ a + b β€ a | iris-lean | src/Iris/Algebra/Frac.lean | [
"import Iris.Algebra.CMRA",
"import Iris.Algebra.OFE"
] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "mt",
"module": "Init.Core"
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Iris.NumericFraction",
"content": "class NumericFraction (Ξ± : Type _) extends One Ξ±, Add Ξ±, LE Ξ±, LT Ξ± where\n add_comm : β a b : Ξ±, a + b = b + a\n add_assoc : β a b c : Ξ±, a + (b + c) = (a + b) + c\n add_left_cancel : β {a b c : Ξ±}, a + b = a + c β b = c\n le_def : β {a b : Ξ±}, a β€ b β a = ... | [
{
"name": "Iris.add_ne_self",
"content": "theorem add_ne_self {a b : Ξ±} : a + b β a"
},
{
"name": "Iris.not_add_lt_self",
"content": "theorem not_add_lt_self {a b : Ξ±} : Β¬a + b < a"
}
] | import Iris.Algebra.CMRA
import Iris.Algebra.OFE
namespace Iris
namespace Fraction
variable [Fraction Ξ±]
end Fraction
open Fraction OFE CMRA
section NumericFraction
class NumericFraction (Ξ± : Type _) extends One Ξ±, Add Ξ±, LE Ξ±, LT Ξ± where
add_comm : β a b : Ξ±, a + b = b + a
add_assoc : β a b c : Ξ±, a + (b +... | theorem not_add_le_self {a b : Ξ±} : Β¬ a + b β€ a := | := fun H => by
obtain H | H := le_def.mp H
Β· exact add_ne_self H
Β· exact not_add_lt_self H | 3 | 4 | false | Framework |
226 | Iris.BI.imp_iff_exists_persistently | theorem imp_iff_exists_persistently [BI PROP] [BIAffine PROP] {P Q : PROP} :
(P β Q) β£β’ β R, R β§ <pers> (P β§ R -β Q) | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_elim_l'",
"content": "theorem and_elim_l' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_elim_r'",
"content": "theorem and_elim_r' [BI PROP] {P Q R : PROP} (h : Q β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_symm",
"content": "theore... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem imp_iff_exists_persistently [BI PROP] [BIAffine PROP] {P Q : PROP} :
(P β Q) β£β’ β R, R β§ <pers> (P β§ R -β Q) := | := by
constructor
Β· refine (and_true.2.trans ?_).trans (exists_intro iprop(P β Q))
exact and_mono_r <| persistently_emp.2.trans <| persistently_mono <|
wand_intro <| emp_sep.1.trans imp_elim_r
Β· exact exists_elim fun R => imp_intro' <| and_assoc.2.trans <|
persistently_and_intuitionistically_sep_r... | 5 | 75 | false | Framework |
227 | Iris.COFE.OFunctor.Fix.Impl.downN_upN | theorem downN_upN {k} (x : A F k) : β {i}, downN F i (upN F i x) β‘ x
| 0 => .rfl
| n+1 => ((downN F n).ne.eqv (down_up ..)).trans (downN_upN _) | iris-lean | src/Iris/Algebra/COFESolver.lean | [
"import Iris.Algebra.OFE"
] | [
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "ULift",
"module": "Init.Prelude"
},
{
"name": "Unit",
"module": "Init.Prelude"
},
{
"name": "Option"... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "COFE.OFunctor.constOF_RFunctor",
"content": "instance COFE.OFunctor.constOF_RFunctor [CMRA B] : RFunctor (constOF B) where\n map f ... | [
{
"name": "symm",
"module": "Mathlib.Order.Defs.Unbundled"
}
] | [
{
"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": "Iris.COFE.OFunctor.Fix.Impl.A'",
"content": "def A' : Nat β Ξ£ Ξ± : Type u, COFE Ξ±\n | 0 => β¨ULift Unit, inferInstanceβ©\n | n+1 => let β¨A, _β© := A' n; β¨F A A, inferInstanceβ©"
},
{
"name": "Iris.COFE.OFunctor.Fix.Impl.A",
"content": "def A (n : Nat) : Type u := (A' F n).1"
},
{
... | [
{
"name": "Iris.COFE.OFunctor.Fix.Impl.down_up",
"content": "theorem down_up : β {k} x, down F k (up F k x) β‘ x\n | 0, β¨()β© => .rfl\n | _+1, _ => (map_comp ..).symm.trans <|\n (map_ne.eqv down_up down_up _).trans (map_id _)"
}
] | import Iris.Algebra.OFE
namespace Iris.COFE.OFunctor
open OFE
variable {F : β Ξ± Ξ² [OFE Ξ±] [OFE Ξ²], Type u} [OFunctorContractive F]
variable [β Ξ± [COFE Ξ±], IsCOFE (F Ξ± Ξ±)]
variable [inh : Inhabited (F (ULift Unit) (ULift Unit))]
namespace Fix.Impl
variable (F) in
def A' : Nat β Ξ£ Ξ± : Type u, COFE Ξ±
| 0 => β¨ULi... | theorem downN_upN {k} (x : A F k) : β {i}, downN F i (upN F i x) β‘ x := | | 0 => .rfl
| n+1 => ((downN F n).ne.eqv (down_up ..)).trans (downN_upN _) | 8 | 27 | false | Framework |
228 | Iris.BI.persistently_sep | theorem persistently_sep [BI PROP] [BIPositive PROP] {P Q : PROP} :
<pers> (P β Q) β£β’ <pers> P β <pers> Q | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_elim_l'",
"content": "theorem and_elim_l' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_elim_r'",
"content": "theorem and_elim_r' [BI PROP] {P Q R : PROP} (h : Q β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_symm",
"content": "theore... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem persistently_sep [BI PROP] [BIPositive PROP] {P Q : PROP} :
<pers> (P β Q) β£β’ <pers> P β <pers> Q := | := by
refine β¨persistently_affinely.2.trans ?_, persistently_sep_2β©
refine persistently_mono affinely_sep.1 |>.trans ?_ |>.trans persistently_and_persistently_sep.1
exact and_intro
(persistently_mono <| (sep_mono_r affinely_elim_emp).trans <| sep_emp.1.trans affinely_elim)
(persistently_mono <| (sep_mono_... | 7 | 89 | false | Framework |
229 | Iris.BI.loeb_wand_intuitionistically | theorem loeb_wand_intuitionistically [BI PROP] [BILoeb PROP] {P : PROP} :
β‘ (β‘ β· P -β P) β’ P | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_elim_l'",
"content": "theorem and_elim_l' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_elim_r'",
"content": "theorem and_elim_r' [BI PROP] {P Q R : PROP} (h : Q β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_symm",
"content": "theore... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem loeb_wand_intuitionistically [BI PROP] [BILoeb PROP] {P : PROP} :
β‘ (β‘ β· P -β P) β’ P := | := by
refine .trans ?_ intuitionistically_elim
refine .trans ?_ loeb
refine imp_intro' ?_
refine (and_mono (later_mono persistently_of_intuitionistically) .rfl).trans ?_
refine (and_mono later_persistently.mp .rfl).trans ?_
refine persistently_and_intuitionistically_sep_l.mp.trans ?_
refine (sep_mono intu... | 6 | 91 | false | Framework |
230 | Iris.BI.plainly_persistently_elim | theorem plainly_persistently_elim : β <pers> P β£β’ β P | iris-lean | src/Iris/BI/Plainly.lean | [
"import Iris.Algebra",
"import Iris.BI.DerivedLaws",
"import src.Iris.Algebra.CMRA",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import src.Iris.BI.DerivedLaws",
"import src/Iris/Instances/UPred/Instance.lean",
"import Iris.BI.BI",
"import Iris.BI.Classes"
] | [
{
"name": "Lean.MonadQuotation",
"module": "Init.Prelude"
},
{
"name": "Lean.MonadRef",
"module": "Init.Prelude"
},
{
"name": "Monad",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option",
"module": "Init.Prelude"
},
... | [
{
"name": "syntax term:26 \" ==β \" term:25 : term",
"content": "syntax term:26 \" ==β \" term:25 : term\n\nsyntax term \"={ \" term \" , \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }[ \" term \" ]β·=β \" term : term\n\nsyntax term \"={ \" te... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "imp_intro'",
"content": "theorem imp_intro' [BI PROP] {P Q R : PROP} (h : Q β§ P β’ R) : P β’ Q β R"
},
{
"name": "and_comm",
"content": "theorem and_comm [BI PROP] {P Q : PROP} : P β§ Q β£β’ Q β§ P"
},
{
"name": "and_symm",
"content": "theorem and_symm [BI PROP] {P Q : PROP} : P... | [
{
"name": "Iris.Plainly",
"content": "class Plainly (PROP : Type _) where\n plainly : PROP β PROP"
},
{
"name": "Iris.Plainly.plainlyIf",
"content": "def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=\n iprop(if p then β P else P)"
},
{
"name": "... | [
{
"name": "Iris.BI.plainly_forall_2",
"content": "theorem plainly_forall_2 {Ξ¨ : Ξ± β PROP} : (β a, β (Ξ¨ a)) β’ β (β a, Ξ¨ a)"
}
] | import Iris.BI.Classes
import Iris.BI.BI
import Iris.BI.DerivedLaws
import Iris.Algebra
namespace Iris
open BI
class Plainly (PROP : Type _) where
plainly : PROP β PROP
def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=
iprop(if p then β P else P)
class BIPlainly (PRO... | theorem plainly_persistently_elim : β <pers> P β£β’ β P := | := by
constructor
Β· refine (true_and.2.trans <| and_mono emp_intro .rfl).trans ?_
refine .trans ?_ (mono <| and_forall_bool.2.trans persistently_and_emp_elim)
refine and_forall_bool.1.trans ?_
refine .trans ?_ plainly_forall_2
refine forall_mono ?_
exact (Β·.casesOn .rfl .rfl)
Β· exact idem.tran... | 6 | 75 | false | Framework |
231 | Iris.fixpoint_unique | theorem fixpoint_unique [COFE Ξ±] [Inhabited Ξ±] {f : Ξ± -c> Ξ±} {x : Ξ±} (H : x β‘ f x) :
x β‘ fixpoint f | iris-lean | src/Iris/Algebra/OFE.lean | [
"import src/Iris/Algebra/Excl.lean",
"import src/Iris/Instances/UPred/Instance.lean",
"import src/Iris/Algebra/UPred.lean",
"import src/Iris/Algebra/CMRA.lean",
"import src/Iris/Algebra/Agree_task.lean",
"import src/Iris/Algebra/COFESolver.lean",
"import src/Iris/Algebra/Heap.lean"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"na... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y",
"content": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y"
},
... | [
{
"name": "Nat.lt_of_le_of_ne",
"module": "Init.Prelude"
},
{
"name": "Nat.le_of_lt_succ",
"module": "Init.Prelude"
},
{
"name": "Nat.lt_succ_self",
"module": "Init.Prelude"
}
] | [
{
"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": "Iris.OFE",
"content": "class OFE (Ξ± : Type _) where\n Equiv : Ξ± β Ξ± β Prop\n Dist : Nat β Ξ± β Ξ± β Prop\n dist_eqv : Equivalence (Dist n)\n equiv_dist : Equiv x y β β n, Dist n x y\n dist_lt : Dist n x y β m < n β Dist m x y"
},
{
"name": "Iris.OFE.NonExpansive",
"content": "class... | [
{
"name": "Iris.OFE.Dist.lt",
"content": "theorem Dist.lt [OFE Ξ±] {m n} {x y : Ξ±} : x β‘{n}β‘ y β m < n β x β‘{m}β‘ y"
},
{
"name": "Iris.OFE.Dist.le",
"content": "theorem Dist.le [OFE Ξ±] {m n} {x y : Ξ±} (h : x β‘{n}β‘ y) (h' : m β€ n) : x β‘{m}β‘ y"
},
{
"name": "Iris.OFE.Dist.rfl",
"content... | namespace Iris
class OFE (Ξ± : Type _) where
Equiv : Ξ± β Ξ± β Prop
Dist : Nat β Ξ± β Ξ± β Prop
dist_eqv : Equivalence (Dist n)
equiv_dist : Equiv x y β β n, Dist n x y
dist_lt : Dist n x y β m < n β Dist m x y
open OFE
scoped infix:40 " β‘ " => OFE.Equiv
scoped notation:40 x " β‘{" n "}β‘ " y:41 => OFE.Dist n x ... | theorem fixpoint_unique [COFE Ξ±] [Inhabited Ξ±] {f : Ξ± -c> Ξ±} {x : Ξ±} (H : x β‘ f x) :
x β‘ fixpoint f := | := by
refine equiv_dist.mpr fun n => ?_
induction n with refine H.dist.trans <| .trans ?_ (fixpoint_unfold f).dist.symm
| zero => exact Contractive.zero f.f
| succ _ IH => exact Contractive.succ f.f IH | 6 | 45 | false | Framework |
232 | Iris.fixpoint_unfold | theorem fixpoint_unfold [COFE Ξ±] [Inhabited Ξ±] (f : Ξ± -c> Ξ±) :
fixpoint f β‘ f (fixpoint f) | iris-lean | src/Iris/Algebra/OFE.lean | [
"import src/Iris/Algebra/Excl.lean",
"import src/Iris/Instances/UPred/Instance.lean",
"import src/Iris/Algebra/UPred.lean",
"import src/Iris/Algebra/CMRA.lean",
"import src/Iris/Algebra/Agree_task.lean",
"import src/Iris/Algebra/COFESolver.lean",
"import src/Iris/Algebra/Heap.lean"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"na... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y",
"content": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y"
},
... | [
{
"name": "Nat.lt_of_le_of_ne",
"module": "Init.Prelude"
},
{
"name": "Nat.le_of_lt_succ",
"module": "Init.Prelude"
},
{
"name": "Nat.lt_succ_self",
"module": "Init.Prelude"
}
] | [
{
"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": "Iris.OFE",
"content": "class OFE (Ξ± : Type _) where\n Equiv : Ξ± β Ξ± β Prop\n Dist : Nat β Ξ± β Ξ± β Prop\n dist_eqv : Equivalence (Dist n)\n equiv_dist : Equiv x y β β n, Dist n x y\n dist_lt : Dist n x y β m < n β Dist m x y"
},
{
"name": "Iris.OFE.NonExpansive",
"content": "class... | [
{
"name": "Iris.OFE.Dist.lt",
"content": "theorem Dist.lt [OFE Ξ±] {m n} {x y : Ξ±} : x β‘{n}β‘ y β m < n β x β‘{m}β‘ y"
},
{
"name": "Iris.OFE.Dist.le",
"content": "theorem Dist.le [OFE Ξ±] {m n} {x y : Ξ±} (h : x β‘{n}β‘ y) (h' : m β€ n) : x β‘{m}β‘ y"
},
{
"name": "Iris.OFE.Dist.rfl",
"content... | namespace Iris
class OFE (Ξ± : Type _) where
Equiv : Ξ± β Ξ± β Prop
Dist : Nat β Ξ± β Ξ± β Prop
dist_eqv : Equivalence (Dist n)
equiv_dist : Equiv x y β β n, Dist n x y
dist_lt : Dist n x y β m < n β Dist m x y
open OFE
scoped infix:40 " β‘ " => OFE.Equiv
scoped notation:40 x " β‘{" n "}β‘ " y:41 => OFE.Dist n x ... | theorem fixpoint_unfold [COFE Ξ±] [Inhabited Ξ±] (f : Ξ± -c> Ξ±) :
fixpoint f β‘ f (fixpoint f) := | := by
refine equiv_dist.mpr fun n => ?_
apply COFE.conv_compl.trans
refine .trans ?_ (NonExpansive.ne COFE.conv_compl.symm)
induction n with
| zero => exact Contractive.zero f.f
| succ _ IH => exact (Contractive.succ f.f IH.symm).symm | 4 | 41 | false | Framework |
233 | Iris.BI.loeb | theorem loeb [BI PROP] [BILoeb PROP] {P : PROP} : (β· P β P) β’ P | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_elim_l'",
"content": "theorem and_elim_l' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_elim_r'",
"content": "theorem and_elim_r' [BI PROP] {P Q R : PROP} (h : Q β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_symm",
"content": "theore... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem loeb [BI PROP] [BILoeb PROP] {P : PROP} : (β· P β P) β’ P := | := by
apply entails_impl_true.mpr
apply BILoeb.loeb_weak
apply imp_intro
apply (and_mono .rfl and_self.mpr).trans
apply (and_mono .rfl (and_mono later_intro .rfl)).trans
apply (and_mono later_impl .rfl).trans
apply and_assoc.mpr.trans
apply (and_mono imp_elim_l .rfl).trans
exact imp_elim_r | 7 | 68 | false | Framework |
234 | Iris.BI.plainly_and_sep | theorem plainly_and_sep : β (P β§ Q) β’ β (P β Q) | iris-lean | src/Iris/BI/Plainly.lean | [
"import Iris.Algebra",
"import src.Iris.BI.DerivedLaws",
"import src/Iris/Instances/UPred/Instance.lean",
"import Iris.BI.DerivedLaws",
"import Iris.BI.BI",
"import src.Iris.BI.BI",
"import Iris.BI.Classes"
] | [
{
"name": "Lean.MonadQuotation",
"module": "Init.Prelude"
},
{
"name": "Lean.MonadRef",
"module": "Init.Prelude"
},
{
"name": "Monad",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option",
"module": "Init.Prelude"
},
... | [
{
"name": "syntax term:26 \" ==β \" term:25 : term",
"content": "syntax term:26 \" ==β \" term:25 : term\n\nsyntax term \"={ \" term \" , \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }[ \" term \" ]β·=β \" term : term\n\nsyntax term \"={ \" te... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "persistently_and_sep_assoc",
"content": "theorem persistently_and_sep_assoc [BI PROP] {P Q R : PROP} :\n <pers> P β§ (Q β R) β£β’ (<pers> P β§ Q) β R"
},
{
"name": "and_mono_l",
"content": "theorem and_mono_l [BI PROP] {P P' Q : PROP} (h : P β’ P') : P β§ Q β’ P' β§ Q"
},
{
"name":... | [
{
"name": "Iris.Plainly",
"content": "class Plainly (PROP : Type _) where\n plainly : PROP β PROP"
},
{
"name": "Iris.Plainly.plainlyIf",
"content": "def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=\n iprop(if p then β P else P)"
},
{
"name": "... | [
{
"name": "Iris.BI.persistently_elim_plainly",
"content": "theorem persistently_elim_plainly : <pers> β P β£β’ β P"
},
{
"name": "Iris.BI.plainly_forall_2",
"content": "theorem plainly_forall_2 {Ξ¨ : Ξ± β PROP} : (β a, β (Ξ¨ a)) β’ β (β a, Ξ¨ a)"
},
{
"name": "Iris.BI.plainly_and_sep_assoc",
... | import Iris.BI.Classes
import Iris.BI.BI
import Iris.BI.DerivedLaws
import Iris.Algebra
namespace Iris
open BI
class Plainly (PROP : Type _) where
plainly : PROP β PROP
def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=
iprop(if p then β P else P)
class BIPlainly (PRO... | theorem plainly_and_sep : β (P β§ Q) β’ β (P β Q) := | := by
refine (plainly_and.mp.trans <| (and_mono idem .rfl).trans plainly_and.mpr).trans ?_
refine (mono <| and_mono .rfl emp_sep.mpr).trans ?_
refine (mono <| plainly_and_sep_assoc.1).trans ?_
refine (mono <| sep_mono and_comm.mp .rfl).trans ?_
exact (mono <| sep_mono plainly_and_emp_elim .rfl).trans .rfl | 6 | 55 | false | Framework |
235 | Iris.BI.later_exists_false | theorem later_exists_false [BI PROP] {Ξ¦ : Ξ± β PROP} :
(β· β a, Ξ¦ a) β’ β· False β¨ β a, β· Ξ¦ a | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.or_intro_r'",
"content": "theorem or_intro_r' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β’ Q β¨ R"
},
{
"name": "Iris.BI.imp_intro'",
"content": "theorem imp_intro' [BI PROP] {P Q R : PROP} (h : Q β§ P β’ R) : P β’ Q β R"
},
{
"name": "Iris.BI.exists_intro",
"content": "... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem later_exists_false [BI PROP] {Ξ¦ : Ξ± β PROP} :
(β· β a, Ξ¦ a) β’ β· False β¨ β a, β· Ξ¦ a := | := by
apply later_sExists_false.trans
apply or_elim
Β· apply or_intro_l
Β· refine or_intro_r' <| exists_elim ?_
intro P
refine imp_elim <| pure_elim' ?_
rintro β¨a, rflβ©
exact imp_intro' <| exists_intro' a and_elim_l | 4 | 52 | false | Framework |
236 | Iris.DFrac.update_discard | theorem DFrac.update_discard {dq : DFrac F} : dq ~~> .discard | iris-lean | src/Iris/Algebra/DFrac.lean | [
"import Iris.Algebra.CMRA",
"import Iris.Algebra.Updates",
"import src.Iris.Algebra.Frac",
"import Iris.Algebra.OFE",
"import Iris.Algebra.LocalUpdates",
"import src.Iris.Algebra.CMRA",
"import Iris.Algebra.Frac"
] | [
{
"name": "Add",
"module": "Init.Prelude"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option.... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x",
"content": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x"
},
{
"name": "F... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Fractional.of_add_right",
"content": "theorem Fractional.of_add_right {a a' : Ξ±} (H : Fractional (a + a')) : Fractional a'"
},
{
"name": "valid_iff_validN'",
"content": "theorem valid_iff_validN' [Discrete Ξ±] (n) {x : Ξ±} : β x β β{n} x"
},
{
"name": "validN_of_le",
"conten... | [
{
"name": "Iris.DFrac",
"content": "inductive DFrac (F : Type _) where\n \n| own (f : F) : DFrac F\n \n| discard : DFrac F\n \n| ownDiscard (f : F) : DFrac F"
},
{
"name": "Iris.valid",
"content": "def valid : DFrac F β Prop\n | .own f => Proper f\n | .discard => True\n | .ownDisc... | [
{
"name": "Iris.valid_op_own",
"content": "theorem valid_op_own {dq : DFrac F} {q : F} : β dq β’ own q β Fractional q"
}
] | import Iris.Algebra.CMRA
import Iris.Algebra.OFE
import Iris.Algebra.Frac
import Iris.Algebra.Updates
import Iris.Algebra.LocalUpdates
namespace Iris
inductive DFrac (F : Type _) where
| own (f : F) : DFrac F
| discard : DFrac F
| ownDiscard (f : F) : DFrac F
section dfrac
open DFrac Fraction OFE.Discrete... | theorem DFrac.update_discard {dq : DFrac F} : dq ~~> .discard := | := by
intros n q H
apply (CMRA.valid_iff_validN' n).mp
have H' := (CMRA.valid_iff_validN' n).mpr H
simp [CMRA.op?] at H' β’
rcases q with (_|β¨q|_|qβ©) <;> simp [CMRA.Valid, valid, CMRA.op, op]
Β· cases dq <;> first | exact valid_op_own H | exact H
Β· cases dq <;> first | exact Fractional.of_add_right H | exac... | 3 | 31 | false | Framework |
237 | Iris.local_update_unital_discrete | theorem local_update_unital_discrete [CMRA.Discrete Ξ±] (x y x' y' : Ξ±) :
(x, y) ~l~> (x', y') β β z, β x β x β‘ y β’ z β (β x' β§ x' β‘ y' β’ z) | iris-lean | src/Iris/Algebra/LocalUpdates.lean | [
"import Iris.Algebra.CMRA",
"import src.Iris.Algebra.CMRA",
"import src.Iris.Algebra.OFE"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x",
"content": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x"
},
{
"name": "n... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "Included.trans",
"content": "theorem Included.trans : (x : Ξ±) βΌ y β y βΌ z β x βΌ z"
},
{
"name": "inc_trans",
"content": "theorem inc_trans {x y z : Ξ±} : x βΌ y... | [
{
"name": "Iris.LocalUpdate",
"content": "def LocalUpdate [CMRA Ξ±] (x y : Ξ± Γ Ξ±) : Prop :=\n βn mz, β{n} x.1 β x.1 β‘{n}β‘ x.2 β’? mz β β{n} y.1 β§ y.1 β‘{n}β‘ y.2 β’? mz"
}
] | [
{
"name": "Iris.local_update_unital",
"content": "theorem local_update_unital {x y x' y' : Ξ±} :\n (x, y) ~l~> (x', y') β β n z, β{n} x β x β‘{n}β‘ y β’ z β (β{n} x' β§ x' β‘{n}β‘ y' β’ z)"
}
] | import Iris.Algebra.CMRA
namespace Iris
def LocalUpdate [CMRA Ξ±] (x y : Ξ± Γ Ξ±) : Prop :=
βn mz, β{n} x.1 β x.1 β‘{n}β‘ x.2 β’? mz β β{n} y.1 β§ y.1 β‘{n}β‘ y.2 β’? mz
infixr:50 " ~l~> " => LocalUpdate
section localUpdate
section CMRA
variable [CMRA Ξ±]
end CMRA
section UCMRA
variable [UCMRA Ξ±] | theorem local_update_unital_discrete [CMRA.Discrete Ξ±] (x y x' y' : Ξ±) :
(x, y) ~l~> (x', y') β β z, β x β x β‘ y β’ z β (β x' β§ x' β‘ y' β’ z) := | where
mp h z vx e :=
have β¨vx', e'β© := h 0 (some z) (CMRA.Valid.validN vx) e.dist
β¨CMRA.discrete_valid vx', OFE.discrete_0 e'β©
mpr h := by
refine local_update_unital.mpr fun n z vnx e => ?_
have β¨vx', e'β© := h z ((CMRA.valid_iff_validN' n).mpr vnx) (OFE.discrete e)
exact β¨vx'.validN, e'.distβ© | 5 | 51 | false | Framework |
238 | Iris.BI.persistently_and_sep_assoc | theorem persistently_and_sep_assoc [BI PROP] {P Q R : PROP} :
<pers> P β§ (Q β R) β£β’ (<pers> P β§ Q) β R | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_elim_l'",
"content": "theorem and_elim_l' [BI PROP] {P Q R : PROP} (h : P β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_elim_r'",
"content": "theorem and_elim_r' [BI PROP] {P Q R : PROP} (h : Q β’ R) : P β§ Q β’ R"
},
{
"name": "Iris.BI.and_mono",
"content": "@[rw_m... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem persistently_and_sep_assoc [BI PROP] {P Q R : PROP} :
<pers> P β§ (Q β R) β£β’ (<pers> P β§ Q) β R := | := by
constructor
Β· refine (and_mono_l persistently_idem_2).trans <| persistently_and_affinely_sep.trans <|
sep_assoc.2.trans <| sep_mono_l <| and_intro ?_ ?_
Β· exact (sep_mono_l and_elim_r).trans persistently_absorb_l
Β· exact (sep_mono_l and_elim_l).trans emp_sep.1
Β· exact and_intro ((sep_mono_l an... | 4 | 56 | false | Framework |
239 | Iris.UpdateP.iso | theorem UpdateP.iso
(gf : β x, g (f x) β‘ x)
(g_op : β y1 y2, g (y1 β’ y2) β‘ g y1 β’ g y2)
(g_validN : β n y, β{n} (g y) β β{n} y)
(uyp : y ~~>: P)
(pq : β y', P y' β Q (g y')) :
g y ~~>: Q | iris-lean | src/Iris/Algebra/Updates.lean | [
"import Iris.Algebra.CMRA",
"import src.Iris.Algebra.CMRA",
"import src.Iris.Algebra.OFE"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x",
"content": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x"
},
{
"name": "C... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "op_right_eqv",
"content": "theorem op_right_eqv (x : Ξ±) {y z : Ξ±} (e : y β‘ z) : x β’ y β‘ x β’ z"
},
{
"name": "Equiv.rfl",
"content": "@[simp, refl] theorem Equiv.rfl [OFE Ξ±] {x : Ξ±} : x β‘ x"
},
{
"name": "equiv_eqv",
"content": "theorem equiv_eqv [ofe : OFE Ξ±] : Equivalence... | [
{
"name": "Iris.UpdateP",
"content": "def UpdateP [CMRA Ξ±] (x : Ξ±) (P : Ξ± β Prop) := β n mz,\n β{n} (x β’? mz) β β y, P y β§ β{n} (y β’? mz)"
},
{
"name": "Iris.Update",
"content": "def Update [CMRA Ξ±] (x y : Ξ±) := β n mz,\n β{n} (x β’? mz) β β{n} (y β’? mz)"
}
] | [] | import Iris.Algebra.CMRA
namespace Iris
def UpdateP [CMRA Ξ±] (x : Ξ±) (P : Ξ± β Prop) := β n mz,
β{n} (x β’? mz) β β y, P y β§ β{n} (y β’? mz)
infixr:50 " ~~>: " => UpdateP
def Update [CMRA Ξ±] (x y : Ξ±) := β n mz,
β{n} (x β’? mz) β β{n} (y β’? mz)
infixr:50 " ~~> " => Update
section updates
variable [CMRA Ξ±] [CMRA ... | theorem UpdateP.iso
(gf : β x, g (f x) β‘ x)
(g_op : β y1 y2, g (y1 β’ y2) β‘ g y1 β’ g y2)
(g_validN : β n y, β{n} (g y) β β{n} y)
(uyp : y ~~>: P)
(pq : β y', P y' β Q (g y')) :
g y ~~>: Q := | := by
intro n mz v
have : β{n} y β’? Option.map f mz :=
match mz with
| none => (g_validN n _).mp v
| some z =>
have : g y β’ z β‘ g (y β’ f z) :=
(CMRA.op_right_eqv _ (gf z).symm).trans (g_op y (f z)).symm
(g_validN n _).mp (CMRA.validN_ne this.dist v)
have β¨x, px, vxβ© := uyp n (mz.ma... | 4 | 31 | false | Framework |
240 | Iris.OFE.equiv_eqv | theorem equiv_eqv [ofe : OFE Ξ±] : Equivalence ofe.Equiv | iris-lean | src/Iris/Algebra/OFE.lean | [
"import src/Iris/Algebra/CMRA.lean",
"import src/Iris/Instances/UPred/Instance.lean",
"import src/Iris/Algebra/Agree_task.lean",
"import src/Iris/Algebra/COFESolver.lean",
"import src/Iris/Algebra/Heap.lean"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Dist",
"module": "Mathlib.Topology.MetricSp... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y",
"content": "notation:50 x \" βΌ{\" n \"} \" y:51 => IncludedN n x y"
},
... | [
{
"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": "Iris.OFE",
"content": "class OFE (Ξ± : Type _) where\n Equiv : Ξ± β Ξ± β Prop\n Dist : Nat β Ξ± β Ξ± β Prop\n dist_eqv : Equivalence (Dist n)\n equiv_dist : Equiv x y β β n, Dist n x y\n dist_lt : Dist n x y β m < n β Dist m x y"
}
] | [
{
"name": "Iris.OFE.Dist.rfl",
"content": "@[simp, refl] theorem Dist.rfl [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ x"
},
{
"name": "Iris.OFE.Dist.symm",
"content": "@[symm] theorem Dist.symm [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ x"
},
{
"name": "Iris.OFE.Dist.trans",
"content": "theorem Dis... | namespace Iris
class OFE (Ξ± : Type _) where
Equiv : Ξ± β Ξ± β Prop
Dist : Nat β Ξ± β Ξ± β Prop
dist_eqv : Equivalence (Dist n)
equiv_dist : Equiv x y β β n, Dist n x y
dist_lt : Dist n x y β m < n β Dist m x y
open OFE
scoped infix:40 " β‘ " => OFE.Equiv
scoped notation:40 x " β‘{" n "}β‘ " y:41 => OFE.Dist n x ... | theorem equiv_eqv [ofe : OFE Ξ±] : Equivalence ofe.Equiv := | := by
constructor
Β· rintro x; rw [ofe.equiv_dist]; rintro n; exact Dist.rfl
Β· rintro x y; simp [ofe.equiv_dist]; rintro h n; exact Dist.symm (h n)
Β· rintro x y z; simp [ofe.equiv_dist]; rintro hβ hβ n; exact Dist.trans (hβ n) (hβ n) | 3 | 14 | false | Framework |
241 | Iris.BI.plainly_sep | theorem plainly_sep [BIPositive PROP] : β (P β Q) β£β’ β P β β Q | iris-lean | src/Iris/BI/Plainly.lean | [
"import Iris.Algebra",
"import src.Iris.BI.DerivedLaws",
"import src/Iris/Instances/UPred/Instance.lean",
"import Iris.BI.DerivedLaws",
"import Iris.BI.BI",
"import src.Iris.BI.BI",
"import Iris.BI.Classes"
] | [
{
"name": "Lean.MonadQuotation",
"module": "Init.Prelude"
},
{
"name": "Lean.MonadRef",
"module": "Init.Prelude"
},
{
"name": "Monad",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option",
"module": "Init.Prelude"
},
... | [
{
"name": "syntax term:26 \" ==β \" term:25 : term",
"content": "syntax term:26 \" ==β \" term:25 : term\n\nsyntax term \"={ \" term \" , \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }[ \" term \" ]β·=β \" term : term\n\nsyntax term \"={ \" te... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "persistently_and_sep_assoc",
"content": "theorem persistently_and_sep_assoc [BI PROP] {P Q R : PROP} :\n <pers> P β§ (Q β R) β£β’ (<pers> P β§ Q) β R"
},
{
"name": "and_mono_l",
"content": "theorem and_mono_l [BI PROP] {P P' Q : PROP} (h : P β’ P') : P β§ Q β’ P' β§ Q"
},
{
"name":... | [
{
"name": "Iris.Plainly",
"content": "class Plainly (PROP : Type _) where\n plainly : PROP β PROP"
},
{
"name": "Iris.Plainly.plainlyIf",
"content": "def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=\n iprop(if p then β P else P)"
},
{
"name": "... | [
{
"name": "Iris.BI.persistently_elim_plainly",
"content": "theorem persistently_elim_plainly : <pers> β P β£β’ β P"
},
{
"name": "Iris.BI.plainly_forall_2",
"content": "theorem plainly_forall_2 {Ξ¨ : Ξ± β PROP} : (β a, β (Ξ¨ a)) β’ β (β a, Ξ¨ a)"
},
{
"name": "Iris.BI.plainly_and_sep_assoc",
... | import Iris.BI.Classes
import Iris.BI.BI
import Iris.BI.DerivedLaws
import Iris.Algebra
namespace Iris
open BI
class Plainly (PROP : Type _) where
plainly : PROP β PROP
def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=
iprop(if p then β P else P)
class BIPlainly (PRO... | theorem plainly_sep [BIPositive PROP] : β (P β Q) β£β’ β P β β Q := | := by
refine β¨?_, plainly_sep_2β©
refine plainly_affinely_elim.mpr.trans ?_
refine (mono <| affinely_sep.mp).trans ?_
refine .trans ?_ and_sep_plainly.mp
refine and_intro (mono ?_) (mono ?_)
Β· exact ((sep_mono .rfl affinely_elim_emp).trans sep_emp.mp).trans affinely_elim
Β· exact ((sep_mono affinely_elim_em... | 7 | 72 | false | Framework |
242 | Iris.Agree.toAgree_uninj | theorem Agree.toAgree_uninj {x : Agree Ξ±} : β x β β a, toAgree a β‘ x | iris-lean | src/Iris/Algebra/Agree.lean | [
"import Iris.Algebra.CMRA",
"import src.Iris.Algebra.CMRA",
"import src.Iris.Algebra.OFE",
"import Iris.Algebra.OFE"
] | [
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"na... | [
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y"
},
{
"name": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x",
"content": "notation:50 \"β{\" n \"} \" x:51 => ValidN n x"
},
{
"name": "n... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "_root_.Iris.OFE.Dist.validN",
"content": "theorem _root_.Iris.OFE.Dist.validN : (x : Ξ±) β‘{n}β‘ y β (β{n} x β β{n} y)"
},
{
"name": "validN_iff",
"content": "theorem validN_iff {x y : Ξ±} (e : x β‘{n}β‘ y) : β{n} x β β{n} y"
},
{
"name": "IncludedN.validN",
"content": "theorem ... | [
{
"name": "Iris.Agree",
"content": "@[ext]\nstructure Agree where\n car : List Ξ±\n not_nil : car β []"
},
{
"name": "Iris.toAgree",
"content": "def toAgree (a : Ξ±) : Agree Ξ± := β¨[a], by admit /- proof elided -/\nβ©"
},
{
"name": "Iris.Agree.dist",
"content": "def Agree.dist (n : Nat... | [
{
"name": "Iris.mem_of_agree",
"content": "theorem mem_of_agree (x : Agree Ξ±) : β a, a β x.car"
},
{
"name": "Iris.Agree.equiv_def",
"content": "theorem Agree.equiv_def {x y : Agree Ξ±} : x β‘ y β β n, Agree.dist n x y"
},
{
"name": "Iris.Agree.validN_iff",
"content": "theorem Agree.va... | import Iris.Algebra.CMRA
import Iris.Algebra.OFE
namespace Iris
section agree
variable {Ξ± : Type u}
variable (Ξ±) in
@[ext]
structure Agree where
car : List Ξ±
not_nil : car β []
def toAgree (a : Ξ±) : Agree Ξ± := β¨[a], by admit /- proof elided -/
β©
variable [OFE Ξ±]
def Agree.dist (n : Nat) (x y : Agree Ξ±) : P... | theorem Agree.toAgree_uninj {x : Agree Ξ±} : β x β β a, toAgree a β‘ x := | := by
simp only [valid_def, valid, validN_iff, equiv_def]
obtain β¨a, haβ© := mem_of_agree x
intro h; exists a; intro n
constructor <;> intros
Β· exists a; simp_all [toAgree]
Β· simp_all [toAgree] | 7 | 53 | false | Framework |
243 | Iris.BI.plainly_sep_dup | theorem plainly_sep_dup : β P β£β’ β P β β P | iris-lean | src/Iris/BI/Plainly.lean | [
"import Iris.Algebra",
"import Iris.BI.DerivedLaws",
"import src.Iris.Algebra.CMRA",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import src.Iris.BI.DerivedLaws",
"import src/Iris/Instances/UPred/Instance.lean",
"import Iris.BI.BI",
"import Iris.BI.Classes"
] | [
{
"name": "Lean.MonadQuotation",
"module": "Init.Prelude"
},
{
"name": "Lean.MonadRef",
"module": "Init.Prelude"
},
{
"name": "Monad",
"module": "Init.Prelude"
},
{
"name": "m",
"module": "QqTest.matching"
},
{
"name": "Option",
"module": "Init.Prelude"
},
... | [
{
"name": "syntax term:26 \" ==β \" term:25 : term",
"content": "syntax term:26 \" ==β \" term:25 : term\n\nsyntax term \"={ \" term \" , \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }=β \" term : term\n\nsyntax term \"={ \" term \" }[ \" term \" ]β·=β \" term : term\n\nsyntax term \"={ \" te... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "persistently_and_sep_assoc",
"content": "theorem persistently_and_sep_assoc [BI PROP] {P Q R : PROP} :\n <pers> P β§ (Q β R) β£β’ (<pers> P β§ Q) β R"
},
{
"name": "and_mono_l",
"content": "theorem and_mono_l [BI PROP] {P P' Q : PROP} (h : P β’ P') : P β§ Q β’ P' β§ Q"
},
{
"name":... | [
{
"name": "Iris.Plainly",
"content": "class Plainly (PROP : Type _) where\n plainly : PROP β PROP"
},
{
"name": "Iris.Plainly.plainlyIf",
"content": "def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=\n iprop(if p then β P else P)"
},
{
"name": "... | [
{
"name": "Iris.BI.persistently_elim_plainly",
"content": "theorem persistently_elim_plainly : <pers> β P β£β’ β P"
},
{
"name": "Iris.BI.plainly_and_sep_assoc",
"content": "theorem plainly_and_sep_assoc : β P β§ (Q β R) β£β’ (β P β§ Q) β R"
}
] | import Iris.BI.Classes
import Iris.BI.BI
import Iris.BI.DerivedLaws
import Iris.Algebra
namespace Iris
open BI
class Plainly (PROP : Type _) where
plainly : PROP β PROP
def Plainly.plainlyIf [Iris.BI.BIBase PROP] [Plainly PROP] (p : Bool) (P : PROP) : PROP :=
iprop(if p then β P else P)
class BIPlainly (PRO... | theorem plainly_sep_dup : β P β£β’ β P β β P := | := by
refine β¨?_, plainly_absorbβ©
refine and_self.2.trans ?_
refine ((and_mono .rfl emp_sep.2).trans plainly_and_sep_assoc.1).trans ?_
exact (sep_mono and_elim_l .rfl).trans .rfl | 6 | 72 | false | Framework |
244 | Iris.BI.later_and | theorem later_and [BI PROP] {P Q : PROP} : β· (P β§ Q) β£β’ β· P β§ β· Q | iris-lean | src/Iris/BI/DerivedLaws.lean | [
"import Iris.BI.Extensions",
"import Iris.Std.TC",
"import Iris.Std.Classes",
"import Iris.BI.BI",
"import src.Iris.Algebra.OFE",
"import src.Iris.BI.BI",
"import Iris.BI.Classes",
"import Iris.Std.Rewrite"
] | [
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.merge",
"module": "Init.Data.Option.Basic"
},
{
"name": "id",
"module": "Init.Prelude"
},
{
"name": "Equivalence",
"module": "Init.Core"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
... | [
{
"name": "macro \"β\" xs:explicitBinders \", \" b:term : term => do",
"content": "macro \"β\" xs:explicitBinders \", \" b:term : term => do\n return β¨β expandExplicitBinders ``BIBase.exists xs bβ©"
},
{
"name": "scoped notation:40 x \" β‘{\" n \"}β‘ \" y:41 => OFE.Dist n x y",
"content": "scoped ... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Dist.trans",
"content": "theorem Dist.trans [OFE Ξ±] {n} {x : Ξ±} : x β‘{n}β‘ y β y β‘{n}β‘ z β x β‘{n}β‘ z"
},
{
"name": "BIBase.BiEntails.trans",
"content": "theorem BIBase.BiEntails.trans [BI PROP] {P Q R : PROP} (h1 : P β£β’ Q) (h2 : Q β£β’ R) : P β£β’ R"
},
{
"name": "BIBase.Entails.tr... | [] | [
{
"name": "Iris.BI.and_symm",
"content": "theorem and_symm [BI PROP] {P Q : PROP} : P β§ Q β’ Q β§ P"
},
{
"name": "Iris.BI.imp_intro'",
"content": "theorem imp_intro' [BI PROP] {P Q R : PROP} (h : Q β§ P β’ R) : P β’ Q β R"
},
{
"name": "Iris.BI.imp_elim'",
"content": "theorem imp_elim' [... | import Iris.BI.Classes
import Iris.BI.Extensions
import Iris.BI.BI
import Iris.Std.Classes
import Iris.Std.Rewrite
import Iris.Std.TC
namespace Iris.BI
open Iris.Std BI | theorem later_and [BI PROP] {P Q : PROP} : β· (P β§ Q) β£β’ β· P β§ β· Q := | := by
constructor
Β· refine (later_mono and_forall_bool.mp).trans ?_
refine .trans ?_ and_forall_bool.mpr
refine (later_forall).mp.trans (forall_mono ?_)
exact (Β·.casesOn .rfl .rfl)
Β· refine .trans ?_ (later_mono and_forall_bool.mpr)
refine and_forall_bool.mp.trans ?_
refine .trans (forall_mono... | 6 | 59 | false | Framework |
245 | Juvix.Core.Main.Value.Approx.Indexed.preserved_step | lemma Value.Approx.Indexed.preserved_step {k} :
(β k' < k, Preservation k') β Preservation k | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v",
"content": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v"
},
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env e",
"content": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env ... | [
{
"name": "List.Forallβ.get",
"module": "Mathlib.Data.List.Forall2"
},
{
"name": "List.Forallβ.length_eq",
"module": "Mathlib.Data.List.Forall2"
},
{
"name": "List.getElem?_eq_some_iff",
"module": "Init.Data.List.Lemmas"
},
{
"name": "List.get_eq_getElem",
"module": "Init... | [
{
"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": "Juvix.Core.Main.Value.Approx.Indexed",
"content": "def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=\n (vβ = Value.unit β§ vβ = Value.unit) β¨\n (β c, vβ = Value.const c β§ vβ = Value.const c) β¨\n (β ctr_name args_rev args_rev',\n vβ = Value.constr_app ctr_name args_rev β§\n vβ = ... | [
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.get",
"content": "lemma Env.Approx.Indexed'.get {n i : Nat} {env env' oβ}\n (hβ : env β²β'(n) env')\n (hβ : env[i]? = some oβ) :\n β oβ, env'[i]? = some oβ β§ oβ β²β'(n) oβ"
},
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.value",
"content": "lemma... | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=
(vβ = Value.unit β§ vβ = Value.unit) β¨
(β c... | lemma Value.Approx.Indexed.preserved_step {k} :
(β k' < k, Preservation k') β Preservation k := | := by
intro ihk
intro m n env env' e v hβ hβ hβ
induction hβ generalizing m env'
case var env i v h =>
obtain β¨v', hget, happroxβ© := Env.Approx.Indexed'.value hβ h
exists v'
constructor
Β· apply Eval.var
aesop
Β· apply Value.Approx.Indexed.anti_monotone
Β· assumption
Β· linarit... | 4 | 68 | true | Semantics |
246 | Juvix.Core.Main.Value.Approx.Indexed.refl | @[refl]
lemma Value.Approx.Indexed.refl {n} v : v β²α΅₯(n) v | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v",
"content": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v"
},
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env e",
"content": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env ... | [
{
"name": "and_self",
"module": "Init.SimpLemmas"
},
{
"name": "exists_and_left",
"module": "Init.PropLemmas"
},
{
"name": "exists_const",
"module": "Init.PropLemmas"
},
{
"name": "exists_eq_left'",
"module": "Init.PropLemmas"
},
{
"name": "false_and",
"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": "Juvix.Core.Main.Value.Approx.Indexed",
"content": "def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=\n (vβ = Value.unit β§ vβ = Value.unit) β¨\n (β c, vβ = Value.const c β§ vβ = Value.const c) β¨\n (β ctr_name args_rev args_rev',\n vβ = Value.constr_app ctr_name args_rev β§\n vβ = ... | [
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.get",
"content": "lemma Env.Approx.Indexed'.get {n i : Nat} {env env' oβ}\n (hβ : env β²β'(n) env')\n (hβ : env[i]? = some oβ) :\n β oβ, env'[i]? = some oβ β§ oβ β²β'(n) oβ"
},
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.value",
"content": "lemma... | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=
(vβ = Value.unit β§ vβ = Value.unit) β¨
(β c... | @[refl]
lemma Value.Approx.Indexed.refl {n} v : v β²α΅₯(n) v := | := by
revert n
suffices β n, β k β€ n, v β²α΅₯(k) v by
intro k
exact this k k k.le_refl
intro n
induction n generalizing v with
| zero =>
intros k hk
cases v
case unit =>
exact Value.Approx.Indexed.unit
case const c =>
exact Value.Approx.Indexed.const
case constr_app ctr_na... | 7 | 80 | true | Semantics |
247 | Juvix.Core.Main.Eval.toIndexed | lemma Eval.toIndexed {env e v} (h : env β’ e β¦ v) : β n, env β’ e β¦(n) v | juvix-lean | Juvix/Core/Main/Semantics/Eval/Indexed.lean | [
"import Mathlib.Tactic.Linarith",
"import Juvix.Core.Main.Semantics.Eval"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "syntax:100 expr:100 ppSpace expr:101 : expr",
"content": "syntax:100 expr:100 ppSpace expr:101 : expr\n\nsyntax:50 expr:50 \" + \" expr:51 : expr\n\nsyntax:50 expr:50 \" - \" expr:50 : expr\n\nsyntax:60 expr:60 \" * \" expr:61 : expr\n\nsyntax:60 expr:60 \" / \" expr:60 : expr\n\nsyntax \"case \"... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Termination.var",
"content": "lemma Termination.var {env name i v} :\n env[i]? = some (Object.value v) β\n env β’ Expr.var name i β"
},
{
"name": "Termination.var_rec",
"content": "lemma Termination.var_rec {env name i env' e} :\n env[i]? = some (Object.delayed env' e) β\n env'... | [
{
"name": "Juvix.Core.Main.Eval.Indexed",
"content": "inductive Eval.Indexed : Nat β Env β Expr β Value β Prop where\n | var {n env name idx val} :\n env[idx]? = some (Object.value val) β\n Eval.Indexed n env (Expr.var name idx) val\n | var_rec {n env name idx env' expr val} :\n env[idx]? = some ... | [
{
"name": "Juvix.Core.Main.Eval.Indexed.monotone",
"content": "lemma Eval.Indexed.monotone {n n' env e v} (h : env β’ e β¦(n) v) (h' : n β€ n') : env β’ e β¦(n') v"
}
] | import Juvix.Core.Main.Semantics.Eval
import Mathlib.Tactic.Linarith
namespace Juvix.Core.Main
inductive Eval.Indexed : Nat β Env β Expr β Value β Prop where
| var {n env name idx val} :
env[idx]? = some (Object.value val) β
Eval.Indexed n env (Expr.var name idx) val
| var_rec {n env name idx env' expr v... | lemma Eval.toIndexed {env e v} (h : env β’ e β¦ v) : β n, env β’ e β¦(n) v := | := by
induction h
case var =>
exists 0; apply Eval.Indexed.var; assumption
case var_rec ih =>
obtain β¨n, ihβ© := ih
exists n
apply Eval.Indexed.var_rec <;> assumption
case unit =>
exists 0; apply Eval.Indexed.unit
case const =>
exists 0; apply Eval.Indexed.const
case constr =>
exi... | 3 | 24 | true | Semantics |
248 | Juvix.Core.Main.Termination.recur | lemma Termination.recur {env name e} :
Object.delayed env (Expr.recur name e) :: env β’ e β β
env β’ Expr.recur name e β | juvix-lean | Juvix/Core/Main/Tactics/Termination.lean | [
"import Juvix.Core.Main.Tactics.Base"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "syntax:100 expr:100 ppSpace expr:101 : expr",
"content": "syntax:100 expr:100 ppSpace expr:101 : expr\n\nsyntax:50 expr:50 \" + \" expr:51 : expr\n\nsyntax:50 expr:50 \" - \" expr:50 : expr\n\nsyntax:60 expr:60 \" * \" expr:61 : expr\n\nsyntax:60 expr:60 \" / \" expr:60 : expr"
},
{
"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]"
}
] | [] | [] | import Juvix.Core.Main.Tactics.Base
namespace Juvix.Core.Main | lemma Termination.recur {env name e} :
Object.delayed env (Expr.recur name e) :: env β’ e β β
env β’ Expr.recur name e β := | := by
unfold Eval.Defined
intro h
obtain β¨w, hβ© := h
exists w
Β· apply Juvix.Core.Main.Eval.recur
exact h | 4 | 19 | false | Semantics |
249 | Juvix.Core.Main.Value.Approx.Indexed.trans | @[trans]
lemma Value.Approx.Indexed.trans {n vβ vβ vβ} : vβ β²α΅₯(n) vβ β vβ β²α΅₯ vβ β vβ β²α΅₯(n) vβ | juvix-lean | Juvix/Core/Main/Semantics/Approx.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed",
"import Juvix.Utils"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Inde",
"content": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Indexed n v v'"
},
{
"name": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v v'",
"content": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v... | [
{
"name": "IsEmpty.forall_iff",
"module": "Mathlib.Logic.IsEmpty"
},
{
"name": "implies_true",
"module": "Init.SimpLemmas"
},
{
"name": "nonpos_iff_eq_zero",
"module": "Mathlib.Algebra.Order.Monoid.Canonical.Defs"
},
{
"name": "not_lt_zero'",
"module": "Mathlib.Algebra.Or... | [
{
"name": "Value.Approx.Indexed.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.Indexed.invert {n v v'} :\n v β²α΅₯(n) v' β\n Value.Approx.Indexed.Inversion n v v'"
},
{
"name": "Value.Approx.Indexed.constr_app",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.cons... | [
{
"name": "Juvix.Core.Main.Value.Approx",
"content": "def Value.Approx (v v' : Value) : Prop :=\n β n, v β²α΅₯(n) v'"
},
{
"name": "Juvix.Core.Main.Value.Approx.Inversion",
"content": "@[aesop safe cases]\ninductive Value.Approx.Inversion : Value -> Value -> Prop where\n | unit : Value.Approx.Inv... | [
{
"name": "Juvix.Core.Main.Value.Approx.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.invert {v v'} :\n v β²α΅₯ v' β\n Value.Approx.Inversion v v'"
}
] | import Juvix.Core.Main.Semantics.Approx.Indexed
namespace Juvix.Core.Main
def Value.Approx (v v' : Value) : Prop :=
β n, v β²α΅₯(n) v'
notation:40 v:40 " β²α΅₯ " v':40 => Value.Approx v v'
notation:40 argsβ:40 " β²β " argsβ:40 => List.Forallβ Value.Approx argsβ argsβ
notation:40 e:40 " β²β¨" env:40 ", " env':40 "β© " e':4... | @[trans]
lemma Value.Approx.Indexed.trans {n vβ vβ vβ} : vβ β²α΅₯(n) vβ β vβ β²α΅₯ vβ β vβ β²α΅₯(n) vβ := | := by
revert n
suffices β n, β k β€ n, vβ β²α΅₯(k) vβ β vβ β²α΅₯ vβ β vβ β²α΅₯(k) vβ by
intro k
exact this k k k.le_refl
intros n
induction n generalizing vβ vβ vβ with
| zero =>
intros k hk hβ hβ
invert hβ
case unit =>
invert hβ
case unit =>
exact Value.Approx.Indexed.unit
c... | 3 | 33 | true | Semantics |
250 | Juvix.Core.Main.Value.Approx.Indexed.anti_monotone | lemma Value.Approx.Indexed.anti_monotone {n n' vβ vβ} (h : vβ β²α΅₯(n) vβ) (h' : n' β€ n) : vβ β²α΅₯(n') vβ | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v",
"content": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v"
},
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env e",
"content": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env ... | [
{
"name": "and_self",
"module": "Init.SimpLemmas"
},
{
"name": "exists_and_left",
"module": "Init.PropLemmas"
},
{
"name": "exists_const",
"module": "Init.PropLemmas"
},
{
"name": "exists_eq_left'",
"module": "Init.PropLemmas"
},
{
"name": "false_and",
"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": "Juvix.Core.Main.Value.Approx.Indexed",
"content": "def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=\n (vβ = Value.unit β§ vβ = Value.unit) β¨\n (β c, vβ = Value.const c β§ vβ = Value.const c) β¨\n (β ctr_name args_rev args_rev',\n vβ = Value.constr_app ctr_name args_rev β§\n vβ = ... | [
{
"name": "Juvix.Core.Main.Value.Approx.Indexed.unit",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.unit {n} : Value.unit β²α΅₯(n) Value.unit"
},
{
"name": "Juvix.Core.Main.Value.Approx.Indexed.const",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.const {n c} : Valu... | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=
(vβ = Value.unit β§ vβ = Value.unit) β¨
(β c... | lemma Value.Approx.Indexed.anti_monotone {n n' vβ vβ} (h : vβ β²α΅₯(n) vβ) (h' : n' β€ n) : vβ β²α΅₯(n') vβ := | := by
revert n n'
suffices β n, vβ β²α΅₯(n) vβ β β k β€ n, vβ β²α΅₯(k) vβ by
intro n n' h hn
exact this n h n' hn
intro n
induction n generalizing vβ vβ with
| zero =>
intros h k hk
invert h
case unit =>
exact Value.Approx.Indexed.unit
case const =>
exact Value.Approx.Indexed.cons... | 3 | 34 | true | Semantics |
251 | Juvix.Core.Main.Expr.Approx.Context.preserved | lemma Expr.Approx.Context.preserved (eβ eβ : Expr) :
eβ β² eβ β
β (C : Context) envβ envβ vβ,
envβ β²β envβ β envβ β’ C.subst eβ β¦ vβ β
β vβ, envβ β’ C.subst eβ β¦ vβ β§ vβ β²α΅₯ vβ | juvix-lean | Juvix/Core/Main/Semantics/Approx/Soundness.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed",
"import Juvix.Core.Main.Semantics.Approx",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Juvix.Core.Main.Semantics.Approx.Contextual",
"import Juvix.Core.Main.Semantics.Eval"
] | [
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
},
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
... | [
{
"name": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Exp",
"content": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param env env' e e'"
},
{
"name": "notation:40 eβ:40 \" β² \" eβ:40 => Expr.Approx eβ eβ",
"content": "notation:40 eβ:40 \" β² \" e... | [
{
"name": "List.forallβ_cons",
"module": "Batteries.Data.List.Basic"
},
{
"name": "List.forallβ_same",
"module": "Mathlib.Data.List.Forall2"
}
] | [
{
"name": "Expr.Approx.toIndexed",
"content": "lemma Expr.Approx.toIndexed {eβ eβ} : eβ β² eβ β β n, eβ β²'(n) eβ"
},
{
"name": "Value.Approx.Indexed.trans",
"content": "@[trans]\nlemma Value.Approx.Indexed.trans {n vβ vβ vβ} : vβ β²α΅₯(n) vβ β vβ β²α΅₯ vβ β vβ β²α΅₯(n) vβ"
},
{
"name": "Value.Appr... | [
{
"name": "Juvix.Core.Main.Context.Indexed.Preserved",
"content": "def Context.Indexed.Preserved (k : Nat) : Prop :=\n β n m,\n n + m < k β\n β eβ eβ,\n eβ β²'(n + m) eβ β β (C : Context) envβ envβ vβ,\n envβ β²β'(n + m) envβ β\n envβ β’ C.subst eβ β¦(n) vβ β\n β vβ, envβ β’ C.subst eβ... | [
{
"name": "Juvix.Core.Main.Expr.Approx.Context.Indexed.preserved_step",
"content": "lemma Expr.Approx.Context.Indexed.preserved_step (k : Nat) :\n Context.Indexed.Preserved k β Context.Indexed.Preserved (k + 1)"
},
{
"name": "Juvix.Core.Main.Expr.Approx.Context.Indexed.preserved",
"content": "l... | import Juvix.Core.Main.Semantics.Approx
import Juvix.Core.Main.Semantics.Approx.Contextual
namespace Juvix.Core.Main
def Context.Indexed.Preserved (k : Nat) : Prop :=
β n m,
n + m < k β
β eβ eβ,
eβ β²'(n + m) eβ β β (C : Context) envβ envβ vβ,
envβ β²β'(n + m) envβ β
envβ β’ C.subst eβ β¦(n) ... | lemma Expr.Approx.Context.preserved (eβ eβ : Expr) :
eβ β² eβ β
β (C : Context) envβ envβ vβ,
envβ β²β envβ β envβ β’ C.subst eβ β¦ vβ β
β vβ, envβ β’ C.subst eβ β¦ vβ β§ vβ β²α΅₯ vβ := | := by
intro happrox C envβ envβ vβ henv heval
obtain β¨n, heval'β© := Eval.toIndexed heval
have happrox' : eβ β²'(n + 0) eβ := by apply Expr.Approx.toIndexed happrox
have henv' : envβ β²β'(n + 0) envβ := by apply Env.Approx.toIndexed henv
obtain β¨vβ, hevalβ, happroxββ© := Expr.Approx.Context.Indexed.preserved (n +... | 5 | 84 | false | Semantics |
252 | Juvix.Core.Main.Value.Approx.closure | @[aesop unsafe apply]
lemma Value.Approx.closure {envβ bodyβ envβ bodyβ} :
(β aβ aβ,
aβ β²α΅₯ aβ β
bodyβ β²β¨aβ β· envβ, aβ β· envββ© bodyβ) β
Value.closure envβ bodyβ β²α΅₯ Value.closure envβ bodyβ | juvix-lean | Juvix/Core/Main/Semantics/Approx.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed",
"import Juvix.Utils"
] | [
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
... | [
{
"name": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Exp",
"content": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param env env' e e'"
},
{
"name": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v v'",
"content": "notation:40 v:40 \" β²α΅₯ \" v... | [
{
"name": "IsEmpty.forall_iff",
"module": "Mathlib.Logic.IsEmpty"
},
{
"name": "implies_true",
"module": "Init.SimpLemmas"
},
{
"name": "nonpos_iff_eq_zero",
"module": "Mathlib.Algebra.Order.Monoid.Canonical.Defs"
},
{
"name": "not_lt_zero'",
"module": "Mathlib.Algebra.Or... | [
{
"name": "Value.Approx.Indexed.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.Indexed.invert {n v v'} :\n v β²α΅₯(n) v' β\n Value.Approx.Indexed.Inversion n v v'"
},
{
"name": "Value.Approx.Indexed.constr_app",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.cons... | [
{
"name": "Juvix.Core.Main.Value.Approx",
"content": "def Value.Approx (v v' : Value) : Prop :=\n β n, v β²α΅₯(n) v'"
},
{
"name": "Juvix.Core.Main.Expr.Approx.Param",
"content": "def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Expr) : Prop :=\n (β vβ, envβ β’ eβ β¦ vβ β β vβ, envβ β’ eβ β¦ vβ β§ vβ ... | [
{
"name": "Juvix.Core.Main.Value.Approx.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.invert {v v'} :\n v β²α΅₯ v' β\n Value.Approx.Inversion v v'"
},
{
"name": "Juvix.Core.Main.Value.Approx.Indexed.trans",
"content": "@[trans]\nlemma Value.Approx.Indexed.trans {n vβ vβ vβ} : ... | import Juvix.Core.Main.Semantics.Approx.Indexed
namespace Juvix.Core.Main
def Value.Approx (v v' : Value) : Prop :=
β n, v β²α΅₯(n) v'
notation:40 v:40 " β²α΅₯ " v':40 => Value.Approx v v'
notation:40 argsβ:40 " β²β " argsβ:40 => List.Forallβ Value.Approx argsβ argsβ
def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Exp... | @[aesop unsafe apply]
lemma Value.Approx.closure {envβ bodyβ envβ bodyβ} :
(β aβ aβ,
aβ β²α΅₯ aβ β
bodyβ β²β¨aβ β· envβ, aβ β· envββ© bodyβ) β
Value.closure envβ bodyβ β²α΅₯ Value.closure envβ bodyβ := | := by
intro h n
apply Value.Approx.Indexed.closure
intro nβ nβ hn aβ aβ vβ happrox heval
have hβ : β vβ', aβ β· envβ β’ bodyβ β¦ vβ' β§ vβ β²α΅₯(nβ) vβ' := by
apply Indexed.preserved nβ nβ (aβ β· envβ) (aβ β· envβ) bodyβ vβ
Β· simp [Env.Approx.Indexed']
constructor
Β· constructor
have : nβ + nβ... | 4 | 68 | false | Semantics |
253 | Juvix.Core.Main.Object.Approx.Indexed'.anti_monotone | lemma Object.Approx.Indexed'.anti_monotone {n n' oβ oβ} (h : oβ β²β'(n) oβ) (h' : n' β€ n) : oβ β²β'(n') oβ :=
match h with
| @Object.Approx.Indexed'.value n vβ vβ happrox => by
apply Object.Approx.Indexed'.value
Β· apply Value.Approx.Indexed.anti_monotone
Β· assumption
Β· assumption
|... | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v",
"content": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v"
},
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env e",
"content": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env ... | [
{
"name": "and_self",
"module": "Init.SimpLemmas"
},
{
"name": "exists_and_left",
"module": "Init.PropLemmas"
},
{
"name": "exists_const",
"module": "Init.PropLemmas"
},
{
"name": "exists_eq_left'",
"module": "Init.PropLemmas"
},
{
"name": "false_and",
"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": "Juvix.Core.Main.Value.Approx.Indexed",
"content": "def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=\n (vβ = Value.unit β§ vβ = Value.unit) β¨\n (β c, vβ = Value.const c β§ vβ = Value.const c) β¨\n (β ctr_name args_rev args_rev',\n vβ = Value.constr_app ctr_name args_rev β§\n vβ = ... | [
{
"name": "Juvix.Core.Main.Value.Approx.Indexed.unit",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.unit {n} : Value.unit β²α΅₯(n) Value.unit"
},
{
"name": "Juvix.Core.Main.Value.Approx.Indexed.const",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.const {n c} : Valu... | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=
(vβ = Value.unit β§ vβ = Value.unit) β¨
(β c... | lemma Object.Approx.Indexed'.anti_monotone {n n' oβ oβ} (h : oβ β²β'(n) oβ) (h' : n' β€ n) : oβ β²β'(n') oβ := | :=
match h with
| @Object.Approx.Indexed'.value n vβ vβ happrox => by
apply Object.Approx.Indexed'.value
Β· apply Value.Approx.Indexed.anti_monotone
Β· assumption
Β· assumption
| @Object.Approx.Indexed'.delayed n envβ envβ eβ eβ happrox => by
apply Object.Approx.Indexed'.delay... | 3 | 47 | false | Semantics |
254 | Juvix.Core.Main.Value.Approx.closure_inv | lemma Value.Approx.closure_inv {envβ bodyβ envβ bodyβ}
(h : Value.closure envβ bodyβ β²α΅₯ Value.closure envβ bodyβ) :
β aβ aβ, aβ β²α΅₯ aβ β bodyβ β²β¨aβ β· envβ, aβ β· envββ© bodyβ | juvix-lean | Juvix/Core/Main/Semantics/Approx.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Inde",
"content": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Indexed n v v'"
},
{
"name": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v v'",
"content": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v... | [
{
"name": "IsEmpty.forall_iff",
"module": "Mathlib.Logic.IsEmpty"
},
{
"name": "implies_true",
"module": "Init.SimpLemmas"
},
{
"name": "nonpos_iff_eq_zero",
"module": "Mathlib.Algebra.Order.Monoid.Canonical.Defs"
},
{
"name": "not_lt_zero'",
"module": "Mathlib.Algebra.Or... | [
{
"name": "Value.Approx.Indexed.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.Indexed.invert {n v v'} :\n v β²α΅₯(n) v' β\n Value.Approx.Indexed.Inversion n v v'"
},
{
"name": "Value.Approx.Indexed.constr_app",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.cons... | [
{
"name": "Juvix.Core.Main.Value.Approx",
"content": "def Value.Approx (v v' : Value) : Prop :=\n β n, v β²α΅₯(n) v'"
},
{
"name": "Juvix.Core.Main.Expr.Approx.Param",
"content": "def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Expr) : Prop :=\n (β vβ, envβ β’ eβ β¦ vβ β β vβ, envβ β’ eβ β¦ vβ β§ vβ ... | [] | import Juvix.Core.Main.Semantics.Approx.Indexed
namespace Juvix.Core.Main
def Value.Approx (v v' : Value) : Prop :=
β n, v β²α΅₯(n) v'
notation:40 v:40 " β²α΅₯ " v':40 => Value.Approx v v'
notation:40 argsβ:40 " β²β " argsβ:40 => List.Forallβ Value.Approx argsβ argsβ
def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Exp... | lemma Value.Approx.closure_inv {envβ bodyβ envβ bodyβ}
(h : Value.closure envβ bodyβ β²α΅₯ Value.closure envβ bodyβ) :
β aβ aβ, aβ β²α΅₯ aβ β bodyβ β²β¨aβ β· envβ, aβ β· envββ© bodyβ := | := by
intro aβ aβ ha vβ h'
suffices β n, β vβ, (aβ β· envβ) β’ bodyβ β¦ vβ β§ vβ β²α΅₯(n) vβ by
obtain β¨vβ, _, _β© := this 0
exists vβ
constructor
Β· assumption
Β· intro n
obtain β¨vβ', _, _β© := this n
have : vβ = vβ' := by
apply Eval.deterministic <;> assumption
subst this
... | 5 | 72 | false | Semantics |
255 | Juvix.Core.Main.Value.Approx.preserved | theorem Value.Approx.preserved :
β env env' e v,
env β²β env' β
env β’ e β¦ v β
β v', env' β’ e β¦ v' β§ v β²α΅₯ v' | juvix-lean | Juvix/Core/Main/Semantics/Approx.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed",
"import Juvix.Core.Main.Semantics.Eval",
"import Juvix.Core.Main.Semantics.Eval.Indexed"
] | [
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
},
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
... | [
{
"name": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Exp",
"content": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param env env' e e'"
},
{
"name": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v v'",
"content": "notation:40 v:40 \" β²α΅₯ \" v... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Eval.Indexed.toEval",
"content": "lemma Eval.Indexed.toEval {n env e v} (h : env β’ e β¦(n) v) : env β’ e β¦ v"
},
{
"name": "Value.Approx.Indexed.preserved",
"content": "theorem Value.Approx.Indexed.preserved :\n β m n env env' e v,\n env β²β'(m + n) env' β\n env β’ e β¦(n) v β\n ... | [
{
"name": "Juvix.Core.Main.Value.Approx",
"content": "def Value.Approx (v v' : Value) : Prop :=\n β n, v β²α΅₯(n) v'"
},
{
"name": "Juvix.Core.Main.Expr.Approx.Param",
"content": "def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Expr) : Prop :=\n (β vβ, envβ β’ eβ β¦ vβ β β vβ, envβ β’ eβ β¦ vβ β§ vβ ... | [
{
"name": "Juvix.Core.Main.Env.Approx.cons",
"content": "lemma Env.Approx.cons {envβ envβ oβ oβ} :\n oβ β²β oβ β envβ β²β envβ β (oβ :: envβ) β²β (oβ :: envβ)"
},
{
"name": "Juvix.Core.Main.Object.Approx.toIndexed",
"content": "lemma Object.Approx.toIndexed {oβ oβ} : oβ β²β oβ β β n, oβ β²β'(n) oβ"
... | import Juvix.Core.Main.Semantics.Approx.Indexed
namespace Juvix.Core.Main
def Value.Approx (v v' : Value) : Prop :=
β n, v β²α΅₯(n) v'
notation:40 v:40 " β²α΅₯ " v':40 => Value.Approx v v'
notation:40 argsβ:40 " β²β " argsβ:40 => List.Forallβ Value.Approx argsβ argsβ
def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Exp... | theorem Value.Approx.preserved :
β env env' e v,
env β²β env' β
env β’ e β¦ v β
β v', env' β’ e β¦ v' β§ v β²α΅₯ v' := | := by
intro env env' e v hβ hβ
suffices β n, β v', env' β’ e β¦ v' β§ v β²α΅₯(n) v' by
obtain β¨v', heval', happrox'β© := this 0
exists v'
constructor
Β· assumption
Β· intro n
obtain β¨v'', heval'', happrox''β© := this n
have : v' = v'' := by
apply Eval.deterministic <;> assumption
... | 4 | 66 | false | Semantics |
256 | Juvix.Core.Main.Env.Approx.Indexed'.delayed | lemma Env.Approx.Indexed'.delayed {n i : Nat} {envβ envβ env e}
(hβ : envβ β²β'(n) envβ)
(hβ : envβ[i]? = some (Object.delayed env e)) :
(β env' e', e β²(n)β¨env, env'β© e' β§ envβ[i]? = some (Object.delayed env' e')) β¨
β env', env β²β'(n) env' β§ envβ[i]? = some (Object.delayed env' e) | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
}
] | [
{
"name": "notation:40 e:40 \" β²(\" n:40 \")β¨\" env:40 \", \" env':40 \"β© \" e'",
"content": "notation:40 e:40 \" β²(\" n:40 \")β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param.Indexed n env env' e e'"
},
{
"name": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Inde",
"co... | [
{
"name": "List.Forallβ.get",
"module": "Mathlib.Data.List.Forall2"
},
{
"name": "List.Forallβ.length_eq",
"module": "Mathlib.Data.List.Forall2"
},
{
"name": "List.getElem?_eq_some_iff",
"module": "Init.Data.List.Lemmas"
},
{
"name": "List.get_eq_getElem",
"module": "Init... | [
{
"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": "Juvix.Core.Main.Object.Approx.Indexed'",
"content": "inductive Object.Approx.Indexed' (n : Nat) : Object β Object β Prop where\n | value {vβ vβ} :\n vβ β²α΅₯(n) vβ β\n Object.Approx.Indexed' n (Object.value vβ) (Object.value vβ)\n | delayed {envβ envβ eβ eβ} :\n eβ β²(n)β¨envβ, envββ© eβ β\n... | [
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.get",
"content": "lemma Env.Approx.Indexed'.get {n i : Nat} {env env' oβ}\n (hβ : env β²β'(n) env')\n (hβ : env[i]? = some oβ) :\n β oβ, env'[i]? = some oβ β§ oβ β²β'(n) oβ"
},
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.value",
"content": "lemma... | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
notation:40 v:40 " β²α΅₯(" n:40 ") " v':40 => Value.Approx.Indexed n v v'
notation:40 argsβ:40 " β²β(" n:40 ")... | lemma Env.Approx.Indexed'.delayed {n i : Nat} {envβ envβ env e}
(hβ : envβ β²β'(n) envβ)
(hβ : envβ[i]? = some (Object.delayed env e)) :
(β env' e', e β²(n)β¨env, env'β© e' β§ envβ[i]? = some (Object.delayed env' e')) β¨
β env', env β²β'(n) env' β§ envβ[i]? = some (Object.delayed env' e) := | := by
obtain β¨o, h, happroxβ© := Env.Approx.Indexed'.get hβ hβ
cases hβ : o
case value v =>
rw [hβ] at happrox
contradiction
case delayed env' e' =>
rw [hβ] at happrox
cases happrox
case delayed h =>
left
subst hβ
exists env'
exists e'
case delayed_eq =>
righ... | 3 | 15 | false | Semantics |
257 | Juvix.Core.Main.Value.Approx.Indexed.preserved' | lemma Value.Approx.Indexed.preserved' {k} : Preservation k | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v",
"content": "notation:40 env:40 \" β’ \" e:40 \" β¦ \" v:40 => Eval env e v"
},
{
"name": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env e",
"content": "notation:40 env:40 \" β’ \" e:40 \" β\" => Eval.Defined env ... | [
{
"name": "and_self",
"module": "Init.SimpLemmas"
},
{
"name": "exists_and_left",
"module": "Init.PropLemmas"
},
{
"name": "exists_const",
"module": "Init.PropLemmas"
},
{
"name": "exists_eq_left'",
"module": "Init.PropLemmas"
},
{
"name": "false_and",
"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": "Juvix.Core.Main.Value.Approx.Indexed",
"content": "def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=\n (vβ = Value.unit β§ vβ = Value.unit) β¨\n (β c, vβ = Value.const c β§ vβ = Value.const c) β¨\n (β ctr_name args_rev args_rev',\n vβ = Value.constr_app ctr_name args_rev β§\n vβ = ... | [
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.get",
"content": "lemma Env.Approx.Indexed'.get {n i : Nat} {env env' oβ}\n (hβ : env β²β'(n) env')\n (hβ : env[i]? = some oβ) :\n β oβ, env'[i]? = some oβ β§ oβ β²β'(n) oβ"
},
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.value",
"content": "lemma... | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
def Value.Approx.Indexed (n : Nat) (vβ vβ : Value) : Prop :=
(vβ = Value.unit β§ vβ = Value.unit) β¨
(β c... | lemma Value.Approx.Indexed.preserved' {k} : Preservation k := | := by
suffices β k' β€ k, Preservation k' by
aesop
induction k with
| zero =>
intro k' hk'
refine preserved_step ?_
intro k hk
linarith
| succ k ih =>
intro k' hk'
cases hk'
case succ.refl =>
refine preserved_step ?_
intro k' hk'
apply ih
linarith
case ... | 9 | 80 | false | Semantics |
258 | Juvix.Core.Main.Object.Approx.Indexed'.refl' | lemma Object.Approx.Indexed'.refl' {n o} (h : β v, v β²α΅₯(n) v) : o β²β'(n) o | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
},
{
"name": "List.Forallβ.cons",
"module": "Batteries.Data.List.Basic"
},
{
"name": "List.Forallβ.nil",
... | [
{
"name": "notation:40 e:40 \" β²(\" n:40 \")β¨\" env:40 \", \" env':40 \"β© \" e'",
"content": "notation:40 e:40 \" β²(\" n:40 \")β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param.Indexed n env env' e e'"
},
{
"name": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Inde",
"co... | [
{
"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": "Juvix.Core.Main.Object.Approx.Indexed'",
"content": "inductive Object.Approx.Indexed' (n : Nat) : Object β Object β Prop where\n | value {vβ vβ} :\n vβ β²α΅₯(n) vβ β\n Object.Approx.Indexed' n (Object.value vβ) (Object.value vβ)\n | delayed {envβ envβ eβ eβ} :\n eβ β²(n)β¨envβ, envββ© eβ β\n... | [
{
"name": "Juvix.Core.Main.Env.Approx.Indexed'.refl'",
"content": " lemma Env.Approx.Indexed'.refl' {n env} (h : β v, v β²α΅₯(n) v) : env β²β'(n) env"
}
] | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
notation:40 v:40 " β²α΅₯(" n:40 ") " v':40 => Value.Approx.Indexed n v v'
notation:40 argsβ:40 " β²β(" n:40 ")... | lemma Object.Approx.Indexed'.refl' {n o} (h : β v, v β²α΅₯(n) v) : o β²β'(n) o := | := by
cases o
case value v =>
apply Object.Approx.Indexed'.value
apply h
case delayed env e =>
apply Object.Approx.Indexed'.delayed_eq
exact Env.Approx.Indexed'.refl' h | 3 | 14 | false | Semantics |
259 | Juvix.Core.Main.Expr.Equiv.eval_const | lemma Expr.Equiv.eval_const {op aβ aβ iβ iβ iβ} :
aβ β Expr.const (Constant.int iβ) β
aβ β Expr.const (Constant.int iβ) β
iβ = eval_binop_int op iβ iβ β
Expr.binop op aβ aβ β
Expr.const (Constant.int iβ) | juvix-lean | Juvix/Core/Main/Semantics/Equiv.lean | [
"import Juvix.Core.Main.Semantics.Approx"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"na... | [
{
"name": "notation:40 eβ:40 \" β² \" eβ:40 => Expr.Approx eβ eβ",
"content": "notation:40 eβ:40 \" β² \" eβ:40 => Expr.Approx eβ eβ"
},
{
"name": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Exp",
"content": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.A... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "Expr.Approx.eval_constβ",
"content": "lemma Expr.Approx.eval_constβ {op aβ aβ iβ iβ iβ} :\n aβ β² Expr.const (Constant.int iβ) β\n aβ β² Expr.const (Constant.int iβ) β\n iβ = eval_binop_int op iβ iβ β\n Expr.binop op aβ aβ β²\n Expr.const (Constant.int iβ)"
},
{
"name": "Expr.Approx.c... | [
{
"name": "Juvix.Core.Main.Expr.Equiv",
"content": "def Expr.Equiv (eβ eβ : Expr) : Prop :=\n eβ β² eβ β§ eβ β² eβ"
}
] | [] | import Juvix.Core.Main.Semantics.Approx
namespace Juvix.Core.Main
notation:40 v:40 " βα΅₯ " v':40 => Value.Equiv v v'
notation:40 argsβ:40 " ββ " argsβ:40 => List.Forallβ Value.Equiv argsβ argsβ
notation:40 v:40 " ββ " v':40 => Object.Equiv v v'
notation:40 envβ:40 " ββ " envβ:40 => Env.Equiv envβ envβ
notation:40 ... | lemma Expr.Equiv.eval_const {op aβ aβ iβ iβ iβ} :
aβ β Expr.const (Constant.int iβ) β
aβ β Expr.const (Constant.int iβ) β
iβ = eval_binop_int op iβ iβ β
Expr.binop op aβ aβ β
Expr.const (Constant.int iβ) := | := by
simp only [Expr.Equiv]
intro hβ hβ hβ
constructor
Β· apply Expr.Approx.eval_constβ (op := op) (iβ := iβ) (iβ := iβ) <;>
simp_all only
Β· apply Expr.Approx.eval_constβ (op := op) (iβ := iβ) (iβ := iβ) <;>
simp_all only | 3 | 40 | false | Semantics |
260 | Juvix.Core.Main.Env.Approx.Indexed'.from_delayed | lemma Env.Approx.Indexed'.from_delayed {n envβ envβ l} (h : envβ β²β'(n) envβ) :
List.map (Object.delayed envβ) l β²β'(n) List.map (Object.delayed envβ) l | juvix-lean | Juvix/Core/Main/Semantics/Approx/Indexed.lean | [
"import Juvix.Utils",
"import Juvix.Core.Main.Semantics.Eval.Indexed",
"import Mathlib.Tactic.Linarith",
"import Mathlib.Data.List.Forall2",
"import Juvix.Core.Main.Semantics.Eval",
"import Aesop"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
},
{
"name": "List.map",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ.cons",
"module": "Batteries.... | [
{
"name": "notation:40 e:40 \" β²(\" n:40 \")β¨\" env:40 \", \" env':40 \"β© \" e'",
"content": "notation:40 e:40 \" β²(\" n:40 \")β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param.Indexed n env env' e e'"
},
{
"name": "notation:40 v:40 \" β²α΅₯(\" n:40 \") \" v':40 => Value.Approx.Inde",
"co... | [
{
"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": "Juvix.Core.Main.Object.Approx.Indexed'",
"content": "inductive Object.Approx.Indexed' (n : Nat) : Object β Object β Prop where\n | value {vβ vβ} :\n vβ β²α΅₯(n) vβ β\n Object.Approx.Indexed' n (Object.value vβ) (Object.value vβ)\n | delayed {envβ envβ eβ eβ} :\n eβ β²(n)β¨envβ, envββ© eβ β\n... | [] | import Juvix.Core.Main.Semantics.Eval
import Juvix.Core.Main.Semantics.Eval.Indexed
import Juvix.Utils
import Mathlib.Tactic.Linarith
import Mathlib.Data.List.Forall2
import Aesop
namespace Juvix.Core.Main
notation:40 v:40 " β²α΅₯(" n:40 ") " v':40 => Value.Approx.Indexed n v v'
notation:40 argsβ:40 " β²β(" n:40 ")... | lemma Env.Approx.Indexed'.from_delayed {n envβ envβ l} (h : envβ β²β'(n) envβ) :
List.map (Object.delayed envβ) l β²β'(n) List.map (Object.delayed envβ) l := | := by
induction l
case nil =>
exact List.Forallβ.nil
case cons e l' h' =>
simp
apply List.Forallβ.cons
Β· apply Object.Approx.Indexed'.delayed_eq
assumption
Β· assumption | 3 | 12 | false | Semantics |
261 | Juvix.Core.Main.Termination.binop | lemma Termination.binop {env op eβ eβ cβ cβ} :
env β’ eβ β¦ Value.const (Constant.int cβ) β
env β’ eβ β¦ Value.const (Constant.int cβ) β
env β’ Expr.binop op eβ eβ β | juvix-lean | Juvix/Core/Main/Tactics/Termination.lean | [
"import Juvix.Core.Main.Tactics.Base"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "syntax:100 expr:100 ppSpace expr:101 : expr",
"content": "syntax:100 expr:100 ppSpace expr:101 : expr\n\nsyntax:50 expr:50 \" + \" expr:51 : expr\n\nsyntax:50 expr:50 \" - \" expr:50 : expr\n\nsyntax:60 expr:60 \" * \" expr:61 : expr\n\nsyntax:60 expr:60 \" / \" expr:60 : expr"
},
{
"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]"
}
] | [] | [] | import Juvix.Core.Main.Tactics.Base
namespace Juvix.Core.Main | lemma Termination.binop {env op eβ eβ cβ cβ} :
env β’ eβ β¦ Value.const (Constant.int cβ) β
env β’ eβ β¦ Value.const (Constant.int cβ) β
env β’ Expr.binop op eβ eβ β := | := by
intro hβ hβ
constructor
apply Juvix.Core.Main.Eval.binop
Β· assumption
Β· assumption | 4 | 18 | false | Semantics |
262 | Juvix.Core.Main.Object.Approx.trans | @[trans]
lemma Object.Approx.trans {oβ oβ oβ} : oβ β²β oβ β oβ β²β oβ β oβ β²β oβ | juvix-lean | Juvix/Core/Main/Semantics/Approx.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed",
"import Juvix.Utils"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Exp",
"content": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param env env' e e'"
},
{
"name": "notation:40 eβ:40 \" β² \" eβ:40 => Expr.Approx eβ eβ",
"content": "notation:40 eβ:40 \" β² \" e... | [
{
"name": "IsEmpty.forall_iff",
"module": "Mathlib.Logic.IsEmpty"
},
{
"name": "implies_true",
"module": "Init.SimpLemmas"
},
{
"name": "nonpos_iff_eq_zero",
"module": "Mathlib.Algebra.Order.Monoid.Canonical.Defs"
},
{
"name": "not_lt_zero'",
"module": "Mathlib.Algebra.Or... | [
{
"name": "Value.Approx.Indexed.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.Indexed.invert {n v v'} :\n v β²α΅₯(n) v' β\n Value.Approx.Indexed.Inversion n v v'"
},
{
"name": "Value.Approx.Indexed.constr_app",
"content": "@[aesop unsafe apply]\nlemma Value.Approx.Indexed.cons... | [
{
"name": "Juvix.Core.Main.Value.Approx",
"content": "def Value.Approx (v v' : Value) : Prop :=\n β n, v β²α΅₯(n) v'"
},
{
"name": "Juvix.Core.Main.Expr.Approx.Param",
"content": "def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Expr) : Prop :=\n (β vβ, envβ β’ eβ β¦ vβ β β vβ, envβ β’ eβ β¦ vβ β§ vβ ... | [
{
"name": "Juvix.Core.Main.Value.Approx.invert",
"content": "@[aesop unsafe destruct]\nlemma Value.Approx.invert {v v'} :\n v β²α΅₯ v' β\n Value.Approx.Inversion v v'"
},
{
"name": "Juvix.Core.Main.Value.Approx.Indexed.trans",
"content": "@[trans]\nlemma Value.Approx.Indexed.trans {n vβ vβ vβ} : ... | import Juvix.Core.Main.Semantics.Approx.Indexed
namespace Juvix.Core.Main
def Value.Approx (v v' : Value) : Prop :=
β n, v β²α΅₯(n) v'
notation:40 v:40 " β²α΅₯ " v':40 => Value.Approx v v'
notation:40 argsβ:40 " β²β " argsβ:40 => List.Forallβ Value.Approx argsβ argsβ
def Expr.Approx.Param (envβ envβ : Env) (eβ eβ : Exp... | @[trans]
lemma Object.Approx.trans {oβ oβ oβ} : oβ β²β oβ β oβ β²β oβ β oβ β²β oβ := | := by
intros hβ hβ
cases hβ
case value vβ vβ happrox =>
cases hβ
case value vβ happrox' =>
apply Object.Approx.value
trans vβ <;> assumption
case delayed envβ envβ eβ eβ happrox =>
cases hβ
case delayed envβ' eβ' happrox' =>
apply Object.Approx.delayed
exact Expr.Approx.P... | 6 | 39 | false | Semantics |
263 | Juvix.Core.Main.Env.Approx.cons_value | lemma Env.Approx.cons_value {vβ vβ env} :
vβ β²α΅₯ vβ β vβ β· env β²β vβ β· env | juvix-lean | Juvix/Core/Main/Semantics/Approx.lean | [
"import Juvix.Core.Main.Semantics.Approx.Indexed"
] | [
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "List.Forallβ",
"module": "Batteries.Data.List.Basic"
},
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
... | [
{
"name": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Exp",
"content": "notation:40 e:40 \" β²β¨\" env:40 \", \" env':40 \"β© \" e':40 => Expr.Approx.Param env env' e e'"
},
{
"name": "notation:40 v:40 \" β²α΅₯ \" v':40 => Value.Approx v v'",
"content": "notation:40 v:40 \" β²α΅₯ \" v... | [
{
"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": "Juvix.Core.Main.Value.Approx",
"content": "def Value.Approx (v v' : Value) : Prop :=\n β n, v β²α΅₯(n) v'"
},
{
"name": "Juvix.Core.Main.Object.Approx",
"content": "inductive Object.Approx : Object β Object β Prop where\n | value {vβ vβ} : vβ β²α΅₯ vβ β Object.Approx (Object.value vβ) (Ob... | [
{
"name": "Juvix.Core.Main.Value.Approx.refl",
"content": "@[refl]\nlemma Value.Approx.refl v : v β²α΅₯ v"
},
{
"name": "Juvix.Core.Main.Object.Approx.refl",
"content": "@[refl]\nlemma Object.Approx.refl {o} : o β²β o"
},
{
"name": "Juvix.Core.Main.Env.Approx.refl",
"content": "@[refl]\n... | import Juvix.Core.Main.Semantics.Approx.Indexed
namespace Juvix.Core.Main
def Value.Approx (v v' : Value) : Prop :=
β n, v β²α΅₯(n) v'
notation:40 v:40 " β²α΅₯ " v':40 => Value.Approx v v'
notation:40 argsβ:40 " β²β " argsβ:40 => List.Forallβ Value.Approx argsβ argsβ
notation:40 e:40 " β²β¨" env:40 ", " env':40 "β© " e':4... | lemma Env.Approx.cons_value {vβ vβ env} :
vβ β²α΅₯ vβ β vβ β· env β²β vβ β· env := | := by
intro h
apply Env.Approx.cons
Β· apply Object.Approx.value
assumption
Β· apply Env.Approx.refl | 4 | 26 | false | Semantics |
264 | Juvix.Core.Main.Termination.branch_matches | lemma Termination.branch_matches {env name vnames args_rev e e'} :
args_rev.map Object.value ++ env β’ e β β
Value.constr_app name args_rev β· env β’ Expr.branch name vnames e e' β | juvix-lean | Juvix/Core/Main/Tactics/Termination.lean | [
"import Juvix.Core.Main.Tactics.Base"
] | [
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"... | [
{
"name": "syntax:100 expr:100 ppSpace expr:101 : expr",
"content": "syntax:100 expr:100 ppSpace expr:101 : expr\n\nsyntax:50 expr:50 \" + \" expr:51 : expr\n\nsyntax:50 expr:50 \" - \" expr:50 : expr\n\nsyntax:60 expr:60 \" * \" expr:61 : expr\n\nsyntax:60 expr:60 \" / \" expr:60 : expr"
},
{
"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]"
}
] | [] | [] | import Juvix.Core.Main.Tactics.Base
namespace Juvix.Core.Main | lemma Termination.branch_matches {env name vnames args_rev e e'} :
args_rev.map Object.value ++ env β’ e β β
Value.constr_app name args_rev β· env β’ Expr.branch name vnames e e' β := | := by
intro h
obtain β¨w, hβ© := h
constructor
apply Juvix.Core.Main.Eval.branch_matches
assumption | 4 | 18 | false | Semantics |
265 | eval_bool_completeness | theorem eval_bool_completeness (e: BoolExpr V): BoolStepStar V val e (BoolExpr.Const (eval_bool V val e)) | LeanExprEvaluator | ExprEval/Basic.lean | [
"import ExprEval.Steps",
"import ExprEval.Lemmas",
"import ExprEval.Expr"
] | [
{
"name": "And",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name": "Eq",
"module": "Init.Prelude"
},
{
"name": "Not",
"module": "Init.Prelude"
},
{
"name": "Or",
"module": "Init.Prelude"
},
{
"name": "Add",
"module... | [
{
"name": "BoolStepStar",
"content": "def BoolStepStar (V: Type) := StepStar (Step := BoolStep V) V"
},
{
"name": "BoolStep",
"content": "inductive BoolStep: (val: V -> Int) -> (BoolExpr V) -> (BoolExpr V) -> Prop where\n | notIsBoolNot (b: Bool): BoolStep val\n (BoolExpr.Not (BoolExpr... | [
{
"name": "Int.not_lt",
"module": "Init.Data.Int.Order"
},
{
"name": "bne_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "decide_eq_false",
"module": "Init.Prelude"
},
{
"name": "decide_eq_true",
"module": "Init.Prelude"
},
{
"name": "eq_false_of_ne_true",
... | [
{
"name": "BoolStepStar.andStepLeft",
"content": "theorem BoolStepStar.andStepLeft (eβ eβ' eβ: BoolExpr V):\n BoolStepStar V val eβ eβ' -> BoolStepStar V val\n (BoolExpr.And eβ eβ)\n (BoolExpr.And eβ' eβ)"
},
{
"name": "chasles_step_star",
"content": "theorem chasles... | [] | [
{
"name": "eval_completeness",
"content": " theorem eval_completeness (e: ArExpr V) : ArStepStar V val e (ArExpr.Const (eval V val e))"
}
] | import ExprEval.Steps
import ExprEval.Lemmas
variable (V: Type) | theorem eval_bool_completeness (e: BoolExpr V): BoolStepStar V val e (BoolExpr.Const (eval_bool V val e)) := | := by
cases e with
| Const b =>
simp [eval_bool]
apply BoolStepStar.refl
| Not e =>
simp [eval_bool]
have ihn := eval_bool_completeness e (val := val)
have h := BoolStepStar.notStep e _ ihn
have h1 := BoolStep.notIsBoolNot (... | 4 | 60 | true | Semantics |
266 | eval_completeness | theorem eval_completeness (e: ArExpr V) : ArStepStar V val e (ArExpr.Const (eval V val e)) | LeanExprEvaluator | ExprEval/Basic.lean | [
"import ExprEval.Steps",
"import ExprEval.Lemmas",
"import ExprEval.Expr"
] | [
{
"name": "Add",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "Mul",
"module": "Init.Prelude"
},
{
"name": "Sub",
"module": "Init.Prelude"
},
{
"name": "And",
"module": "Init.Prelude"
},
{
"name": "Bool",
... | [
{
"name": "ArStep",
"content": "inductive ArStep: (val: V -> Int) -> (ArExpr V) -> (ArExpr V) -> Prop where\n | getVarValue (var: V) :\n ArStep\n val\n (ArExpr.Var var)\n (ArExpr.Const (val var))\n | addConstConst(nβ nβ: Int) :\n ArStep\n val\n... | [
{
"name": "Int.not_lt",
"module": "Init.Data.Int.Order"
},
{
"name": "bne_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "decide_eq_false",
"module": "Init.Prelude"
},
{
"name": "decide_eq_true",
"module": "Init.Prelude"
},
{
"name": "eq_false_of_ne_true",
... | [
{
"name": "arstepstar_add_right",
"content": "theorem arstepstar_add_right (n: Int) (eβ eβ': ArExpr V) :\n ArStepStar V val eβ eβ' ->\n ArStepStar V val\n (ArExpr.Add (ArExpr.Const n) eβ)\n (ArExpr.Add (ArExpr.Const n) eβ')"... | [] | [] | import ExprEval.Steps
import ExprEval.Lemmas
variable (V: Type) | theorem eval_completeness (e: ArExpr V) : ArStepStar V val e (ArExpr.Const (eval V val e)) := | := by
cases e with
| Const x =>
simp [eval]
exact ArStepStar.refl _ _
| Add eβ eβ =>
have ih1 := eval_completeness eβ (val := val)
have ih2 := eval_completeness eβ (val := val)
simp [eval]
have a := arstepstar_add_left _ _ e... | 4 | 60 | true | Semantics |
267 | boolstep_preserves_eval_bool | theorem boolstep_preserves_eval_bool (e e': BoolExpr V):
BoolStep V val e e' -> eval_bool V val e = eval_bool V val e' | LeanExprEvaluator | ExprEval/Lemmas.lean | [
"import ExprEval.Steps",
"import ExprEval.Expr"
] | [
{
"name": "Add",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "Mul",
"module": "Init.Prelude"
},
{
"name": "Sub",
"module": "Init.Prelude"
},
{
"name": "And",
"module": "Init.Prelude"
},
{
"name": "Bool",
... | [
{
"name": "BoolExpr",
"content": "inductive BoolExpr : Type\n | Const: Bool -> BoolExpr\n | Less: ArExpr -> ArExpr -> BoolExpr\n | Eq: ArExpr -> ArExpr -> BoolExpr\n | Not : BoolExpr -> BoolExpr\n | And : BoolExpr -> BoolExpr -> BoolExpr\n | Or : BoolExpr -> BoolExp... | [
{
"name": "bne_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "Int.mul_eq_mul_right_iff",
"module": "Init.Data.Int.Lemmas"
},
{
"name": "beq_eq_false_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "beq_iff_eq",
"module": "Init.Core"
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [] | [
{
"name": "arstep_preserve_eval",
"content": " theorem arstep_preserve_eval (e e': ArExpr V): (ArStep V val) e e' -> eval V val e = eval V val e'"
}
] | import ExprEval.Expr
import ExprEval.Steps | theorem boolstep_preserves_eval_bool (e e': BoolExpr V):
BoolStep V val e e' -> eval_bool V val e = eval_bool V val e' := | := by
intro h
cases h with
| notIsBoolNot b => simp [eval_bool]
| andLeftTrue e => simp [eval_bool]
| orLeftFalse e => simp [eval_bool]
| andLeftShortCircuit e => simp [eval_bool]
| orLeftShortCircuit e => simp [eval_bool]
| lessConstConstTrue n1 n2 h =>
... | 3 | 33 | false | Semantics |
268 | arstep_preserve_eval | theorem arstep_preserve_eval (e e': ArExpr V): (ArStep V val) e e' -> eval V val e = eval V val e' | LeanExprEvaluator | ExprEval/Lemmas.lean | [
"import ExprEval.Steps",
"import ExprEval.Expr"
] | [
{
"name": "Add",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "Mul",
"module": "Init.Prelude"
},
{
"name": "Sub",
"module": "Init.Prelude"
},
{
"name": "And",
"module": "Init.Prelude"
},
{
"name": "Bool",
... | [
{
"name": "ArStep",
"content": "inductive ArStep: (val: V -> Int) -> (ArExpr V) -> (ArExpr V) -> Prop where\n | getVarValue (var: V) :\n ArStep\n val\n (ArExpr.Var var)\n (ArExpr.Const (val var))\n | addConstConst(nβ nβ: Int) :\n ArStep\n val\n... | [
{
"name": "Int.mul_eq_mul_right_iff",
"module": "Init.Data.Int.Lemmas"
},
{
"name": "beq_eq_false_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "beq_iff_eq",
"module": "Init.Core"
},
{
"name": "bne_iff_ne",
"module": "Init.SimpLemmas"
}
] | [
{
"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 ExprEval.Expr
import ExprEval.Steps | theorem arstep_preserve_eval (e e': ArExpr V): (ArStep V val) e e' -> eval V val e = eval V val e' := | := by
intro h
cases h with
| addConstConst nβ nβ
| subConstConst nβ nβ
| mulConstConst nβ nβ => simp [eval]
| subLeft eβ eβ' eβ step
| addLeft eβ eβ' eβ step =>
simp [eval]
exact arstep_preserve_eval eβ ... | 4 | 33 | true | Semantics |
269 | boolstepstar_preserves_eval_bool | theorem boolstepstar_preserves_eval_bool (e e': BoolExpr V):
BoolStepStar V val e e' -> eval_bool V val e = eval_bool V val e' | LeanExprEvaluator | ExprEval/Lemmas.lean | [
"import ExprEval.Steps",
"import ExprEval.Expr"
] | [
{
"name": "Add",
"module": "Init.Prelude"
},
{
"name": "Int",
"module": "Init.Data.Int.Basic"
},
{
"name": "Mul",
"module": "Init.Prelude"
},
{
"name": "Sub",
"module": "Init.Prelude"
},
{
"name": "And",
"module": "Init.Prelude"
},
{
"name": "Bool",
... | [
{
"name": "BoolExpr",
"content": "inductive BoolExpr : Type\n | Const: Bool -> BoolExpr\n | Less: ArExpr -> ArExpr -> BoolExpr\n | Eq: ArExpr -> ArExpr -> BoolExpr\n | Not : BoolExpr -> BoolExpr\n | And : BoolExpr -> BoolExpr -> BoolExpr\n | Or : BoolExpr -> BoolExp... | [
{
"name": "Int.mul_eq_mul_right_iff",
"module": "Init.Data.Int.Lemmas"
},
{
"name": "beq_eq_false_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "beq_iff_eq",
"module": "Init.Core"
},
{
"name": "bne_iff_ne",
"module": "Init.SimpLemmas"
}
] | [
{
"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": "arstep_preserve_eval",
"content": " theorem arstep_preserve_eval (e e': ArExpr V): (ArStep V val) e e' -> eval V val e = eval V val e'"
},
{
"name": "boolstep_preserves_eval_bool",
"content": " theorem boolstep_preserves_eval_bool (e e': BoolExpr V):\n BoolStep V val e e'... | import ExprEval.Expr
import ExprEval.Steps | theorem boolstepstar_preserves_eval_bool (e e': BoolExpr V):
BoolStepStar V val e e' -> eval_bool V val e = eval_bool V val e' := | := by
intro h
induction h with
| refl => rfl
| trans _ _ _ h_step _ ihn =>
rw [<- ihn]
exact boolstep_preserves_eval_bool _ _ h_step | 4 | 35 | false | Semantics |
270 | arstepstar_preserves_eval | theorem arstepstar_preserves_eval (e e': ArExpr V) :
ArStepStar V val e e' -> eval V val e = eval V val e' | LeanExprEvaluator | ExprEval/Lemmas.lean | [
"import ExprEval.Steps",
"import ExprEval.Expr"
] | [
{
"name": "And",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name": "Eq",
"module": "Init.Prelude"
},
{
"name": "Not",
"module": "Init.Prelude"
},
{
"name": "Or",
"module": "Init.Prelude"
},
{
"name": "Add",
"module... | [
{
"name": "ArExpr",
"content": "inductive ArExpr: Type\n | Const: Int -> ArExpr\n | Add: ArExpr -> ArExpr -> ArExpr\n | Sub: ArExpr -> ArExpr -> ArExpr\n | Mul: ArExpr -> ArExpr -> ArExpr\n | Var: V -> ArExpr\n | If : BoolExpr -> ArExpr -> ArExpr -> ArExpr\n\n in... | [
{
"name": "bne_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "Int.mul_eq_mul_right_iff",
"module": "Init.Data.Int.Lemmas"
},
{
"name": "beq_eq_false_iff_ne",
"module": "Init.SimpLemmas"
},
{
"name": "beq_iff_eq",
"module": "Init.Core"
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [] | [
{
"name": "arstep_preserve_eval",
"content": " theorem arstep_preserve_eval (e e': ArExpr V): (ArStep V val) e e' -> eval V val e = eval V val e'"
}
] | import ExprEval.Expr
import ExprEval.Steps | theorem arstepstar_preserves_eval (e e': ArExpr V) :
ArStepStar V val e e' -> eval V val e = eval V val e' := | := by
intro h
induction h with
| refl _ => rfl
| trans _ _ _ h1 _ ih =>
rw [arstep_preserve_eval _ _ h1, ih] | 3 | 35 | false | Semantics |
271 | TM.progress | theorem progress t T
: HasType t T β value t β¨ β t', Step t t' | lean-formal-reasoning-program | Frap/Types.lean | [
"import Frap.SmallStep"
] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "syntax term \"==>\" term : term",
"content": "syntax term \"==>\" term : term\n\nsyntax term \"~~>\" term : term\n\nsyntax term \"~~>*\" term : term\n\nsyntax:30 term \" =[ \" imp \" ]=> \" term : term\n\nsyntax term \"!->\" term \"; \" term : term\n\nsyntax:36 term \"<<->>\" term : term"
},
... | [
{
"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": "TM.Tm",
"content": "inductive Tm : Type :=\n | tru : Tm\n | fls : Tm\n | ite : Tm β Tm β Tm β Tm\n | zro : Tm\n | scc : Tm β Tm\n | prd : Tm β Tm\n | iszero : Tm β Tm"
},
{
"name": "TM.BValue",
"content": "inductive BValue : Tm β Prop :=\n | bv_true : BValue tru\n | bv_false ... | [
{
"name": "TM.bool_canonical",
"content": "theorem bool_canonical t : HasType t bool β value t β BValue t"
},
{
"name": "TM.nat_canonical",
"content": "theorem nat_canonical t : HasType t nat β value t β NValue t"
}
] | import Frap.SmallStep
namespace TM
inductive Tm : Type :=
| tru : Tm
| fls : Tm
| ite : Tm β Tm β Tm β Tm
| zro : Tm
| scc : Tm β Tm
| prd : Tm β Tm
| iszero : Tm β Tm
open Tm
inductive BValue : Tm β Prop :=
| bv_true : BValue tru
| bv_false : BValue fls
inductive NValue : Tm β Prop :=
| nv_0 :... | theorem progress t T
: HasType t T β value t β¨ β t', Step t t' := | := by
intro ht
induction ht with
| t_if tβ tβ tβ T =>
rename_i ihβ ihβ ihβ
right; cases ihβ
. -- tβ is a value
have h : BValue tβ := by
apply bool_canonical <;> assumption
cases h
. exists tβ; apply st_ifTrue
. exists tβ; apply st_ifFalse
. -- tβ can take a step
... | 2 | 16 | true | Semantics |
272 | Imp.fold_constants_com_sound | theorem fold_constants_com_sound : ctrans_sound fold_constants_com | lean-formal-reasoning-program | Frap/Trans.lean | [
"import Frap.Exercises.Equiv",
"import Frap.Equiv"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax \"<[\" term \"]>\" : imp",
"content": "syntax \"<[\" term \"]>\" : imp\n\nsyntax \"<{\" imp \"}>\" : term\n\nsyntax \"false\" : imp\n\nsyntax \"false\" : term\n\nsyntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp\n\nsyntax \"true\" : imp\n\nsyntax \"true\" : term\n\nsynt... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "if_true",
"content": "theorem if_true b cβ cβ\n : bequiv b <{true}> β cequiv <{if <[b]> then <[cβ]> else <[cβ]> end}> cβ"
},
{
"name": "if_false",
"content": "theorem if_false b cβ cβ\n : bequiv b <{false}> β cequiv <{if <[b]> then <[cβ]> else <[cβ]> end}> cβ"
},
{
"name... | [
{
"name": "Imp.atrans_sound",
"content": "def atrans_sound (atrans : AExp β AExp) :=\n β (a : AExp), aequiv a (atrans a)"
},
{
"name": "Imp.btrans_sound",
"content": "def btrans_sound (btrans : BExp β BExp) :=\n β (b : BExp), bequiv b (btrans b)"
},
{
"name": "Imp.ctrans_sound",
"c... | [
{
"name": "Imp.while_true",
"content": "theorem while_true b c :\n bequiv b <{true}> β cequiv <{while <[b]> do <[c]> end}> loop"
},
{
"name": "Imp.sym_bequiv",
"content": "theorem sym_bequiv bβ bβ : bequiv bβ bβ β bequiv bβ bβ"
},
{
"name": "Imp.sym_cequiv",
"content": "theorem sy... | import Frap.Equiv
import Frap.Exercises.Equiv
namespace Imp
open AExp
open BExp
open Com
open CEval
def atrans_sound (atrans : AExp β AExp) :=
β (a : AExp), aequiv a (atrans a)
def btrans_sound (btrans : BExp β BExp) :=
β (b : BExp), bequiv b (btrans b)
def ctrans_sound (ctrans : Com β Com) :=
β (c : Com... | theorem fold_constants_com_sound : ctrans_sound fold_constants_com := | := by
intro c; induction c with simp [fold_constants_com]
| c_asgn =>
apply c_asgn_congruence
apply fold_constants_aexp_sound
| c_seq =>
apply c_seq_congruence <;> assumption
| c_if b cβ cβ ih1 ih2 =>
split
. apply trans_cequiv _ cβ
. apply if_true
rename_i heq; rw [β heq]
... | 5 | 40 | true | Semantics |
273 | CImp.par_loop_any_x | theorem par_loop_any_x n
: β st', Multi CStep (par_loop, empty) (c_skip, st')
β§ st' x = n | lean-formal-reasoning-program | Frap/SmallStepImp.lean | [
"import Frap.SmallStep",
"import Frap.Equiv"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "And",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : im",
"content": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp"
},
{
"name": "macro_rules",
"content": "macro_rules\n | `(term|true) => `(Bool.true)\n | `(term|false) => `(Bool.false)\n | `(te... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "multi_R",
"content": "theorem multi_R (X : Type) (R : relation X) x y : R x y β Multi R x y"
},
{
"name": "multi_trans",
"content": "theorem multi_trans (X : Type) (R : relation X) x y z\n : Multi R x y β Multi R y z β Multi R x z"
}
] | [
{
"name": "AVal",
"content": "inductive AVal : AExp β Prop :=\n | av_num : β n, AVal (a_num n)"
},
{
"name": "AStep",
"content": "inductive AStep (st : State) : AExp β AExp β Prop :=\n | as_id : β v, AStep st (a_id v) (a_num (st v))\n | as_plus1 : β aβ aβ' aβ,\n AStep st aβ aβ'\n β ... | [
{
"name": "CImp.par_body_n__Sn",
"content": "theorem par_body_n__Sn n st\n : st x = n β§ st y = 0\n β Multi CStep (par_loop, st) (par_loop, x !-> n + 1; st)"
},
{
"name": "CImp.par_body_n",
"content": "theorem par_body_n n st\n : st x = 0 β§ st y = 0\n β β st', Multi CStep (par_loo... | import Frap.Equiv
import Frap.SmallStep
open Imp
open AExp
open BExp
open Com
open Multi
inductive AVal : AExp β Prop :=
| av_num : β n, AVal (a_num n)
inductive AStep (st : State) : AExp β AExp β Prop :=
| as_id : β v, AStep st (a_id v) (a_num (st v))
| as_plus1 : β aβ aβ' aβ,
AStep st aβ aβ'
... | theorem par_loop_any_x n
: β st', Multi CStep (par_loop, empty) (c_skip, st')
β§ st' x = n := | := by
let h := par_body_n n empty
simp [empty] at h
obtain β¨st', β¨h', β¨hx, _β©β©β© := h
exists y !-> 1; st'
constructor
. apply multi_trans
. apply h'
. apply multi_step
. apply cs_par1; apply cs_asgn
. apply multi_step
. apply cs_par2; apply cs_while
. apply multi_step
... | 3 | 27 | true | Semantics |
274 | Imp.fold_constants_bexp_sound | theorem fold_constants_bexp_sound : btrans_sound fold_constants_bexp | lean-formal-reasoning-program | Frap/Trans.lean | [
"import Frap.Exercises.Equiv",
"import Frap.Equiv"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax \"<{\" imp \"}>\" : term",
"content": "syntax \"<{\" imp \"}>\" : term\n\nsyntax \"false\" : imp\n\nsyntax \"false\" : term\n\nsyntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp\n\nsyntax \"true\" : imp\n\nsyntax \"true\" : term"
},
{
"name": "macro_rules",
"... | [
{
"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": "Imp.atrans_sound",
"content": "def atrans_sound (atrans : AExp β AExp) :=\n β (a : AExp), aequiv a (atrans a)"
},
{
"name": "Imp.btrans_sound",
"content": "def btrans_sound (btrans : BExp β BExp) :=\n β (b : BExp), bequiv b (btrans b)"
},
{
"name": "Imp.fold_constants_aexp",... | [
{
"name": "Imp.fold_constants_aexp_sound",
"content": "theorem fold_constants_aexp_sound : atrans_sound fold_constants_aexp"
}
] | import Frap.Equiv
import Frap.Exercises.Equiv
namespace Imp
open AExp
open BExp
open Com
open CEval
def atrans_sound (atrans : AExp β AExp) :=
β (a : AExp), aequiv a (atrans a)
def btrans_sound (btrans : BExp β BExp) :=
β (b : BExp), bequiv b (btrans b)
def fold_constants_aexp (a : AExp) : AExp :=
match ... | theorem fold_constants_bexp_sound : btrans_sound fold_constants_bexp := | := by
intro b st; induction b with simp [fold_constants_bexp]
| b_eq a1 a2 =>
rw [fold_constants_aexp_sound a1, fold_constants_aexp_sound a2]
split
. rename_i hm
simp at hm
obtain β¨β© := hm
split <;> simp [*]
. rename_i hm
simp at hm
obtain β¨β© := hm
simp [*]
| b_... | 5 | 21 | true | Semantics |
275 | step_normalizing | theorem step_normalizing : normalizing Step | lean-formal-reasoning-program | Frap/SmallStep.lean | [] | [
{
"name": "Nat",
"module": "Init.Prelude"
}
] | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Tm",
"content": "inductive Tm : Type :=\n | c : Nat β Tm \n | p : Tm β Tm β Tm"
},
{
"name": "SimpleArith1.Step",
"content": "inductive Step : Tm β Tm β Prop :=\n | st_plusConstConst nβ nβ : Step (p (c nβ) (c nβ)) (c (nβ + nβ))\n | st_plus1 tβ tβ' tβ : Step tβ tβ' β Step (p ... | [
{
"name": "strong_progress",
"content": "theorem strong_progress t : Value t β¨ βt', Step t t'"
},
{
"name": "value_is_nf",
"content": "theorem value_is_nf v : Value v β normal_form Step v"
},
{
"name": "nf_is_value",
"content": "theorem nf_is_value t : normal_form Step t β Value t"
... | inductive Tm : Type :=
| c : Nat β Tm
| p : Tm β Tm β Tm
open Tm
open Eval
namespace SimpleArith1
inductive Step : Tm β Tm β Prop :=
| st_plusConstConst nβ nβ : Step (p (c nβ) (c nβ)) (c (nβ + nβ))
| st_plus1 tβ tβ' tβ : Step tβ tβ' β Step (p tβ tβ) (p tβ' tβ)
| st_plus2 nβ tβ tβ' : Step tβ tβ' ... | theorem step_normalizing : normalizing Step := | := by
unfold normalizing
intro t
induction t with
| c n =>
exists c n
constructor
. apply multi_refl
. rw [nf_same_as_value]; apply v_const
| p tβ tβ ihβ ihβ =>
obtain β¨tβ', β¨hsβ, hnββ©β© := ihβ
obtain β¨tβ', β¨hsβ, hnββ©β© := ihβ
rw [nf_same_as_value] at hnβ
rw [nf_same_as_value] at... | 3 | 17 | true | Semantics |
276 | Imp.optimize_0plus_com_sound | theorem optimize_0plus_com_sound : ctrans_sound optimize_0plus_com | lean-formal-reasoning-program | Frap/Exercises/Trans.lean | [
"import Frap.Trans"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax \"<{\" imp \"}>\" : term",
"content": "syntax \"<{\" imp \"}>\" : term\n\nsyntax:21 \"while\" imp:20 \"do\" imp:20 \"end\" : imp\n\nsyntax \"<[\" term \"]>\" : imp\n\nsyntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp\n\nsyntax \"false\" : imp\n\nsyntax \"false\" : term\... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "c_while_congruence",
"content": "theorem c_while_congruence b b' c c'\n : bequiv b b' β cequiv c c'\n β cequiv <{while <[b]> do <[c]> end}> <{while <[b']> do <[c']> end}>"
},
{
"name": "sym_bequiv",
"content": "theorem sym_bequiv bβ bβ : bequiv bβ bβ β bequiv bβ bβ"
},
{
... | [
{
"name": "Imp.optimize_0plus_aexp",
"content": "def optimize_0plus_aexp (a : AExp) : AExp :=\n match a with\n | a_num _ => a\n | a_id _ => a\n | a_plus (a_num 0) aβ => optimize_0plus_aexp aβ\n | a_plus aβ aβ => a_plus (optimize_0plus_aexp aβ) (optimize_0plus_aexp aβ)\n | a_minus aβ aβ => a_minus (opt... | [
{
"name": "Imp.optimize_0plus_aexp_sound",
"content": "theorem optimize_0plus_aexp_sound : atrans_sound optimize_0plus_aexp"
},
{
"name": "Imp.optimize_0plus_bexp_sound",
"content": "theorem optimize_0plus_bexp_sound : btrans_sound optimize_0plus_bexp"
}
] | import Frap.Trans
namespace Hidden.AExp
open AExp
end Hidden.AExp
namespace Imp
open AExp
open BExp
open Com
open CEval
def optimize_0plus_aexp (a : AExp) : AExp :=
match a with
| a_num _ => a
| a_id _ => a
| a_plus (a_num 0) aβ => optimize_0plus_aexp aβ
| a_plus aβ aβ => a_plus (optimize_0plus_aexp ... | theorem optimize_0plus_com_sound : ctrans_sound optimize_0plus_com := | := by
intros c
induction c with simp [*] at *
| c_skip => apply refl_cequiv
| c_asgn => apply c_asgn_congruence; apply optimize_0plus_aexp_sound
| c_seq =>
apply c_seq_congruence
. assumption
. assumption
| c_if =>
apply c_if_congruence
. apply optimize_0plus_bexp_sound
. assumption
... | 6 | 35 | false | Semantics |
277 | Tree.balance_BST | theorem balance_BST {Ξ± : Type u} c (l : Tree Ξ±) k vk (r : Tree Ξ±)
: ForallTree (fun x _ => x < k) l
-> ForallTree (fun x _ => x > k) r
-> BST l
-> BST r
-> BST (balance c l k vk r) | lean-formal-reasoning-program | Frap/RedBlack.lean | [] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
}
] | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Color",
"content": "inductive Color where\n | red\n | black"
},
{
"name": "Tree",
"content": "inductive Tree (Ξ± : Type u) where\n | empty : Tree Ξ±\n | tree (c: Color) (l : Tree Ξ±) (k : Nat) (v : Ξ±) (r : Tree Ξ±) : Tree Ξ±"
},
{
"name": "Tree.ex_tree",
"content": "def ex... | [
{
"name": "Tree.forallTree_imp",
"content": "theorem forallTree_imp {Ξ± : Type u} (P Q : Nat β Ξ± β Prop) t\n : ForallTree P t β (β k v, P k v β Q k v) β ForallTree Q t"
},
{
"name": "Tree.forallTree_lt",
"content": "theorem forallTree_lt {Ξ± : Type u} (t : Tree Ξ±) k k'\n : ForallTree (fun x ... | inductive Color where
| red
| black
inductive Tree (Ξ± : Type u) where
| empty : Tree Ξ±
| tree (c: Color) (l : Tree Ξ±) (k : Nat) (v : Ξ±) (r : Tree Ξ±) : Tree Ξ±
namespace Tree
open Color
def ex_tree : Tree String :=
tree black (tree red empty 2 "two" empty) 4 "four" (tree red empty 5 "five" empty)
def bala... | theorem balance_BST {Ξ± : Type u} c (l : Tree Ξ±) k vk (r : Tree Ξ±)
: ForallTree (fun x _ => x < k) l
-> ForallTree (fun x _ => x > k) r
-> BST l
-> BST r
-> BST (balance c l k vk r) := | := by
intro hlk hkr hbl hbr; simp
split
. constructor <;> assumption
. split
. -- we are in the case where `x` is left child of `y`
cases l <;> repeat simp [*] at *
rcases hbl with β¨β© | β¨_, _, _, _, _, hxy, hyc, hbx, hbcβ©
rcases hlk with β¨β© | β¨_, _, _, _, _, hyz, hxz, hzcβ©
rcases hbx... | 2 | 11 | true | Semantics |
278 | permutation_app_comm | theorem permutation_app_comm (l l' : List Ξ±)
: Permutation (l ++ l') (l' ++ l) | lean-formal-reasoning-program | Frap/Sort.lean | [] | [
{
"name": "List",
"module": "Init.Prelude"
}
] | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "append_assoc",
"content": "theorem append_assoc (as bs cs : List Ξ±)\n : (as ++ bs) ++ cs = as ++ (bs ++ cs)"
}
] | [
{
"name": "Permutation",
"content": "inductive Permutation {Ξ± : Type} : List Ξ± β List Ξ± β Prop :=\n | perm_nil : Permutation [] []\n | perm_skip x l l'\n : Permutation l l' β Permutation (x::l) (x::l')\n | perm_swap x y l : Permutation (y::x::l) (x::y::l)\n | perm_trans l l' l''\n : Permutatio... | [
{
"name": "permutation_refl",
"content": "theorem permutation_refl (l : List Ξ±) : Permutation l l"
},
{
"name": "permutation_symm",
"content": "theorem permutation_symm (l l' : List Ξ±)\n : Permutation l l' β Permutation l' l"
},
{
"name": "permutation_app_tail",
"content": "theore... | inductive Permutation {Ξ± : Type} : List Ξ± β List Ξ± β Prop :=
| perm_nil : Permutation [] []
| perm_skip x l l'
: Permutation l l' β Permutation (x::l) (x::l')
| perm_swap x y l : Permutation (y::x::l) (x::y::l)
| perm_trans l l' l''
: Permutation l l' β Permutation l' l''
β Permutation l l''... | theorem permutation_app_comm (l l' : List Ξ±)
: Permutation (l ++ l') (l' ++ l) := | := by
induction l with simp
| nil => apply permutation_refl
| cons a al ih =>
-- a :: (al ++ l')
-- al ++ l' ++ [a]
-- l' ++ al ++ [a]
-- l' ++ (al ++ [a])
-- l' ++ a :: al
apply perm_trans
. apply permutation_cons_append
. apply perm_trans
. apply permutation_app_tail; exact... | 2 | 8 | false | Semantics |
279 | Hidden.Nat.add_comm | theorem add_comm (m n : Nat) : m + n = n + m | lean-formal-reasoning-program | Frap/Inductive.lean | [] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Hidden.Nat",
"content": "inductive Nat where\n | zero : Nat\n | succ : Nat β Nat"
}
] | [
{
"name": "Hidden.Nat.add_zero",
"content": "theorem add_zero (m : Nat) : m + zero = m"
},
{
"name": "Hidden.Nat.add_succ",
"content": "theorem add_succ (m n : Nat) : m + succ n = succ (m + n)"
},
{
"name": "Hidden.Nat.zero_add",
"content": "theorem zero_add (n : Nat) : zero + n = n"... | section rewriting
variable (Ξ± : Type) (a b c d : Ξ±) -- a, b, c, d are elements of some type
/-
## Rewriting
Recall our equality proof from last time.
-/
example : a = b β c = b β c = d β a = d := by
intro hab hcb hcd
apply Eq.trans
. exact hab
. apply Eq.trans
. apply Eq.symm
exact hcb
. exac... | theorem add_comm (m n : Nat) : m + n = n + m := | := by
induction n with
| zero =>
rw [add_zero]
rw [zero_add]
| succ n' ih =>
rw [add_succ]
rw [ih]
rw [succ_add]
/-
Alternatively, if the supporting fact is only useful within a single theorem, we can embed the proof within, using the
-/
example (m n : Nat) : m + n = n + m := by
... | 1 | 5 | false | Semantics |
280 | Hidden.List.Palindrome.Palindrome_rev | theorem Palindrome_rev {Ξ± : Type} (l : List Ξ±)
: Palindrome l β l = reverse l | lean-formal-reasoning-program | Frap/Exercises/IndProp.lean | [] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Hidden.List",
"content": "inductive List (Ξ± : Type u) where\n | nil : List Ξ±\n | cons : Ξ± β List Ξ± β List Ξ±"
},
{
"name": "Hidden.List.reverse",
"content": "def reverse {Ξ± : Type u} (as : List Ξ±) : List Ξ± :=\n match as with\n | nil => nil\n | cons a as' => reverse as' ++ ... | [
{
"name": "Hidden.List.nil_append",
"content": "theorem nil_append (as : List Ξ±) : nil ++ as = as"
},
{
"name": "Hidden.List.cons_append",
"content": "theorem cons_append (a : Ξ±) (as bs : List Ξ±)\n : (cons a as) ++ bs = cons a (as ++ bs)"
},
{
"name": "Hidden.List.append_nil",
... | namespace Hidden
inductive List (Ξ± : Type u) where
| nil : List Ξ±
| cons : Ξ± β List Ξ± β List Ξ±
namespace List
def reverse {Ξ± : Type u} (as : List Ξ±) : List Ξ± :=
match as with
| nil => nil
| cons a as' => reverse as' ++ cons a nil
inductive Palindrome {Ξ± : Type} : List Ξ± β Prop where
| nil : Pali... | theorem Palindrome_rev {Ξ± : Type} (l : List Ξ±)
: Palindrome l β l = reverse l := | := by
intro lPal
induction lPal with
| nil => rfl
| single x => rfl
| sandwich x xs xsPal xsRev =>
rw [reverse_append, reverse, reverse, nil_append, reverse, βxsRev]
rw [cons_append, βappend_assoc, cons_append, nil_append, cons_append] | 2 | 8 | false | Semantics |
281 | Imp.Hoare.hoare_while | theorem hoare_while P b c :
{* fun st => P st β§ beval st b *} c {* P *}
β {* P *} c_while b c {* fun st => P st β§ Β¬(beval st b) *} | lean-formal-reasoning-program | Frap/Hoare.lean | [
"import Frap.Trans"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : im",
"content": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp\n\nsyntax \"false\" : imp\n\nsyntax \"false\" : term\n\nsyntax \"true\" : imp\n\nsyntax \"true\" : term\n\nsyntax \"<{\" imp \"}>\" : term\n\nsy... | [
{
"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 Frap.Trans
namespace Imp
open AExp
open BExp
open Com
open CEval
namespace Hoare
infix:36 " ->> " => assert_implies | theorem hoare_while P b c :
{* fun st => P st β§ beval st b *} c {* P *}
β {* P *} c_while b c {* fun st => P st β§ Β¬(beval st b) *} := | := by
intro hHoare st st' hPre hEval
-- we proceed by induction on `hEval`
generalize hloop : c_while b c = cmd at *
induction hEval with simp at *
| e_whileFalse =>
constructor
. exact hPre
. simp [*]
| e_whileTrue =>
simp [*] at *
rename_i ih
apply ih
apply hHoare
. constru... | 4 | 15 | true | Semantics |
282 | Tree.bst_insert_of_bst | theorem bst_insert_of_bst {Ξ± : Type u} (k : Nat) (v : Ξ±) (t : Tree Ξ±)
: BST t β BST (insert k v t) | lean-formal-reasoning-program | Frap/ADT.lean | [] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
}
] | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "Nat.le_antisymm",
"module": "Init.Prelude"
}
] | [
{
"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": "Tree",
"content": "inductive Tree (Ξ± : Type u) where\n | empty : Tree Ξ±\n | tree (l : Tree Ξ±) (k : Nat) (v : Ξ±) (r : Tree Ξ±) : Tree Ξ±"
},
{
"name": "Tree.ex_tree",
"content": "def ex_tree : Tree String :=\n tree (tree empty 2 \"two\" empty) 4 \"four\" (tree empty 5 \"five\" empty)... | [
{
"name": "Tree.forall_insert_of_forall",
"content": "theorem forall_insert_of_forall {Ξ± : Type u} (P : Nat β Ξ± β Prop) (t : Tree Ξ±)\n : ForallTree P t β β k v, P k v β ForallTree P (insert k v t)"
}
] | inductive Tree (Ξ± : Type u) where
| empty : Tree Ξ±
| tree (l : Tree Ξ±) (k : Nat) (v : Ξ±) (r : Tree Ξ±) : Tree Ξ±
namespace Tree
def ex_tree : Tree String :=
tree (tree empty 2 "two" empty) 4 "four" (tree empty 5 "five" empty)
def insert {Ξ± : Type u} (x : Nat) (v : Ξ±) (t : Tree Ξ±) : Tree Ξ± :=
match t with
| ... | theorem bst_insert_of_bst {Ξ± : Type u} (k : Nat) (v : Ξ±) (t : Tree Ξ±)
: BST t β BST (insert k v t) := | := by
intro hbst
induction hbst with
| empty => constructor <;> constructor
| tree l k' v' r hlt hgt hbstl hbstr =>
unfold insert
split
. constructor
. apply forall_insert_of_forall
. assumption
. assumption
. assumption
. assumption
. assumption
. split
... | 4 | 11 | false | Semantics |
283 | Hidden.List.Palindrome.Palindrome_app_rev | theorem Palindrome_app_rev {Ξ± : Type} (l : List Ξ±) : Palindrome (l ++ reverse l) | lean-formal-reasoning-program | Frap/Exercises/IndProp.lean | [] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Hidden.List",
"content": "inductive List (Ξ± : Type u) where\n | nil : List Ξ±\n | cons : Ξ± β List Ξ± β List Ξ±"
},
{
"name": "Hidden.List.reverse",
"content": "def reverse {Ξ± : Type u} (as : List Ξ±) : List Ξ± :=\n match as with\n | nil => nil\n | cons a as' => reverse as' ++ ... | [
{
"name": "Hidden.List.nil_append",
"content": "theorem nil_append (as : List Ξ±) : nil ++ as = as"
},
{
"name": "Hidden.List.cons_append",
"content": "theorem cons_append (a : Ξ±) (as bs : List Ξ±)\n : (cons a as) ++ bs = cons a (as ++ bs)"
},
{
"name": "Hidden.List.append_assoc",
... | namespace Hidden
inductive List (Ξ± : Type u) where
| nil : List Ξ±
| cons : Ξ± β List Ξ± β List Ξ±
namespace List
def reverse {Ξ± : Type u} (as : List Ξ±) : List Ξ± :=
match as with
| nil => nil
| cons a as' => reverse as' ++ cons a nil
inductive Palindrome {Ξ± : Type} : List Ξ± β Prop where
| nil : Pali... | theorem Palindrome_app_rev {Ξ± : Type} (l : List Ξ±) : Palindrome (l ++ reverse l) := | := by
induction l with
| nil => rw [nil_append, reverse]; exact nil
| cons x xs ih =>
rw [cons_append, reverse, βappend_assoc, βcons_append]
apply sandwich x
exact ih | 2 | 6 | false | Semantics |
284 | Hidden.Nat.mul_assoc | theorem mul_assoc (m n k : Nat) : m * n * k = m * (n * k) | lean-formal-reasoning-program | Frap/Inductive.lean | [] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Hidden.Nat",
"content": "inductive Nat where\n | zero : Nat\n | succ : Nat β Nat"
},
{
"name": "Hidden.Nat.add",
"content": "def add (m n : Nat) : Nat :=\n match n with\n | zero => m\n | succ n' => succ (add m n')"
}
] | [
{
"name": "Hidden.Nat.add_succ",
"content": "theorem add_succ (m n : Nat) : m + succ n = succ (m + n)"
},
{
"name": "Hidden.Nat.add_assoc",
"content": "theorem add_assoc (m n k : Nat) : m + n + k = m + (n + k)"
},
{
"name": "Hidden.Nat.mul_succ",
"content": "theorem mul_succ (m n : N... | section rewriting
variable (Ξ± : Type) (a b c d : Ξ±) -- a, b, c, d are elements of some type
/-
## Rewriting
Recall our equality proof from last time.
-/
example : a = b β c = b β c = d β a = d := by
intro hab hcb hcd
apply Eq.trans
. exact hab
. apply Eq.trans
. apply Eq.symm
exact hcb
. exac... | theorem mul_assoc (m n k : Nat) : m * n * k = m * (n * k) := | := by
induction k with
| zero => rfl
| succ k' ih =>
rw [mul_succ, mul_succ, ih, add_infix, add_infix]
have nat_distrib (m n k : Nat)
: m * n + m * k = m * (n + k) := by
-- distributive property from left
induction k with
| zero => rfl
| succ k' ih =>
... | 2 | 6 | false | Semantics |
285 | permutation_cons_app | theorem permutation_cons_app (l lβ lβ : List Ξ±)
: Permutation l (lβ ++ lβ)
β Permutation (a :: l) (lβ ++ a :: lβ) | lean-formal-reasoning-program | Frap/Sort.lean | [] | [
{
"name": "List",
"module": "Init.Prelude"
}
] | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "append_assoc",
"content": "theorem append_assoc (as bs cs : List Ξ±)\n : (as ++ bs) ++ cs = as ++ (bs ++ cs)"
}
] | [
{
"name": "Permutation",
"content": "inductive Permutation {Ξ± : Type} : List Ξ± β List Ξ± β Prop :=\n | perm_nil : Permutation [] []\n | perm_skip x l l'\n : Permutation l l' β Permutation (x::l) (x::l')\n | perm_swap x y l : Permutation (y::x::l) (x::y::l)\n | perm_trans l l' l''\n : Permutatio... | [
{
"name": "permutation_refl",
"content": "theorem permutation_refl (l : List Ξ±) : Permutation l l"
},
{
"name": "permutation_symm",
"content": "theorem permutation_symm (l l' : List Ξ±)\n : Permutation l l' β Permutation l' l"
},
{
"name": "permutation_app_head",
"content": "theore... | inductive Permutation {Ξ± : Type} : List Ξ± β List Ξ± β Prop :=
| perm_nil : Permutation [] []
| perm_skip x l l'
: Permutation l l' β Permutation (x::l) (x::l')
| perm_swap x y l : Permutation (y::x::l) (x::y::l)
| perm_trans l l' l''
: Permutation l l' β Permutation l' l''
β Permutation l l''... | theorem permutation_cons_app (l lβ lβ : List Ξ±)
: Permutation l (lβ ++ lβ)
β Permutation (a :: l) (lβ ++ a :: lβ) := | := by
intro h
-- a :: l
-- a :: (lβ ++ lβ)
-- lβ ++ lβ ++ [a]
-- lβ ++ (lβ ++ [a])
-- lβ ++ a :: lβ
apply perm_trans
. apply perm_skip; exact h
. apply perm_trans
. apply permutation_cons_append
. rw [List.append_assoc]
apply permutation_app_head
apply permutation_symm
apply ... | 2 | 7 | false | Semantics |
286 | TM.soundness | theorem soundness t t' T
: HasType t T β multistep t t' β Β¬ stuck t' | lean-formal-reasoning-program | Frap/Types.lean | [
"import Frap.SmallStep"
] | [
{
"name": "And",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax term \"==>\" term : term",
"content": "syntax term \"==>\" term : term\n\nsyntax term \"~~>\" term : term\n\nsyntax term \"~~>*\" term : term\n\nsyntax:30 term \" =[ \" imp \" ]=> \" term : term\n\nsyntax term \"!->\" term \"; \" term : term\n\nsyntax:36 term \"<<->>\" term : term"
},
... | [
{
"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": "TM.Tm",
"content": "inductive Tm : Type :=\n | tru : Tm\n | fls : Tm\n | ite : Tm β Tm β Tm β Tm\n | zro : Tm\n | scc : Tm β Tm\n | prd : Tm β Tm\n | iszero : Tm β Tm"
},
{
"name": "TM.BValue",
"content": "inductive BValue : Tm β Prop :=\n | bv_true : BValue tru\n | bv_false ... | [
{
"name": "TM.bool_canonical",
"content": "theorem bool_canonical t : HasType t bool β value t β BValue t"
},
{
"name": "TM.nat_canonical",
"content": "theorem nat_canonical t : HasType t nat β value t β NValue t"
},
{
"name": "TM.progress",
"content": "theorem progress t T\n : Ha... | import Frap.SmallStep
namespace TM
inductive Tm : Type :=
| tru : Tm
| fls : Tm
| ite : Tm β Tm β Tm β Tm
| zro : Tm
| scc : Tm β Tm
| prd : Tm β Tm
| iszero : Tm β Tm
open Tm
inductive BValue : Tm β Prop :=
| bv_true : BValue tru
| bv_false : BValue fls
inductive NValue : Tm β Prop :=
| nv_0 :... | theorem soundness t t' T
: HasType t T β multistep t t' β Β¬ stuck t' := | := by
intro hT P
induction P with (intro contra; obtain β¨R, Sβ© := contra)
| multi_refl =>
cases (progress _ _ hT)
. -- value
simp [*] at *
. -- step
simp [step_normal_form, normal_form, *] at *
| multi_step =>
rename_i ih; apply ih
. apply preservation
. apply hT
. as... | 4 | 26 | false | Semantics |
287 | CImp.par_body_n | theorem par_body_n n st
: st x = 0 β§ st y = 0
β β st', Multi CStep (par_loop, st) (par_loop, st')
β§ st' x = n β§ st' y = 0 | lean-formal-reasoning-program | Frap/SmallStepImp.lean | [
"import Frap.SmallStep",
"import Frap.Equiv"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "And",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : im",
"content": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp"
},
{
"name": "macro_rules",
"content": "macro_rules\n | `(term|true) => `(Bool.true)\n | `(term|false) => `(Bool.false)\n | `(te... | [
{
"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": "AVal",
"content": "inductive AVal : AExp β Prop :=\n | av_num : β n, AVal (a_num n)"
},
{
"name": "AStep",
"content": "inductive AStep (st : State) : AExp β AExp β Prop :=\n | as_id : β v, AStep st (a_id v) (a_num (st v))\n | as_plus1 : β aβ aβ' aβ,\n AStep st aβ aβ'\n β ... | [
{
"name": "CImp.par_body_n__Sn",
"content": "theorem par_body_n__Sn n st\n : st x = n β§ st y = 0\n β Multi CStep (par_loop, st) (par_loop, x !-> n + 1; st)"
}
] | import Frap.Equiv
import Frap.SmallStep
open Imp
open AExp
open BExp
open Com
open Multi
inductive AVal : AExp β Prop :=
| av_num : β n, AVal (a_num n)
inductive AStep (st : State) : AExp β AExp β Prop :=
| as_id : β v, AStep st (a_id v) (a_num (st v))
| as_plus1 : β aβ aβ' aβ,
AStep st aβ aβ'
... | theorem par_body_n n st
: st x = 0 β§ st y = 0
β β st', Multi CStep (par_loop, st) (par_loop, st')
β§ st' x = n β§ st' y = 0 := | := by
intro h
obtain β¨hx, hyβ© := h
induction n with
| zero =>
exists st
apply And.intro
. apply multi_refl
. apply And.intro
. apply hx
. apply hy
| succ n' hn' =>
obtain β¨st', β¨h', β¨hx', hy'β©β©β© := hn'
constructor
apply And.intro
. apply multi_tr... | 3 | 24 | false | Semantics |
288 | Imp.Hoare.hoare_if | theorem hoare_if P Q b cβ cβ :
{* fun st => P st β§ beval st b *} cβ {* Q *}
β {* fun st => P st β§ Β¬(beval st b) *} cβ {* Q *}
β {* P *} c_if b cβ cβ {* Q *} | lean-formal-reasoning-program | Frap/Hoare.lean | [
"import Frap.Trans"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": "Bool",
"module": "Init.Prelude"
}
] | [
{
"name": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : im",
"content": "syntax:21 \"if\" imp:20 \"then\" imp:20 \"else\" imp:20 \"end\" : imp\n\nsyntax \"false\" : imp\n\nsyntax \"false\" : term\n\nsyntax \"true\" : imp\n\nsyntax \"true\" : term\n\nsyntax \"<{\" imp \"}>\" : term\n\nsy... | [
{
"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": "Imp.Hoare.Assertion",
"content": "abbrev Assertion := State β Prop"
},
{
"name": "Imp.Hoare.assert_implies",
"content": "def assert_implies (P Q : Assertion) : Prop :=\n β st, P st β Q st"
},
{
"name": "Imp.Hoare.valid_hoare_triple",
"content": "def valid_hoare_triple (P ... | [
{
"name": "Imp.Hoare.hoare_asgn",
"content": "theorem hoare_asgn Q x a :\n {* fun st => Q (st[x β¦ aeval st a]) *} c_asgn x a {* Q *}"
},
{
"name": "Imp.Hoare.hoare_consequence_pre",
"content": "theorem hoare_consequence_pre P P' Q c :\n {* P' *} c {* Q *}\n β P ->> P'\n β {* P *} c {... | import Frap.Trans
namespace Imp
open AExp
open BExp
open Com
open CEval
namespace Hoare
abbrev Assertion := State β Prop
def assert_implies (P Q : Assertion) : Prop :=
β st, P st β Q st
infix:36 " ->> " => assert_implies
def valid_hoare_triple (P : Assertion) (c : Com) (Q : Assertion) : Prop :=
β st st', ... | theorem hoare_if P Q b cβ cβ :
{* fun st => P st β§ beval st b *} cβ {* Q *}
β {* fun st => P st β§ Β¬(beval st b) *} cβ {* Q *}
β {* P *} c_if b cβ cβ {* Q *} := | := by
intro hTrue hFalse st st' hPre hEval
cases hEval
. -- e_ifTrue
rename_i hb hcβ
apply hTrue
. constructor
. exact hPre
. exact hb
. exact hcβ
. -- e_ifFalse
rename_i hb hcβ
apply hFalse
. constructor
. exact hPre
. simp [hb]
. exact hcβ
example :
... | 4 | 21 | false | Semantics |
289 | Hidden.List.reverse_append | theorem reverse_append {Ξ± : Type u} (as bs : List Ξ±)
: reverse (as ++ bs) = reverse bs ++ reverse as | lean-formal-reasoning-program | Frap/Exercises/IndProp.lean | [] | [
{
"name": "structure BitVec (w : Nat) where",
"module": ""
},
{
"name": "/-- Construct a `BitVec w` from a number less than `2^w`.",
"module": ""
},
{
"name": "O(1), because we use `Fin` as the internal representation of a bitvector. -/",
"module": ""
},
{
"name": "ofFin ::",... | [
{
"name": "...",
"content": "..."
}
] | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "Hidden.List",
"content": "inductive List (Ξ± : Type u) where\n | nil : List Ξ±\n | cons : Ξ± β List Ξ± β List Ξ±"
},
{
"name": "Hidden.List.reverse",
"content": "def reverse {Ξ± : Type u} (as : List Ξ±) : List Ξ± :=\n match as with\n | nil => nil\n | cons a as' => reverse as' ++ ... | [
{
"name": "Hidden.List.nil_append",
"content": "theorem nil_append (as : List Ξ±) : nil ++ as = as"
},
{
"name": "Hidden.List.cons_append",
"content": "theorem cons_append (a : Ξ±) (as bs : List Ξ±)\n : (cons a as) ++ bs = cons a (as ++ bs)"
},
{
"name": "Hidden.List.append_nil",
... | namespace Hidden
inductive List (Ξ± : Type u) where
| nil : List Ξ±
| cons : Ξ± β List Ξ± β List Ξ±
namespace List
def reverse {Ξ± : Type u} (as : List Ξ±) : List Ξ± :=
match as with
| nil => nil
| cons a as' => reverse as' ++ cons a nil | theorem reverse_append {Ξ± : Type u} (as bs : List Ξ±)
: reverse (as ++ bs) = reverse bs ++ reverse as := | := by
induction as with
| nil =>
rw [nil_append, reverse, append_nil]
| cons a as' ih =>
rw [cons_append, reverse, reverse, ih, append_assoc] | 2 | 7 | false | Semantics |
290 | and_associative | theorem and_associative (p q r : Prop) : (p β§ q) β§ r β p β§ (q β§ r) | lean-formal-reasoning-program | Frap/Propositional.lean | [] | [
{
"name": "Iff",
"module": "Init.Core"
}
] | [
{
"name": "Iff",
"content": "inductive Iff : Prop β Prop β Prop where\n | intro : (a β b) β (b β a) β Iff a b"
}
] | [
{
"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": "and_commutative",
"content": "theorem and_commutative (p q : Prop) : p β§ q β q β§ p"
}
] | import Mathlib.Computability.NFA
import Mathlib.Data.FinEnum
import Mathlib.Data.Rel
import Mathlib.Data.Vector.Basic
import Blase.AutoStructs.ForLean
open Set
open Mathlib
open SetRel
-- this is better because card is defeq to n
instance (Ξ± : Type) : Inter (Language Ξ±) := β¨Set.interβ©
instance (Ξ± : Type) : Union (Lan... | theorem and_associative (p q r : Prop) : (p β§ q) β§ r β p β§ (q β§ r) := | := by
constructor
. intro h
cases h with
| intro hpq hr =>
cases hpq with
| intro hp hq =>
apply And.intro
. exact hp
. apply And.intro
. exact hq
. exact hr
. intro h
cases h with
| intro hp hqr =>
cases hqr with
| intro hq hr =>... | 2 | 3 | false | Semantics |
291 | While.WellTyped.some_ty | theorem WellTyped.some_ty {e ty} : e.ty = some ty β WellTyped e ty | lean-hoare | Hoare/While/Types.lean | [
"import Hoare.While.Syntax"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "bool",
"module": "Init.Control.Basic"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.isSome",
"module": "Init.Data.Option.Basi... | [
{
"name": "syntax num : nexpr",
"content": "syntax num : nexpr\n\nsyntax \"if \" bexpr \" then \" com \" else \" com \" fi\" : com"
},
{
"name": "macro_rules",
"content": "macro_rules\n| `([nexpr| $n:num]) => `(Expr.num $n)\n| `([nexpr| $x:ident]) => `(Expr.var $(Lean.quote x.getId.toString))\n|... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "While.Ty",
"content": "inductive Ty\n| num : Ty\n| bool : Ty\nderiving Repr, DecidableEq"
},
{
"name": "While.WellTyped",
"content": "inductive WellTyped : Expr β Ty β Prop\n| num : WellTyped (Expr.num _) Ty.num\n| bool : WellTyped (Expr.bool _) Ty.bool\n| add : β e1 e2, WellTyped e1 ... | [
{
"name": "While.WellTyped.ty_some",
"content": "theorem WellTyped.ty_some {e ty} : WellTyped e ty β e.ty = some ty"
}
] | import Hoare.While.Syntax
namespace While
inductive Ty
| num : Ty
| bool : Ty
deriving Repr, DecidableEq
inductive WellTyped : Expr β Ty β Prop
| num : WellTyped (Expr.num _) Ty.num
| bool : WellTyped (Expr.bool _) Ty.bool
| add : β e1 e2, WellTyped e1 Ty.num β WellTyped e2 Ty.num β
WellTyped (Expr.add e1 e2) Ty... | theorem WellTyped.some_ty {e ty} : e.ty = some ty β WellTyped e ty := | := by
intro h
induction e generalizing ty <;> simp_all [Expr.ty]
case num _ => rw [β h]; exact WellTyped.num
case bool _ => rw [β h]; exact WellTyped.bool
case add e1 e2 ih_e1 ih_e2 =>
have h' := h.2.symm; subst h'; exact WellTyped.add e1 e2 ih_e1 ih_e2
case sub e1 e2 ih_e1 ih_e2 =>
have h' := h.2.s... | 3 | 13 | false | Semantics |
292 | While.WellTyped.ty_some | theorem WellTyped.ty_some {e ty} : WellTyped e ty β e.ty = some ty | lean-hoare | Hoare/While/Types.lean | [
"import Hoare.While.Syntax"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "bool",
"module": "Init.Control.Basic"
},
{
"name": "Option",
"module": "Init.Prelude"
},
{
"name": "Option.isSome",
"module": "Init.Data.Option.Basi... | [
{
"name": "syntax num : nexpr",
"content": "syntax num : nexpr\n\nsyntax \"if \" bexpr \" then \" com \" else \" com \" fi\" : com"
},
{
"name": "macro_rules",
"content": "macro_rules\n| `([nexpr| $n:num]) => `(Expr.num $n)\n| `([nexpr| $x:ident]) => `(Expr.var $(Lean.quote x.getId.toString))\n|... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [
{
"name": "While.Ty",
"content": "inductive Ty\n| num : Ty\n| bool : Ty\nderiving Repr, DecidableEq"
},
{
"name": "While.WellTyped",
"content": "inductive WellTyped : Expr β Ty β Prop\n| num : WellTyped (Expr.num _) Ty.num\n| bool : WellTyped (Expr.bool _) Ty.bool\n| add : β e1 e2, WellTyped e1 ... | [] | import Hoare.While.Syntax
namespace While
inductive Ty
| num : Ty
| bool : Ty
deriving Repr, DecidableEq
inductive WellTyped : Expr β Ty β Prop
| num : WellTyped (Expr.num _) Ty.num
| bool : WellTyped (Expr.bool _) Ty.bool
| add : β e1 e2, WellTyped e1 Ty.num β WellTyped e2 Ty.num β
WellTyped (Expr.add e1 e2) Ty... | theorem WellTyped.ty_some {e ty} : WellTyped e ty β e.ty = some ty := | :=
by
intro h
induction h
case num => rfl
case bool => rfl
case add _ _ h1 h2 => simp [Expr.ty, h1, h2]
case sub _ _ h1 h2 => simp [Expr.ty, h1, h2]
case mul _ _ h1 h2 => simp [Expr.ty, h1, h2]
case eq e1 _ _ h1 h2 => simp [Expr.ty, h1, h2]
case lt _ _ h1 h2 => simp [Expr.ty, h1, h... | 4 | 13 | false | Semantics |
293 | While.WellTyped.not_eq_not_eq_ty | theorem WellTyped.not_eq_not_eq_ty {e1 e2 : Expr} {t1 t2 : Ty} :
WellTyped e1 t1 β WellTyped e2 t2 β t1 β t2 β β t, Β¬ (WellTyped (Expr.eq e1 e2) t) | lean-hoare | Hoare/While/Types.lean | [
"import Hoare.While.Syntax"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "bool",
"module": "Init.Control.Basic"
}
] | [
{
"name": "Expr",
"content": "inductive Expr\n| num : Nat β Expr\n| bool : Bool β Expr\n| var : String β Expr\n| add : Expr β Expr β Expr\n| sub : Expr β Expr β Expr\n| mul : Expr β Expr β Expr\n| eq : Expr β Expr β Expr\n| lt : Expr β Expr β Expr\n| gt : Expr β Expr β Expr\n| le : Expr β Expr β Expr\n| ge ... | [
{
"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": "While.Ty",
"content": "inductive Ty\n| num : Ty\n| bool : Ty\nderiving Repr, DecidableEq"
},
{
"name": "While.WellTyped",
"content": "inductive WellTyped : Expr β Ty β Prop\n| num : WellTyped (Expr.num _) Ty.num\n| bool : WellTyped (Expr.bool _) Ty.bool\n| add : β e1 e2, WellTyped e1 ... | [
{
"name": "While.WellTyped.unique",
"content": "theorem WellTyped.unique : β {e t1 t2}, WellTyped e t1 β WellTyped e t2 β t1 = t2"
}
] | import Hoare.While.Syntax
namespace While
inductive Ty
| num : Ty
| bool : Ty
deriving Repr, DecidableEq | theorem WellTyped.not_eq_not_eq_ty {e1 e2 : Expr} {t1 t2 : Ty} :
WellTyped e1 t1 β WellTyped e2 t2 β t1 β t2 β β t, Β¬ (WellTyped (Expr.eq e1 e2) t) := | := by
intro h1 h2 h3 t h4
cases h4
Β· case eq t h1' h2' =>
have ht1 : t1 = t := WellTyped.unique h1 h1'
have ht2 : t2 = t := WellTyped.unique h2 h2'
rw [ht1, ht2] at h3
contradiction | 2 | 6 | false | Semantics |
294 | While.WellTyped.not_welltyped_not_eq_ty | theorem WellTyped.not_welltyped_not_eq_ty {e1 e2 : Expr} {t : Ty} :
WellTyped e1 t β Β¬ WellTyped e2 t β β t', Β¬ (WellTyped (Expr.eq e1 e2) t') | lean-hoare | Hoare/While/Types.lean | [
"import Hoare.While.Syntax"
] | [
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "bool",
"module": "Init.Control.Basic"
}
] | [
{
"name": "Expr",
"content": "inductive Expr\n| num : Nat β Expr\n| bool : Bool β Expr\n| var : String β Expr\n| add : Expr β Expr β Expr\n| sub : Expr β Expr β Expr\n| mul : Expr β Expr β Expr\n| eq : Expr β Expr β Expr\n| lt : Expr β Expr β Expr\n| gt : Expr β Expr β Expr\n| le : Expr β Expr β Expr\n| ge ... | [
{
"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": "While.Ty",
"content": "inductive Ty\n| num : Ty\n| bool : Ty\nderiving Repr, DecidableEq"
},
{
"name": "While.WellTyped",
"content": "inductive WellTyped : Expr β Ty β Prop\n| num : WellTyped (Expr.num _) Ty.num\n| bool : WellTyped (Expr.bool _) Ty.bool\n| add : β e1 e2, WellTyped e1 ... | [
{
"name": "While.WellTyped.unique",
"content": "theorem WellTyped.unique : β {e t1 t2}, WellTyped e t1 β WellTyped e t2 β t1 = t2"
}
] | import Hoare.While.Syntax
namespace While
inductive Ty
| num : Ty
| bool : Ty
deriving Repr, DecidableEq | theorem WellTyped.not_welltyped_not_eq_ty {e1 e2 : Expr} {t : Ty} :
WellTyped e1 t β Β¬ WellTyped e2 t β β t', Β¬ (WellTyped (Expr.eq e1 e2) t') := | := by
intro h1 h2 t' h3
cases h3
Β· case eq t' h1' h2' =>
have ht : t = t' := WellTyped.unique h1 h1'
apply h2
rw [ht]
exact h2' | 2 | 6 | false | Semantics |
295 | processOneElem_spec | omit [Fintype S] in
lemma processOneElem_spec {st : worklist.St A S} (s : State) (sa : S) (k : β) :
β a sa', (f sa)[k]? = some (a, sa') β
processOneElem_mot inits final f s sa k st β
processOneElem_mot inits final f s sa (k+1) (processOneElem A S final s st (a, sa')) | lean-mlir | Blase/Blase/AutoStructs/Worklist.lean | [
"import Blase.Blase.AutoStructs.Basic",
"import Blase.Blase.AutoStructs.ForLean",
"import Blase.AutoStructs.Basic"
] | [
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "BEq",
"module": "Init.Prelude"
},
{
"name": "DecidableEq",
"module": "Init.Prelude"
},
{
"name": "FinEnum",
"module": "Mathlib.Data.FinEnum"
},
{
"name": "Hashable",
"module": "Init.Prelude"
},
{
... | [
{
"name": "RawCNFA.statesFinset",
"content": "instance RawCNFA.statesFinset (m : RawCNFA A) : Fintype m.states := (Finset.range m.stateMax).fintypeCoeSort"
},
{
"name": "State",
"content": "abbrev State := Nat"
},
{
"name": "RawCNFA.WF",
"content": "structure RawCNFA.WF (m : RawCNFA ... | [
{
"name": "Std.HashMap.getElem?_insert",
"module": "Std.Data.HashMap.Lemmas"
},
{
"name": "getElem?_eq_none_iff",
"module": "Init.GetElem"
},
{
"name": "Set.mem_setOf_eq",
"module": "Mathlib.Data.Set.Operations"
},
{
"name": "true_and",
"module": "Init.SimpLemmas"
},
... | [
{
"name": "Std.HashMap.get?_none_not_mem",
"content": "@[aesop 50% unsafe]\ntheorem Std.HashMap.get?_none_not_mem [BEq K] [LawfulBEq K] [Hashable K] [LawfulHashable K] {m : Std.HashMap K V} {k : K} : m.get? k = none β k β m"
},
{
"name": "Std.HashMap.mem_of_getElem?",
"content": "@[aesop 50% uns... | [
{
"name": "nfa",
"content": "def nfa : NFA A S where\n start := { sa | sa β inits }\n accept := { sa | final sa }\n step sa a := { sa' | (a, sa') β f sa }"
},
{
"name": "worklist.St",
"content": "structure worklist.St where\n m : RawCNFA A\n map : Std.HashMap S State := β
\n worklist : Arra... | [
{
"name": "addOrCreate_preserves_map",
"content": "omit [Fintype S] [LawfulBEq A] in\nlemma addOrCreate_preserves_map (st : worklist.St A S) (final? : Bool) (sa sa' : S) :\n let (_, st') := st.addOrCreateState _ _ final? sa'\n st.map[sa]? = some s β\n st'.map[sa]? = some s"
},
{
"name": "p... | import Blase.AutoStructs.Basic
open SetRel
section nfa
variable {A : Type} [BEq A] [LawfulBEq A] [Hashable A] [DecidableEq A] [FinEnum A]
variable {S : Type} [Fintype S] [BEq S] [LawfulBEq S] [Hashable S] [DecidableEq S]
variable (inits : Array S) (final : S β Bool) (f : S β Array (A Γ S))
def nfa : NFA A S where... | omit [Fintype S] in
lemma processOneElem_spec {st : worklist.St A S} (s : State) (sa : S) (k : β) :
β a sa', (f sa)[k]? = some (a, sa') β
processOneElem_mot inits final f s sa k st β
processOneElem_mot inits final f s sa (k+1) (processOneElem A S final s st (a, sa')) := | := by
intro a sa' hf β¨hmap, hvisited, inv, hsimβ©
have hmem : β s (sa : S), st.map[sa]? = some s β s β st.m.states := by intros; apply inv.map_states; assumption
have hwf : st.m.WF := by apply inv.wf
have inv' := processOneElem_inv inits final f s sa k a sa' hf β¨hmap, hvisited, inv, hsimβ©
unfold processOneElem... | 5 | 79 | false | Compiler |
296 | formula_language_case_atom | lemma formula_language_case_atom :
let Ο := Formula.atom rel t1 t2
Ο.language = Ξ» (bvs : BitVecs Ο.arity) => Ο.sat (fun k => bvs.bvs.get k) | lean-mlir | Blase/Blase/AutoStructs/Defs.lean | [
"import Blase.SingleWidth.Defs",
"import Blase.Blase.AutoStructs.ForMathlib",
"import Blase.AutoStructs.ForMathlib"
] | [
{
"name": "Fin",
"module": "Init.Prelude"
},
{
"name": "Fin.last",
"module": "Init.Data.Fin.Basic"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "Fin.castLE",
"module": "Init.Data.Fin.Basic"
},
{
"name": "BitVec",
"module": "Init.Prelude"
},
{
... | [
{
"name": "syntax \"max\" : MLIR.Pretty.uniform_op",
"content": "syntax \"max\" : MLIR.Pretty.uniform_op"
},
{
"name": "macro_rules",
"content": "macro_rules\n | `(mlir_op| $res:mlir_op_operand = const ($x)\n $[: $outer_type]? ) => do\n let outer_type β outer_type.getDM `(mlir_type| _... | [
{
"name": "Nat.add_comm",
"module": "Init.Data.Nat.Basic"
},
{
"name": "Fin.val_last",
"module": "Init.Data.Fin.Lemmas"
},
{
"name": "Nat.mod_eq_of_lt",
"module": "Init.Data.Nat.Div.Basic"
},
{
"name": "Set.mem_setOf_eq",
"module": "Mathlib.Data.Set.Operations"
},
{
... | [
{
"name": "List.Vector.append_get_ge",
"content": "@[simp]\nlemma List.Vector.append_get_ge {x : List.Vector Ξ± n} {y : List.Vector Ξ± m} {i : Fin (n+m)} (hlt: n β€ i) :\n (x ++ y).get i = y.get ((i.cast (Nat.add_comm n m) |>.subNat n hlt))"
},
{
"name": "List.Vector.append_get_lt",
"content": "... | [
{
"name": "liftMaxSucc1",
"content": "def liftMaxSucc1 (n m : Nat) : Fin (n + 1) β Fin (max n m + 2) :=\n fun k => if _ : k = n then Fin.last (max n m) else k.castLE (by admit /- proof elided -/\n )"
},
{
"name": "liftMaxSucc2",
"content": "def liftMaxSucc2 (n m : Nat) : Fin (m + 1) β Fin (max... | [
{
"name": "evalFin_eq",
"content": "lemma evalFin_eq {t : Term} {vars1 : Fin t.arity β BitVec w1} {vars2 : Fin t.arity β BitVec w2} :\n β (heq : w1 = w2),\n (β n, vars1 n = heq βΈ vars2 n) β\n t.evalFinBV vars1 = heq βΈ t.evalFinBV vars2"
},
{
"name": "evalRelation_coe",
"content": "@[sim... | import Blase.AutoStructs.ForMathlib
import Blase.SingleWidth.Defs
open Fin.NatCast
def liftMaxSucc1 (n m : Nat) : Fin (n + 1) β Fin (max n m + 2) :=
fun k => if _ : k = n then Fin.last (max n m) else k.castLE (by admit /- proof elided -/
)
def liftMaxSucc2 (n m : Nat) : Fin (m + 1) β Fin (max n m + 2) :=
fun ... | lemma formula_language_case_atom :
let Ο := | := Formula.atom rel t1 t2
Ο.language = Ξ» (bvs : BitVecs Ο.arity) => Ο.sat (fun k => bvs.bvs.get k) := by
unfold Formula.language
rintro Ο
let n := Ο.arity
unfold Ο
dsimp (config := { zeta := false })
lift_lets
intros l1 l2 lrel l
ext bvs
constructor
Β· intros h; simp at h
obtain β¨bvsb, h, heq... | 5 | 73 | false | Compiler |
297 | TermBinop.alt_lang | lemma TermBinop.alt_lang {tβ tβ : Term} (op : TermBinop) :
(op.subst_arity' βΈ (op.subst tβ tβ).language) =
let lop : Set (BitVecs 3) := op.openTerm_arity βΈ op.openTerm.language
let lop' : Set (BitVecs ((tβ.arity β tβ.arity) + 3)) := lop.lift (liftLast3 (max tβ.arity tβ.arity))
let lβ := tβ.language.lift (... | lean-mlir | Blase/Blase/AutoStructs/FormulaToAuto.lean | [
"import Blase.SingleWidth.Defs",
"import Blase.AutoStructs.Constructions",
"import Blase.Blase.Fast.BitStream",
"import Mathlib.Data.Nat.Size -- TODO: remove and get rid of shiftLeft_eq_mul_pow use",
"import Blase.Blase.AutoStructs.ForMathlib",
"import Blase.AutoStructs.Defs",
"import Mathlib.Tactic.Fin... | [
{
"name": "Inhabited",
"module": "Init.Prelude"
},
{
"name": "Lean.ToExpr",
"module": "Lean.ToExpr"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "Repr",
"module": "Init.Data.Repr"
},
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name": ... | [
{
"name": "syntax \"xor\" : MLIR.Pretty.uniform_op",
"content": "syntax \"xor\" : MLIR.Pretty.uniform_op\n\nsyntax \"max\" : MLIR.Pretty.uniform_op"
},
{
"name": "macro_rules",
"content": "macro_rules\n | `(mlir_op| $res:mlir_op_operand = const ($x)\n $[: $outer_type]? ) => do\n let o... | [
{
"name": "Nat.add_comm",
"module": "Init.Data.Nat.Basic"
},
{
"name": "Fin.add_def",
"module": "Init.Data.Fin.Lemmas"
},
{
"name": "Fin.castLE_castLE",
"module": "Init.Data.Fin.Lemmas"
},
{
"name": "Nat.le_of_eq",
"module": "Init.Data.Nat.Basic"
},
{
"name": "Nat... | [
{
"name": "List.Vector.append_get_ge",
"content": "@[simp]\nlemma List.Vector.append_get_ge {x : List.Vector Ξ± n} {y : List.Vector Ξ± m} {i : Fin (n+m)} (hlt: n β€ i) :\n (x ++ y).get i = y.get ((i.cast (Nat.add_comm n m) |>.subNat n hlt))"
},
{
"name": "List.Vector.append_get_lt",
"content": "... | [
{
"name": "liftOp",
"content": "def liftOp n : Fin (n + 1) β Fin (n + 3) :=\n fun k =>\n if k = n then Fin.last (n+2) else k.castLE (by admit /- proof elided -/\n )"
},
{
"name": "liftOp_unchanged",
"content": "@[simp]\ndef liftOp_unchanged (k : Fin n) : liftOp n k.castSucc = k.castLE (by... | [
{
"name": "TermBinop.subst_arity'",
"content": "lemma TermBinop.subst_arity' {op : TermBinop} : (op.subst tβ tβ).arity + 1= tβ.arity β tβ.arity + 1"
},
{
"name": "BitVecs.cast_eq",
"content": "@[simp]\nlemma BitVecs.cast_eq (x : BitVecs n) (h : n = n') : h βΈ x = x.cast h"
}
] | import Batteries.Data.Fin.Basic
import Batteries.Data.Fin.Lemmas
import Blase.SingleWidth.Defs
import Blase.AutoStructs.Constructions
import Blase.AutoStructs.Defs
import Blase.AutoStructs.FiniteStateMachine
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Size -- TODO: remove and get rid of shiftLeft_eq_mul_p... | lemma TermBinop.alt_lang {tβ tβ : Term} (op : TermBinop) :
(op.subst_arity' βΈ (op.subst tβ tβ).language) =
let lop : Set (BitVecs 3) := | := op.openTerm_arity βΈ op.openTerm.language
let lop' : Set (BitVecs ((tβ.arity β tβ.arity) + 3)) := lop.lift (liftLast3 (max tβ.arity tβ.arity))
let lβ := tβ.language.lift (liftMaxSuccSucc1 tβ.arity tβ.arity)
let lβ := tβ.language.lift (liftMaxSuccSucc2 tβ.arity tβ.arity)
let l := lβ β© lβ β© lop'
l.p... | 4 | 57 | false | Compiler |
298 | Predicate.eval_eq_denote | theorem Predicate.eval_eq_denote (w : Nat) (p : Predicate) (vars : List (BitVec w)) :
(p.eval (vars.map .ofBitVecSext) w = false) β p.denote w vars | lean-mlir | Blase/Blase/Fast/Defs.lean | [
"import Blase.SingleWidth.Defs",
"import Mathlib.Data.Fin.Basic",
"import Mathlib.Data.Bool.Basic",
"import Blase.Fast.BitStream",
"import Blase.Blase.Fast.BitStream"
] | [
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "Int.xor",
"module": "Mathlib.Data.Int.Bitwise"
},
{
"name": "List",
"module": "Init.Prelude"
},
{
"name": "Nat.testBit",
"module": "Init.Data.Nat.Bitwise.Basi... | [
{
"name": "syntax \"slt\" : MLIR.Pretty.uniform_op",
"content": "syntax \"slt\" : MLIR.Pretty.uniform_op"
},
{
"name": "macro_rules",
"content": "macro_rules\n | `(mlir_op| $res:mlir_op_operand = const ($x)\n $[: $outer_type]? ) => do\n let outer_type β outer_type.getDM `(mlir_type| _... | [
{
"name": "BitVec.lt_def",
"module": "Init.Data.BitVec.Lemmas"
},
{
"name": "BitVec.of_length_zero",
"module": "Init.Data.BitVec.Lemmas"
},
{
"name": "BitVec.ult_eq_not_carry",
"module": "Init.Data.BitVec.Bitblast"
},
{
"name": "BitVec.eq_of_getLsbD_eq",
"module": "Init.D... | [
{
"name": "subAux_eq_BitVec_carry",
"content": "@[simp] theorem subAux_eq_BitVec_carry (a b : BitStream) (w i : Nat) (hi : i < w) :\n (a.subAux b i).2 = !(BitVec.carry (i + 1) (a.toBitVec w) ((~~~b).toBitVec w) true)"
},
{
"name": "scanOr_true_iff",
"content": "theorem scanOr_true_iff (s : Bi... | [
{
"name": "Term.eval",
"content": "def Term.eval (t : Term) (vars : List BitStream) : BitStream :=\n match t with\n | var n => vars.getD n default\n | zero => BitStream.zero\n | one => BitStream.one\n | negOne => BitStream.negOne\n | ofNat n => BitStream.ofNat n\n | and ... | [
{
"name": "Term.eval_eq_denote",
"content": "@[simp] theorem Term.eval_eq_denote (t : Term) (w : Nat) (vars : List (BitVec w)) :\n (t.eval (vars.map BitStream.ofBitVecSext)).toBitVec w = t.denote w vars"
},
{
"name": "Term.eval_eq_denote_apply",
"content": "theorem Term.eval_eq_denote_apply (... | import Mathlib.Data.Bool.Basic
import Mathlib.Data.Fin.Basic
import Blase.Fast.BitStream
import Blase.SingleWidth.Defs
open Term
open BitStream in
def Term.eval (t : Term) (vars : List BitStream) : BitStream :=
match t with
| var n => vars.getD n default
| zero => BitStream.zero
| one ... | theorem Predicate.eval_eq_denote (w : Nat) (p : Predicate) (vars : List (BitVec w)) :
(p.eval (vars.map .ofBitVecSext) w = false) β p.denote w vars := | := by
induction p generalizing vars w
case width wp n => cases wp <;> simp [eval, denote]
case binary p a b =>
cases p with
| eq => simp [eval, denote]; apply evalEq_denote_false_iff
| neq => simp [eval, denote]; apply evalNeq_denote
| ult =>
simp [eval, denote]
rw [BitVec.ult_notation... | 9 | 96 | false | Compiler |
299 | eq_true_iff_of_eq_false_iff | theorem eq_true_iff_of_eq_false_iff (b : Bool) (rhs : Prop) (h : (b = false) β rhs) :
(b = true) β Β¬ rhs | lean-mlir | Blase/Blase/Fast/Defs.lean | [
"import Blase.SingleWidth.Defs",
"import Mathlib.Data.Fin.Basic",
"import Blase.Fast.BitStream",
"import Mathlib.Data.Bool.Basic"
] | [
{
"name": "Bool",
"module": "Init.Prelude"
}
] | [
{
"name": "Term",
"content": "inductive Term : Type\n| var : Nat β Term\n \n| zero : Term\n \n| negOne : Term\n \n| one : Term\n \n| ofNat (n : Nat) : Term\n \n| and : Term β Term β Term\n \n| or : Term β Term β Term\n \n| xor : Term β Term β Term\n \n| not : Term β Term\n \n| add : Term β Term β Term\n \n|... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "List.getElem_append_left{Ξ±",
"content": "theorem List.getElem_append_left{Ξ± : Type u_1} {lβ lβ : List Ξ±} {i : Nat} (hn : i < lβ.length) :\\n(lβ ++ lβ)[i] = lβ[i]"
}
] | [] | [] | import Mathlib.Data.Bool.Basic
import Mathlib.Data.Fin.Basic
import Blase.Fast.BitStream
import Blase.SingleWidth.Defs
open Term
open BitStream in
open BitStream in
section Predicate
end Predicate | theorem eq_true_iff_of_eq_false_iff (b : Bool) (rhs : Prop) (h : (b = false) β rhs) :
(b = true) β Β¬ rhs := | := by
constructor
Β· intros h'
apply h.not.mp
simp [h']
Β· intros h'
by_contra hcontra
simp at hcontra
have := h.mp hcontra
exact h' this | 1 | 2 | false | Compiler |
300 | ReflectVerif.BvDecide.KInductionCircuits.FSM.carryWith_congrEnv_envBitstream_set_of_le | theorem FSM.carryWith_congrEnv_envBitstream_set_of_le (fsm : FSM arity)
(s0 : fsm.Ξ± β Bool) (env : arity β BitStream) (n : Nat) (v : arity β Bool)
(k : Nat) (hk : k β€ n) :
fsm.carryWith s0 (envBitstream_set env n v) k =
fsm.carryWith s0 env k | lean-mlir | Blase/Blase/KInduction/KInduction.lean | [
"import Blase.Fast.Defs",
"import Blase.Vars",
"import Blase.Fast.ForLean",
"import Lean.Meta.ForEachExpr",
"import Mathlib.Data.Bool.Basic",
"import Mathlib.Data.Finset.Defs",
"import Blase.Fast.FiniteStateMachine",
"import Blase.SingleWidth.Syntax",
"import Lean.Meta.Tactic.Simp.BuiltinSimprocs.Bi... | [
{
"name": "Bool",
"module": "Init.Prelude"
},
{
"name": "Nat",
"module": "Init.Prelude"
},
{
"name": "Vector",
"module": "Init.Data.Vector.Basic"
},
{
"name": "Fin",
"module": "Init.Prelude"
},
{
"name": "String",
"module": "Init.Prelude"
},
{
"name": ... | [
{
"name": "syntax \"llvm.and\" : MLIR.Pretty.uniform_op",
"content": "syntax \"llvm.and\" : MLIR.Pretty.uniform_op\n\nsyntax \"llvm.ashr\" : MLIR.Pretty.exact_op\n\nsyntax \"llvm.add\" : MLIR.Pretty.overflow_op\n\nsyntax \"llvm.return\" : MLIR.Pretty.uniform_op\n\nsyntax \"return\" : MLIR.Pr... | [
{
"name": "...",
"module": ""
}
] | [
{
"name": "carryWith_congrEnv",
"content": "theorem carryWith_congrEnv {p : FSM arity}\n {carryState : p.Ξ± β Bool} {x y : arity β BitStream} {n : Nat}\n (h : β a i, i < n β x a i = y a i) :\n p.carryWith carryState x n = p.carryWith carryState y n"
},
{
"name": "carry_congrEnv",
"conten... | [
{
"name": "ReflectVerif.BvDecide.KInductionCircuits",
"content": "structure KInductionCircuits {arity : Type _}\n [DecidableEq arity] [Fintype arity] [Hashable arity] (fsm : FSM arity) (n : Nat) where\n \n cInitCarryAssignCirc : Circuit (Vars fsm.Ξ± arity 0)\n \n cSuccCarryAssignCirc : Circuit (Vars fsm... | [] | import Mathlib.Data.Bool.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Finset.Basic
import Mathlib.Data.Finset.Defs
import Mathlib.Data.Multiset.FinsetOps
import Blase.Fast.BitStream
import Blase.Fast.Defs
import Blase.Fast.FiniteStateMachine
import Blase.Fast.Decide
import Blase.SingleWidth.Syntax
... | theorem FSM.carryWith_congrEnv_envBitstream_set_of_le (fsm : FSM arity)
(s0 : fsm.Ξ± β Bool) (env : arity β BitStream) (n : Nat) (v : arity β Bool)
(k : Nat) (hk : k β€ n) :
fsm.carryWith s0 (envBitstream_set env n v) k =
fsm.carryWith s0 env k := | := by
apply FSM.carryWith_congrEnv
intros a l hl
simp [envBitstream_set]
intros hcontra; omega | 5 | 33 | false | Compiler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.