statement
stringlengths
1
8.65k
proof
stringlengths
0
19.6k
type
stringclasses
12 values
symbolic_name
stringlengths
1
110
library
stringclasses
165 values
filename
stringclasses
822 values
imports
listlengths
0
19
deps
listlengths
0
64
docstring
stringlengths
0
3.64k
source_url
stringclasses
1 value
commit
stringclasses
1 value
lt_of_lt_of_eq {a b c : α} [LT α] (h₁ : a < b) (h₂ : b = c) : a < c
h₂ ▸ h₁
theorem
lt_of_lt_of_eq
Init
src/Init/Core.lean
[]
[ "LT" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Associative (op : α → α → α) : Prop where /-- An associative operation satisfies `(a ∘ b) ∘ c = a ∘ (b ∘ c)`. -/ assoc : (a b c : α) → op (op a b) c = op a (op b c)
class
Std.Associative
Init
src/Init/Core.lean
[]
[]
`Associative op` indicates `op` is an associative operation, i.e. `(a ∘ b) ∘ c = a ∘ (b ∘ c)`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Commutative (op : α → α → α) : Prop where /-- A commutative operation satisfies `a ∘ b = b ∘ a`. -/ comm : (a b : α) → op a b = op b a
class
Std.Commutative
Init
src/Init/Core.lean
[]
[]
`Commutative op` says that `op` is a commutative operation, i.e. `a ∘ b = b ∘ a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
IdempotentOp (op : α → α → α) : Prop where /-- An idempotent operation satisfies `a ∘ a = a`. -/ idempotent : (x : α) → op x x = x
class
Std.IdempotentOp
Init
src/Init/Core.lean
[]
[]
`IdempotentOp op` indicates `op` is an idempotent binary operation. i.e. `a ∘ a = a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
LeftIdentity (op : α → β → β) (o : outParam α) : Prop
class
Std.LeftIdentity
Init
src/Init/Core.lean
[]
[ "outParam" ]
`LeftIdentity op o` indicates `o` is a left identity of `op`. This class does not require a proof that `o` is an identity, and is used primarily for inferring the identity using class resolution.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
LawfulLeftIdentity (op : α → β → β) (o : outParam α) : Prop extends LeftIdentity op o where /-- Left identity `o` is an identity. -/ left_id : ∀ a, op o a = a
class
Std.LawfulLeftIdentity
Init
src/Init/Core.lean
[]
[ "outParam" ]
`LawfulLeftIdentity op o` indicates `o` is a verified left identity of `op`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
RightIdentity (op : α → β → α) (o : outParam β) : Prop
class
Std.RightIdentity
Init
src/Init/Core.lean
[]
[ "outParam" ]
`RightIdentity op o` indicates `o` is a right identity `o` of `op`. This class does not require a proof that `o` is an identity, and is used primarily for inferring the identity using class resolution.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
LawfulRightIdentity (op : α → β → α) (o : outParam β) : Prop extends RightIdentity op o where /-- Right identity `o` is an identity. -/ right_id : ∀ a, op a o = a
class
Std.LawfulRightIdentity
Init
src/Init/Core.lean
[]
[ "outParam" ]
`LawfulRightIdentity op o` indicates `o` is a verified right identity of `op`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Identity (op : α → α → α) (o : outParam α) : Prop extends LeftIdentity op o, RightIdentity op o
class
Std.Identity
Init
src/Init/Core.lean
[]
[ "outParam" ]
`Identity op o` indicates `o` is a left and right identity of `op`. This class does not require a proof that `o` is an identity, and is used primarily for inferring the identity using class resolution.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
LawfulIdentity (op : α → α → α) (o : outParam α) : Prop extends Identity op o, LawfulLeftIdentity op o, LawfulRightIdentity op o
class
Std.LawfulIdentity
Init
src/Init/Core.lean
[]
[ "outParam" ]
`LawfulIdentity op o` indicates `o` is a verified left and right identity of `op`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
LawfulCommIdentity (op : α → α → α) (o : outParam α) [hc : Commutative op] : Prop extends LawfulIdentity op o where left_id a
Eq.trans (hc.comm o a) (right_id a) right_id a := Eq.trans (hc.comm a o) (left_id a)
class
Std.LawfulCommIdentity
Init
src/Init/Core.lean
[]
[ "Eq.trans", "outParam" ]
`LawfulCommIdentity` can simplify defining instances of `LawfulIdentity` on commutative functions by requiring only a left or right identity proof. This class is intended for simplifying defining instances of `LawfulIdentity` and functions needed commutative operations with identity should just add a `LawfulIdentity` ...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Refl (r : α → α → Prop) : Prop where /-- A reflexive relation satisfies `r a a`. -/ refl : ∀ a, r a a
class
Std.Refl
Init
src/Init/Core.lean
[]
[]
`Refl r` means the binary relation `r` is reflexive, that is, `r x x` always holds.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Antisymm (r : α → α → Prop) : Prop where /-- An antisymmetric relation `r` satisfies `r a b → r b a → a = b`. -/ antisymm (a b : α) : r a b → r b a → a = b
class
Std.Antisymm
Init
src/Init/Core.lean
[]
[]
`Antisymm r` says that `r` is antisymmetric, that is, `r a b → r b a → a = b`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Asymm (r : α → α → Prop) : Prop where /-- An asymmetric relation satisfies `r a b → ¬ r b a`. -/ asymm : ∀ a b, r a b → ¬r b a
class
Std.Asymm
Init
src/Init/Core.lean
[]
[]
`Asymm r` means that the binary relation `r` is asymmetric, that is, `r a b → ¬ r b a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Symm (r : α → α → Prop) : Prop where /-- A symmetric relation satisfies `r a b → r b a`. -/ symm : ∀ a b, r a b → r b a
class
Std.Symm
Init
src/Init/Core.lean
[]
[]
`Symm r` means that the binary relation `r` is symmetric, that is, `r a b → r b a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Total (r : α → α → Prop) : Prop where /-- A total relation satisfies `r a b` or `r b a`. -/ total : ∀ a b, r a b ∨ r b a
class
Std.Total
Init
src/Init/Core.lean
[]
[]
`Total X r` means that the binary relation `r` on `X` is total, that is, `r a b` or `r b a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Irrefl (r : α → α → Prop) : Prop where /-- An irreflexive relation satisfies `¬ r a a`. -/ irrefl : ∀ a, ¬r a a
class
Std.Irrefl
Init
src/Init/Core.lean
[]
[]
`Irrefl r` means the binary relation `r` is irreflexive, that is, `r x x` never holds.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Trichotomous (r : α → α → Prop) : Prop where /-- An trichotomous relation `r` satisfies `¬ r a b → ¬ r b a → a = b`. -/ trichotomous (a b : α) : ¬ r a b → ¬ r b a → a = b
class
Std.Trichotomous
Init
src/Init/Core.lean
[]
[]
`Trichotomous r` says that `r` is trichotomous, that is, `¬ r a b → ¬ r b a → a = b`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
flip_flip {α : Sort u} {β : Sort v} {φ : Sort w} {f : α → β → φ} : flip (flip f) = f
by apply funext intro a apply funext intro b rw [flip, flip]
theorem
flip_flip
Init
src/Init/Core.lean
[]
[ "flip", "funext" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
TypeNameData (α : Type u) : NonemptyType.{0}
⟨Name, inferInstance⟩
opaque
TypeNameData
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
TypeName (α : Type u) where private mk' :: private data : (TypeNameData α).type
class
TypeName
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "TypeNameData" ]
Dynamic type name information. Types with an instance of `TypeName` can be stored in an `Dynamic`. The type class contains the declaration name of the type, which must not have any universe parameters and be of type `Sort ..` (i.e., monomorphic). The preferred way to declare instances of this type is using the derive ...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
TypeName.mk (α : Type u) (typeName : Name) : TypeName α
⟨unsafeCast typeName⟩
def
TypeName.mk
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "TypeName" ]
Creates a `TypeName` instance. For safety, it is required that the constant `typeName` is definitionally equal to `α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
TypeName.typeNameImpl (α) [TypeName α] : Name
unsafeCast (@TypeName.data α _)
def
TypeName.typeNameImpl
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "TypeName", "unsafeCast" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
TypeName.typeName (α) [TypeName α] : Name
opaque
TypeName.typeName
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "TypeName" ]
Returns a declaration name of the type.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
DynamicPointed : NonemptyType.{0}
⟨Name × NonScalar, inferInstance⟩
opaque
DynamicPointed
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "NonScalar" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic : Type
DynamicPointed.type
def
Dynamic
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[]
A type-tagged union that can store any type with a `TypeName` instance. This is roughly equivalent to `(α : Type) × TypeName α × α`, but without the universe bump. Use `Dynamic.mk` to inject a value into `Dynamic` from another type, and `Dynamic.get?` to extract a value from `Dynamic` if it has some expected type.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic.typeNameImpl (any : Dynamic) : Name
(unsafeCast any : Name × NonScalar).1
def
Dynamic.typeNameImpl
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "Dynamic", "NonScalar", "unsafeCast" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic.typeName (any : Dynamic) : Name
opaque
Dynamic.typeName
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "Dynamic" ]
The name of the type of the value stored in the `Dynamic`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic.get?Impl (α) (any : Dynamic) [TypeName α] : Option α
let ((typeName, obj) : Name × NonScalar) := unsafeCast any if typeName == TypeName.typeName α then some (unsafeCast obj) else none
def
Dynamic.get?Impl
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "Dynamic", "NonScalar", "Option", "TypeName", "TypeName.typeName", "unsafeCast" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic.get? (α) (any : Dynamic) [TypeName α] : Option α
opaque
Dynamic.get?
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "Dynamic", "Option", "TypeName" ]
Retrieves the value stored in the `Dynamic`. Returns `some a` if the value has the right type, and `none` otherwise.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic.mkImpl [TypeName α] (obj : α) : Dynamic
unsafeCast (TypeName.typeName α, (unsafeCast obj : NonScalar))
def
Dynamic.mkImpl
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "Dynamic", "NonScalar", "TypeName", "TypeName.typeName", "unsafeCast" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dynamic.mk [TypeName α] (obj : α) : Dynamic
opaque
Dynamic.mk
Init
src/Init/Dynamic.lean
[ "Init.Core" ]
[ "Dynamic", "TypeName" ]
Stores the provided value in a `Dynamic`. Use `Dynamic.get? α` to retrieve it.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"ext1" xs:(colGt ppSpace rintroPat)* : tactic => if xs.isEmpty then `(tactic| apply_ext_theorem <;> intros) else `(tactic| apply_ext_theorem <;> rintro $xs*)
macro
ext1
Init
src/Init/Ext.lean
[]
[]
`ext1 pat*` is like `ext pat*` except that it only applies a single extensionality theorem rather than recursively applying as many extensionality theorems as possible. The `pat*` patterns are processed using the `rintro` tactic. If no patterns are supplied, then variables are introduced anonymously using the `intros`...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Subtype.eq_iff
@Subtype.ext_iff
def
Subtype.eq_iff
Init
src/Init/Ext.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Unit.ext (x y : Unit) : x = y
rfl
theorem
Unit.ext
Init
src/Init/Ext.lean
[]
[ "Unit", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Thunk.ext : {a b : Thunk α} → a.get = b.get → a = b
| {..}, {..}, heq => congrArg _ <| funext fun _ => heq
theorem
Thunk.ext
Init
src/Init/Ext.lean
[]
[ "Thunk", "congrArg", "funext" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
outOfBounds [Inhabited α] : α
panic! "index out of bounds"
def
outOfBounds
Init
src/Init/GetElem.lean
[]
[ "Inhabited" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
outOfBounds_eq_default [Inhabited α] : (outOfBounds : α) = default
rfl
theorem
outOfBounds_eq_default
Init
src/Init/GetElem.lean
[]
[ "Inhabited", "outOfBounds", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
GetElem (coll : Type u) (idx : Type v) (elem : outParam (Type w)) (valid : outParam (coll → idx → Prop)) where /-- The syntax `arr[i]` gets the `i`'th element of the collection `arr`. If there are proof side conditions to the application, they will be automatically inferred by the `get_elem_tactic...
class
GetElem
Init
src/Init/GetElem.lean
[]
[ "outParam" ]
The classes `GetElem` and `GetElem?` implement lookup notation, specifically `xs[i]`, `xs[i]?`, `xs[i]!`, and `xs[i]'p`. Both classes are indexed by types `coll`, `idx`, and `elem` which are the collection, the index, and the element types. A single collection may support lookups with multiple index types. The relatio...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
decidableGetElem? [GetElem coll idx elem valid] (xs : coll) (i : idx) [Decidable (valid xs i)] : Option elem
if h : valid xs i then some xs[i] else none
abbrev
decidableGetElem?
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem", "Option" ]
Helper function for implementation of `GetElem?.getElem?`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
GetElem? (coll : Type u) (idx : Type v) (elem : outParam (Type w)) (valid : outParam (coll → idx → Prop)) extends GetElem coll idx elem valid where /-- The syntax `arr[i]?` gets the `i`'th element of the collection `arr`, if it is present (and wraps it in `some`), and otherwise returns `none`. -/ getElem?...
match getElem? xs i with | some e => e | none => outOfBounds
class
GetElem?
Init
src/Init/GetElem.lean
[]
[ "GetElem", "Inhabited", "Option", "outOfBounds", "outParam" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
:max x:term noWs "[" i:term "]" noWs "?" : term => `(getElem? $x $i)
macro
[
Init
src/Init/GetElem.lean
[]
[]
The syntax `arr[i]?` gets the `i`'th element of the collection `arr` or returns `none` if `i` is out of bounds.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
:max x:term noWs "[" i:term "]" noWs "!" : term => `(getElem! $x $i) recommended_spelling "getElem" for "xs[i]" in [GetElem.getElem, «term__[_]»] recommended_spelling "getElem" for "xs[i]'h" in [GetElem.getElem, «term__[_]'_»] recommended_spelling "getElem?" for "xs[i]?" in [GetElem?.getElem?, «term__[_]_?»] recommend...
macro
[
Init
src/Init/GetElem.lean
[]
[]
The syntax `arr[i]!` gets the `i`'th element of the collection `arr` and panics if `i` is out of bounds.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_congr [GetElem coll idx elem valid] {c d : coll} (h : c = d) {i j : idx} (h' : i = j) (w : valid c i) : c[i] = d[j]'(h' ▸ h ▸ w)
by cases h; cases h'; rfl
theorem
getElem_congr
Init
src/Init/GetElem.lean
[]
[ "GetElem", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_congr_coll [GetElem coll idx elem valid] {c d : coll} {i : idx} {w : valid c i} (h : c = d) : c[i] = d[i]'(h ▸ w)
by cases h; rfl
theorem
getElem_congr_coll
Init
src/Init/GetElem.lean
[]
[ "GetElem", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_congr_idx [GetElem coll idx elem valid] {c : coll} {i j : idx} {w : valid c i} (h' : i = j) : c[i] = c[j]'(h' ▸ w)
by cases h'; rfl
theorem
getElem_congr_idx
Init
src/Init/GetElem.lean
[]
[ "GetElem", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
LawfulGetElem (cont : Type u) (idx : Type v) (elem : outParam (Type w)) (dom : outParam (cont → idx → Prop)) [ge : GetElem? cont idx elem dom] : Prop where /-- `GetElem?.getElem?` succeeds when the validity predicate is satisfied and fails otherwise. -/ getElem?_def (c : cont) (i : idx) [Decidable (dom c i)] : ...
by intros try simp only [getElem?] <;> congr /-- `GetElem?.getElem!` succeeds and fails when `GetElem.getElem?` succeeds and fails. -/ getElem!_def [Inhabited elem] (c : cont) (i : idx) : c[i]! = match c[i]? with | some e => e | none => default := by intros simp only [getElem!, getElem?, outO...
class
LawfulGetElem
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "Inhabited", "congr", "outOfBounds_eq_default", "outParam" ]
Lawful `GetElem?` instances (which extend `GetElem`) are those for which the potentially-failing `GetElem?.getElem?` and `GetElem?.getElem!` operators succeed when the validity predicate is satisfied, and fail when it is not.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_pos [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] (c : cont) (i : idx) (h : dom c i) : c[i]? = some (c[i]'h)
by have : Decidable (dom c i) := .isTrue h rw [getElem?_def] exact dif_pos h
theorem
getElem?_pos
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem", "dif_pos" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_neg [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] (c : cont) (i : idx) (h : ¬dom c i) : c[i]? = none
by have : Decidable (dom c i) := .isFalse h rw [getElem?_def] exact dif_neg h
theorem
getElem?_neg
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem", "dif_neg" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem!_pos [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] [Inhabited elem] (c : cont) (i : idx) (h : dom c i) : c[i]! = c[i]'h
by have : Decidable (dom c i) := .isTrue h simp [getElem!_def, h]
theorem
getElem!_pos
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "Inhabited", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem!_neg [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] [Inhabited elem] (c : cont) (i : idx) (h : ¬dom c i) : c[i]! = default
by have : Decidable (dom c i) := .isFalse h simp [getElem!_def, h]
theorem
getElem!_neg
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "Inhabited", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
get_getElem? [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] (c : cont) (i : idx) [Decidable (dom c i)] (h) : c[i]?.get h = c[i]'(by simp only [getElem?_def] at h; split at h <;> simp_all)
by simp only [getElem?_def] at h ⊢ split <;> simp_all
theorem
get_getElem?
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_eq_none_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] (c : cont) (i : idx) [Decidable (dom c i)] : c[i]? = none ↔ ¬dom c i
by simp only [getElem?_def] split <;> simp_all
theorem
getElem?_eq_none_iff
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
none_eq_getElem?_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] (c : cont) (i : idx) [Decidable (dom c i)] : none = c[i]? ↔ ¬dom c i
by simp only [getElem?_def] split <;> simp_all
theorem
none_eq_getElem?_iff
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
of_getElem?_eq_some [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] (h : c[i]? = some e) : dom c i
by simp only [getElem?_def] at h split at h <;> rename_i h' case isTrue => exact h' case isFalse => simp at h
theorem
of_getElem?_eq_some
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_eq_some_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] : c[i]? = some e ↔ Exists fun h : dom c i => c[i] = e
by simp only [getElem?_def] split <;> rename_i h case isTrue => constructor case mp => intro w refine ⟨h, ?_⟩ simpa using w case mpr => intro ⟨h, w⟩ simpa using w case isFalse => simp only [reduceCtorEq, false_iff] intro ⟨w, w'⟩ exact h w
theorem
getElem?_eq_some_iff
Init
src/Init/GetElem.lean
[]
[ "Decidable", "Exists", "GetElem?", "LawfulGetElem", "false_iff" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
some_eq_getElem?_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] : some e = c[i]? ↔ Exists fun h : dom c i => c[i] = e
by rw [eq_comm, getElem?_eq_some_iff]
theorem
some_eq_getElem?_iff
Init
src/Init/GetElem.lean
[]
[ "Decidable", "Exists", "GetElem?", "LawfulGetElem", "eq_comm", "getElem?_eq_some_iff" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_of_getElem? [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] (h : c[i]? = some e) : Exists fun h : dom c i => c[i] = e
getElem?_eq_some_iff.mp h
theorem
getElem_of_getElem?
Init
src/Init/GetElem.lean
[]
[ "Decidable", "Exists", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
of_getElem_eq [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] {h} (_ : c[i] = e) : dom c i
h
theorem
of_getElem_eq
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
some_getElem_eq_getElem?_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] (h : dom c i): (some c[i] = c[i]?) ↔ True
by simp [h]
theorem
some_getElem_eq_getElem?_iff
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem", "True" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_eq_some_getElem_iff [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] {c : cont} {i : idx} [Decidable (dom c i)] (h : dom c i): (c[i]? = some c[i]) ↔ True
by simp [h]
theorem
getElem?_eq_some_getElem_iff
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem", "True" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
isSome_getElem? [GetElem? cont idx elem dom] [LawfulGetElem cont idx elem dom] (c : cont) (i : idx) [Decidable (dom c i)] : c[i]?.isSome = dom c i
by simp only [getElem?_def] split <;> simp_all
theorem
isSome_getElem?
Init
src/Init/GetElem.lean
[]
[ "Decidable", "GetElem?", "LawfulGetElem" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instGetElemFinVal [GetElem cont Nat elem dom] : GetElem cont (Fin n) elem fun xs i => dom xs i
where getElem xs i h := getElem xs i.1 h
instance
Fin.instGetElemFinVal
Init
src/Init/GetElem.lean
[]
[ "Fin", "GetElem", "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instGetElem?FinVal [GetElem? cont Nat elem dom] : GetElem? cont (Fin n) elem fun xs i => dom xs i
where getElem? xs i := getElem? xs i.val getElem! xs i := getElem! xs i.val
instance
Fin.instGetElem?FinVal
Init
src/Init/GetElem.lean
[]
[ "Fin", "GetElem?", "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_fin [GetElem Cont Nat Elem Dom] (a : Cont) (i : Fin n) (h : Dom a i) : a[i] = a[i.1]
rfl
theorem
Fin.getElem_fin
Init
src/Init/GetElem.lean
[]
[ "Fin", "GetElem", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_fin [h : GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n) : a[i]? = a[i.1]?
rfl
theorem
Fin.getElem?_fin
Init
src/Init/GetElem.lean
[]
[ "Fin", "GetElem?", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem!_fin [GetElem? Cont Nat Elem Dom] (a : Cont) (i : Fin n) [Inhabited Elem] : a[i]! = a[i.1]!
rfl
theorem
Fin.getElem!_fin
Init
src/Init/GetElem.lean
[]
[ "Fin", "GetElem?", "Inhabited", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_cons_zero (a : α) (as : List α) (h : 0 < (a :: as).length) : getElem (a :: as) 0 h = a
rfl
theorem
List.getElem_cons_zero
Init
src/Init/GetElem.lean
[]
[ "List", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_cons_succ (a : α) (as : List α) (i : Nat) (h : i + 1 < (a :: as).length) : getElem (a :: as) (i+1) h = getElem as i (Nat.lt_of_succ_lt_succ h)
rfl
theorem
List.getElem_cons_succ
Init
src/Init/GetElem.lean
[]
[ "List", "Nat", "Nat.lt_of_succ_lt_succ", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_mem : ∀ {l : List α} {n} (h : n < l.length), l[n]'h ∈ l
| _ :: _, 0, _ => .head .. | _ :: l, _+1, _ => .tail _ (getElem_mem (l := l) ..) grind_pattern getElem_mem => l[n]'h ∈ l
theorem
List.getElem_mem
Init
src/Init/GetElem.lean
[]
[ "List" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_cons_drop {as : List α} {i : Nat} (h : i < as.length) : as[i] :: as.drop (i+1) = as.drop i
match as, i with | _::_, 0 => rfl | _::_, i+1 => getElem_cons_drop (i := i) (Nat.add_one_lt_add_one_iff.mp h)
theorem
List.getElem_cons_drop
Init
src/Init/GetElem.lean
[]
[ "List", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem_cons_drop_succ_eq_drop {as : List α} {i : Nat} (h : i < as.length) : as[i] :: as.drop (i+1) = as.drop i
getElem_cons_drop h
theorem
List.getElem_cons_drop_succ_eq_drop
Init
src/Init/GetElem.lean
[]
[ "List", "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
get?Internal : (as : List α) → (i : Nat) → Option α
| a::_, 0 => some a | _::as, n+1 => get?Internal as n | _, _ => none
def
List.get?Internal
Init
src/Init/GetElem.lean
[]
[ "List", "Nat", "Option" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
get!Internal [Inhabited α] : (as : List α) → (i : Nat) → α
| a::_, 0 => a | _::as, n+1 => get!Internal as n | _, _ => panic! "invalid index"
def
List.get!Internal
Init
src/Init/GetElem.lean
[]
[ "Inhabited", "List", "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
get?Internal_eq_getElem? {l : List α} {i : Nat} : l.get?Internal i = l[i]?
rfl
theorem
List.get?Internal_eq_getElem?
Init
src/Init/GetElem.lean
[]
[ "List", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
get!Internal_eq_getElem! [Inhabited α] {l : List α} {i : Nat} : l.get!Internal i = l[i]!
rfl
theorem
List.get!Internal_eq_getElem!
Init
src/Init/GetElem.lean
[]
[ "Inhabited", "List", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_eq_getElem {l : List α} {i} (h : i < l.length) : l[i]? = some l[i]
by induction l generalizing i with | nil => cases h | cons a l ih => cases i with | zero => rfl | succ i => exact ih ..
theorem
List.getElem?_eq_getElem
Init
src/Init/GetElem.lean
[]
[ "List", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_eq_none_iff : l[i]? = none ↔ length l ≤ i
match l with | [] => by simp; rfl | _ :: l => by cases i with | zero => simp | succ i => simp only [length_cons, Nat.add_le_add_iff_right] exact getElem?_eq_none_iff (l := l) (i := i)
theorem
List.getElem?_eq_none_iff
Init
src/Init/GetElem.lean
[]
[ "Nat.add_le_add_iff_right", "getElem?_eq_none_iff", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
none_eq_getElem?_iff {l : List α} {i : Nat} : none = l[i]? ↔ length l ≤ i
by simp [eq_comm (a := none)]
theorem
List.none_eq_getElem?_iff
Init
src/Init/GetElem.lean
[]
[ "List", "Nat", "eq_comm", "none_eq_getElem?_iff" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getElem?_eq_none (h : length l ≤ i) : l[i]? = none
getElem?_eq_none_iff.mpr h grind_pattern getElem?_eq_none => l.length, l[i]? where guard l.length ≤ i
theorem
List.getElem?_eq_none
Init
src/Init/GetElem.lean
[]
[ "guard" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
getInternal_eq_getElem (a : Array α) (i : Nat) (h) : a.getInternal i h = a[i]
rfl
theorem
Array.getInternal_eq_getElem
Init
src/Init/GetElem.lean
[]
[ "Array", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
get!Internal_eq_getElem! [Inhabited α] (a : Array α) (i : Nat) : a.get!Internal i = a[i]!
by simp only [get!Internal, getD, getInternal_eq_getElem, getElem!_def] split <;> simp_all [getElem?_pos, getElem?_neg]
theorem
Array.get!Internal_eq_getElem!
Init
src/Init/GetElem.lean
[]
[ "Array", "Inhabited", "Nat", "getElem?_neg", "getElem?_pos" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"deriving_ReflEq_tactic" : tactic => `(tactic|( intro x induction x all_goals simp only [BEq.refl, ↓reduceDIte, Bool.and_true, *, reduceBEq ,reduceCtorIdx] ))
macro
deriving_ReflEq_tactic
Init
src/Init/LawfulBEqTactics.lean
[ "Init.Data.Bool", "Init.ByCases", "Init.Classical" ]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
and_true_curry {a b : Bool} {P : Prop} (h : a → b → P) : (a && b) → P
by rw [Bool.and_eq_true_iff] intro h' apply h h'.1 h'.2
theorem
DerivingHelpers.and_true_curry
Init
src/Init/LawfulBEqTactics.lean
[ "Init.Data.Bool", "Init.ByCases", "Init.Classical" ]
[ "Bool", "Bool.and_eq_true_iff" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
deriving_lawful_beq_helper_dep {x y : α} [BEq α] [ReflBEq α] {t : (x == y) = true → Bool} {P : Prop} (inst : (x == y) = true → x = y) (k : (h : x = y) → t (h ▸ ReflBEq.rfl) = true → P) : (if h : (x == y) then t h else false) = true → P
by intro h by_cases hxy : x = y · subst hxy apply k rfl rw [dif_pos (BEq.refl x)] at h exact h · by_cases hxy' : x == y · exact False.elim <| hxy (inst hxy') · rw [dif_neg hxy'] at h contradiction
theorem
DerivingHelpers.deriving_lawful_beq_helper_dep
Init
src/Init/LawfulBEqTactics.lean
[ "Init.Data.Bool", "Init.ByCases", "Init.Classical" ]
[ "BEq", "BEq.refl", "Bool", "False.elim", "ReflBEq", "dif_neg", "dif_pos", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
deriving_lawful_beq_helper_nd {x y : α} [BEq α] [ReflBEq α] {P : Prop} (inst : (x == y) = true → x = y) (k : x = y → P) : (x == y) = true → P
by intro h by_cases hxy : x = y · subst hxy apply k rfl · exact False.elim <| hxy (inst h)
theorem
DerivingHelpers.deriving_lawful_beq_helper_nd
Init
src/Init/LawfulBEqTactics.lean
[ "Init.Data.Bool", "Init.ByCases", "Init.Classical" ]
[ "BEq", "False.elim", "ReflBEq", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"deriving_LawfulEq_tactic" : tactic => `(tactic|( intro x induction x all_goals intro y cases y all_goals simp only [reduceBEq, reduceCtorIdx] repeat deriving_LawfulEq_tactic_step ))
macro
deriving_LawfulEq_tactic
Init
src/Init/LawfulBEqTactics.lean
[ "Init.Data.Bool", "Init.ByCases", "Init.Classical" ]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"Macro.trace[" id:ident "]" s:interpolatedStr(term) : term => `(Macro.trace $(quote id.getId.eraseMacroScopes) (s! $s))
macro
Macro.trace[
Init
src/Init/MacroTrace.lean
[ "Init.Data.ToString.Macro" ]
[ "id" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"eval_prec " p:prec:max : term => return quote (k := `term) (← evalPrec p)
macro
eval_prec
Init
src/Init/Meta.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"eval_prio " p:prio:max : term => return quote (k := `term) (← evalPrio p)
macro
eval_prio
Init
src/Init/Meta.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
"erw" c:optConfig s:rwRuleSeq loc:(location)? : tactic => do `(tactic| rw $[$(getConfigItems c)]* (transparency := .default) $s:rwRuleSeq $(loc)?)
macro
erw
Init
src/Init/Meta.lean
[]
[]
`erw [rules]` is a shorthand for `rw (transparency := .default) [rules]`. This does rewriting up to unfolding of regular definitions (by comparison to regular `rw` which only unfolds `@[reducible]` definitions).
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
(name := declareSimpLikeTactic) doc?:(docComment)? "declare_simp_like_tactic" opt:((simpAllKind <|> dsimpKind)?) ppSpace tacName:ident ppSpace tacToken:str ppSpace cfg:optConfig : command => do let (kind, tkn, stx) ← if opt.raw.isNone then pure (← `(``simp), ← `("simp"), ← `($[$doc?:docComment]? syn...
macro
declare_simp_like_tactic
Init
src/Init/Meta.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
NameGenerator where namePrefix : Name
`_uniq idx : Nat := 1 deriving Inhabited
structure
Lean.NameGenerator
Init
src/Init/MetaTypes.lean
[]
[ "Inhabited", "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Module where header : Syntax commands : Array Syntax
structure
Lean.Module
Init
src/Init/MetaTypes.lean
[]
[ "Array" ]
Syntax objects for a Lean module.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
TransparencyMode where /-- Unfolds all constants, even those tagged as `@[irreducible]`. -/ | all /-- Unfolds all constants except those tagged as `@[irreducible]`. Used for type checking user-written terms where we expect the input to be correct and want to try hard. -/ | default /-- Unfolds only constants...
inductive
Lean.Meta.TransparencyMode
Init
src/Init/MetaTypes.lean
[]
[ "BEq", "Inhabited" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
EtaStructMode where /-- Enable eta for structure and classes. -/ | all /-- Enable eta only for structures that are not classes. -/ | notClasses /-- Disable eta for structures and classes. -/ | none deriving Inhabited, BEq
inductive
Lean.Meta.EtaStructMode
Init
src/Init/MetaTypes.lean
[]
[ "BEq", "Inhabited" ]
Which structure types should eta be used with?
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Config where /-- When `true` (default: `true`), performs zeta reduction of `let` and `have` expressions. That is, `let x := v; e[x]` reduces to `e[v]`. If `zetaHave` is `false` then `have` expressions are not zeta reduced. See also `zetaDelta`. -/ zeta : Bool
true /-- When `true` (default: `true`), performs beta reduction of applications of `fun` expressions. That is, `(fun x => e[x]) v` reduces to `e[v]`. -/ beta : Bool := true /-- TODO (currently unimplemented). When `true` (default: `true`), performs eta reduction for `fun` expressions. That ...
structure
Lean.Meta.DSimp.Config
Init
src/Init/MetaTypes.lean
[]
[ "BEq", "Bool", "Inhabited" ]
The configuration for `dsimp`. Passed to `dsimp` using, for example, the `dsimp (config := {zeta := false})` syntax. Implementation note: this structure is only used for processing the `(config := ...)` syntax, and it is not used internally. It is immediately converted to `Lean.Meta.Simp.Config` by `Lean.Elab.Tactic.e...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
defaultMaxSteps
100000
def
Lean.Meta.Simp.defaultMaxSteps
Init
src/Init/MetaTypes.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Config where /-- The maximum number of subexpressions to visit when performing simplification. The default is 100000. -/ maxSteps : Nat
defaultMaxSteps /-- When simp discharges side conditions for conditional lemmas, it can recursively apply simplification. The `maxDischargeDepth` (default: 2) is the maximum recursion depth when recursively applying simplification to side conditions. -/ maxDischargeDepth : Nat := 2 /-- When `contextual` ...
structure
Lean.Meta.Simp.Config
Init
src/Init/MetaTypes.lean
[]
[ "BEq", "Bool", "Inhabited", "Nat", "Option" ]
The configuration for `simp`. Passed to `simp` using, for example, the `simp +contextual` or `simp (maxSteps := 100000)` syntax. See also `Lean.Meta.Simp.neutralConfig` and `Lean.Meta.DSimp.Config`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
ConfigCtx extends Config where contextual
true
structure
Lean.Meta.Simp.ConfigCtx
Init
src/Init/MetaTypes.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6