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
eqRec_heq {α : Sort u} {φ : α → Sort v} {a a' : α} : (h : a = a') → (p : φ a) → Eq.recOn (motive := fun x _ => φ x) h p ≍ p
| rfl, p => HEq.refl p
theorem
eqRec_heq
Init
src/Init/Core.lean
[]
[ "rfl" ]
Rewriting inside `φ` using `Eq.recOn` yields a term that's heterogeneously equal to the original term.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
eqRec_heq_iff {α : Sort u} {a : α} {motive : (b : α) → a = b → Sort v} {b : α} {refl : motive a (Eq.refl a)} {h : a = b} {c : motive b h} : @Eq.rec α a motive refl b h ≍ c ↔ refl ≍ c
h.rec (fun _ => ⟨id, id⟩) c
theorem
eqRec_heq_iff
Init
src/Init/Core.lean
[]
[]
Heterogeneous equality with an `Eq.rec` application on the left is equivalent to a heterogeneous equality on the original term.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
heq_eqRec_iff {α : Sort u} {a : α} {motive : (b : α) → a = b → Sort v} {b : α} {refl : motive a (Eq.refl a)} {h : a = b} {c : motive b h} : c ≍ @Eq.rec α a motive refl b h ↔ c ≍ refl
h.rec (fun _ => ⟨id, id⟩) c
theorem
heq_eqRec_iff
Init
src/Init/Core.lean
[]
[]
Heterogeneous equality with an `Eq.rec` application on the right is equivalent to a heterogeneous equality on the original term.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
apply_eqRec {α : Sort u} {a : α} (motive : (b : α) → a = b → Sort v) {b : α} {h : a = b} {c : motive a (Eq.refl a) → β} {d : motive b h} : @Eq.rec α a (fun b h => motive b h → β) c b h d = c (h.symm ▸ d)
by cases h; rfl
theorem
apply_eqRec
Init
src/Init/Core.lean
[]
[ "rfl" ]
Moves an cast using `Eq.rec` from the function to the argument. Note: because the motive isn't reliably detected by unification, it needs to be provided as an explicit parameter.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
heq_of_eqRec_eq {α β : Sort u} {a : α} {b : β} (h₁ : α = β) (h₂ : Eq.rec (motive := fun α _ => α) a h₁ = b) : a ≍ b
by subst h₁ apply heq_of_eq exact h₂
theorem
heq_of_eqRec_eq
Init
src/Init/Core.lean
[]
[ "heq_of_eq" ]
If casting a term with `Eq.rec` to another type makes it equal to some other term, then the two terms are heterogeneously equal.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
cast_heq {α β : Sort u} : (h : α = β) → (a : α) → cast h a ≍ a
| rfl, a => HEq.refl a
theorem
cast_heq
Init
src/Init/Core.lean
[]
[ "cast", "rfl" ]
The result of casting a term with `cast` is heterogeneously equal to the original term.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_iff_implies_and_implies {a b : Prop} : (a ↔ b) ↔ (a → b) ∧ (b → a)
Iff.intro (fun h => And.intro h.mp h.mpr) (fun h => Iff.intro h.left h.right)
theorem
iff_iff_implies_and_implies
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.refl (a : Prop) : a ↔ a
Iff.intro (fun h => h) (fun h => h)
theorem
Iff.refl
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.rfl {a : Prop} : a ↔ a
Iff.refl a
theorem
Iff.rfl
Init
src/Init/Core.lean
[]
[ "Iff.refl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.of_eq (h : a = b) : a ↔ b
h ▸ Iff.rfl
theorem
Iff.of_eq
Init
src/Init/Core.lean
[]
[ "Iff.rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.trans (h₁ : a ↔ b) (h₂ : b ↔ c) : a ↔ c
Iff.intro (h₂.mp ∘ h₁.mp) (h₁.mpr ∘ h₂.mpr)
theorem
Iff.trans
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Eq.comm {a b : α} : a = b ↔ b = a
Iff.intro Eq.symm Eq.symm
theorem
Eq.comm
Init
src/Init/Core.lean
[]
[ "Eq.symm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
eq_comm {a b : α} : a = b ↔ b = a
Eq.comm
theorem
eq_comm
Init
src/Init/Core.lean
[]
[ "Eq.comm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HEq.comm {a : α} {b : β} : a ≍ b ↔ b ≍ a
Iff.intro HEq.symm HEq.symm
theorem
HEq.comm
Init
src/Init/Core.lean
[]
[ "HEq.symm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
heq_comm {a : α} {b : β} : a ≍ b ↔ b ≍ a
HEq.comm
theorem
heq_comm
Init
src/Init/Core.lean
[]
[ "HEq.comm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.symm (h : a ↔ b) : b ↔ a
Iff.intro h.mpr h.mp
theorem
Iff.symm
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.comm : (a ↔ b) ↔ (b ↔ a)
Iff.intro Iff.symm Iff.symm
theorem
Iff.comm
Init
src/Init/Core.lean
[]
[ "Iff.symm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_comm : (a ↔ b) ↔ (b ↔ a)
Iff.comm
theorem
iff_comm
Init
src/Init/Core.lean
[]
[ "Iff.comm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
And.symm : a ∧ b → b ∧ a
fun ⟨ha, hb⟩ => ⟨hb, ha⟩
theorem
And.symm
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
And.comm : a ∧ b ↔ b ∧ a
Iff.intro And.symm And.symm
theorem
And.comm
Init
src/Init/Core.lean
[]
[ "And.symm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
and_comm : a ∧ b ↔ b ∧ a
And.comm
theorem
and_comm
Init
src/Init/Core.lean
[]
[ "And.comm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Or.symm : a ∨ b → b ∨ a
.rec .inr .inl
theorem
Or.symm
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Or.comm : a ∨ b ↔ b ∨ a
Iff.intro Or.symm Or.symm
theorem
Or.comm
Init
src/Init/Core.lean
[]
[ "Or.symm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
or_comm : a ∨ b ↔ b ∨ a
Or.comm
theorem
or_comm
Init
src/Init/Core.lean
[]
[ "Or.comm" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Exists.elim {α : Sort u} {p : α → Prop} {b : Prop} (h₁ : Exists (fun x => p x)) (h₂ : ∀ (a : α), p a → b) : b
match h₁ with | intro a h => h₂ a h
theorem
Exists.elim
Init
src/Init/Core.lean
[]
[ "Exists" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
decide_true (h : Decidable True) : @decide True h = true
match h with | isTrue _ => rfl | isFalse h => False.elim <| h ⟨⟩
theorem
decide_true
Init
src/Init/Core.lean
[]
[ "Decidable", "False.elim", "True", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
decide_false (h : Decidable False) : @decide False h = false
match h with | isFalse _ => rfl | isTrue h => False.elim h
theorem
decide_false
Init
src/Init/Core.lean
[]
[ "Decidable", "False", "False.elim", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
toBoolUsing {p : Prop} (d : Decidable p) : Bool
decide (h := d)
def
toBoolUsing
Init
src/Init/Core.lean
[]
[ "Bool", "Decidable" ]
Similar to `decide`, but uses an explicit instance
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
toBoolUsing_eq_true {p : Prop} (d : Decidable p) (h : p) : toBoolUsing d = true
decide_eq_true (inst := d) h
theorem
toBoolUsing_eq_true
Init
src/Init/Core.lean
[]
[ "Decidable", "decide_eq_true", "toBoolUsing" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
of_toBoolUsing_eq_true {p : Prop} {d : Decidable p} (h : toBoolUsing d = true) : p
of_decide_eq_true h
theorem
of_toBoolUsing_eq_true
Init
src/Init/Core.lean
[]
[ "Decidable", "of_decide_eq_true", "toBoolUsing" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
of_toBoolUsing_eq_false {p : Prop} {d : Decidable p} (h : toBoolUsing d = false) : ¬p
of_decide_eq_false h
theorem
of_toBoolUsing_eq_false
Init
src/Init/Core.lean
[]
[ "Decidable", "of_decide_eq_false", "toBoolUsing" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
byCases {q : Sort u} [dec : Decidable p] (h1 : p → q) (h2 : ¬p → q) : q
match dec with | isTrue h => h1 h | isFalse h => h2 h
def
Decidable.byCases
Init
src/Init/Core.lean
[]
[ "Decidable" ]
Construct a `q` if some proposition `p` is decidable, and both the truth and falsity of `p` are sufficient to construct a `q`. This is a synonym for `dite`, the dependent if-then-else operator.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
em (p : Prop) [Decidable p] : p ∨ ¬p
byCases Or.inl Or.inr
theorem
Decidable.em
Init
src/Init/Core.lean
[]
[ "Decidable" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
byContradiction [dec : Decidable p] (h : ¬p → False) : p
byCases id (fun np => False.elim (h np))
theorem
Decidable.byContradiction
Init
src/Init/Core.lean
[]
[ "Decidable", "False", "False.elim", "id" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
of_not_not [Decidable p] : ¬ ¬ p → p
fun hnn => byContradiction (fun hn => absurd hn hnn)
theorem
Decidable.of_not_not
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
not_and_iff_or_not {p q : Prop} [d₁ : Decidable p] [d₂ : Decidable q] : ¬ (p ∧ q) ↔ ¬ p ∨ ¬ q
Iff.intro (fun h => match d₁, d₂ with | isTrue h₁, isTrue h₂ => absurd (And.intro h₁ h₂) h | _, isFalse h₂ => Or.inr h₂ | isFalse h₁, _ => Or.inl h₁) (fun (h) ⟨hp, hq⟩ => match h with | Or.inl h => h hp | Or.inr h => h hq)
theorem
Decidable.not_and_iff_or_not
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
decidable_of_decidable_of_iff [Decidable p] (h : p ↔ q) : Decidable q
if hp : p then isTrue (Iff.mp h hp) else isFalse fun hq => absurd (Iff.mpr h hq) hp
def
decidable_of_decidable_of_iff
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd" ]
Transfer a decidability proof across an equivalence of propositions.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
decidable_of_decidable_of_eq [Decidable p] (h : p = q) : Decidable q
decidable_of_decidable_of_iff (p := p) (h ▸ Iff.rfl)
def
decidable_of_decidable_of_eq
Init
src/Init/Core.lean
[]
[ "Decidable", "Iff.rfl", "decidable_of_decidable_of_iff" ]
Transfer a decidability proof across an equality of propositions.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
if_pos {c : Prop} {h : Decidable c} (hc : c) {α : Sort u} {t e : α} : (ite c t e) = t
match h with | isTrue _ => rfl | isFalse hnc => absurd hc hnc
theorem
if_pos
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd", "ite", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
if_neg {c : Prop} {h : Decidable c} (hnc : ¬c) {α : Sort u} {t e : α} : (ite c t e) = e
match h with | isTrue hc => absurd hc hnc | isFalse _ => rfl
theorem
if_neg
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd", "ite", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iteInduction {c} [inst : Decidable c] {motive : α → Sort _} {t e : α} (hpos : c → motive t) (hneg : ¬c → motive e) : motive (ite c t e)
match inst with | isTrue h => hpos h | isFalse h => hneg h
def
iteInduction
Init
src/Init/Core.lean
[]
[ "Decidable", "ite" ]
Split an if-then-else into cases. The `split` tactic is generally easier to use than this theorem.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
dif_pos {c : Prop} {h : Decidable c} (hc : c) {α : Sort u} {t : c → α} {e : ¬ c → α} : (dite c t e) = t hc
match h with | isTrue _ => rfl | isFalse hnc => absurd hc hnc
theorem
dif_pos
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd", "dite", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
dif_neg {c : Prop} {h : Decidable c} (hnc : ¬c) {α : Sort u} {t : c → α} {e : ¬ c → α} : (dite c t e) = e hnc
match h with | isTrue hc => absurd hc hnc | isFalse _ => rfl
theorem
dif_neg
Init
src/Init/Core.lean
[]
[ "Decidable", "absurd", "dite", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
noConfusionTypeEnum {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f : α → β) (P : Sort w) (x y : α) : Sort w
(inst (f x) (f y)).casesOn (fun _ => P) (fun _ => P → P)
abbrev
noConfusionTypeEnum
Init
src/Init/Core.lean
[]
[ "DecidableEq" ]
Auxiliary definition for generating compact `noConfusion` for enumeration types
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
noConfusionEnum {α : Sort u} {β : Sort v} [inst : DecidableEq β] (f : α → β) {P : Sort w} {x y : α} (h : x = y) : noConfusionTypeEnum f P x y
Decidable.casesOn (motive := fun (inst : Decidable (f x = f y)) => Decidable.casesOn (motive := fun _ => Sort w) inst (fun _ => P) (fun _ => P → P)) (inst (f x) (f y)) (fun h' => False.elim (h' (congrArg f h))) (fun _ => fun x => x)
abbrev
noConfusionEnum
Init
src/Init/Core.lean
[]
[ "Decidable", "DecidableEq", "False.elim", "congrArg", "noConfusionTypeEnum" ]
Auxiliary definition for generating compact `noConfusion` for enumeration types
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Subsingleton (α : Sort u) : Prop where /-- Prove that `α` is a subsingleton by showing that any two elements are equal. -/ intro :: /-- Any two elements of a subsingleton are equal. -/ allEq : (a b : α) → a = b
class
Subsingleton
Init
src/Init/Core.lean
[]
[]
A _subsingleton_ is a type with at most one element. It is either empty or has a unique element. All propositions are subsingletons because of proof irrelevance: false propositions are empty, and all proofs of a true proposition are equal to one another. Some non-propositional types are also subsingletons.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Subsingleton.elim {α : Sort u} [h : Subsingleton α] : (a b : α) → a = b
h.allEq
theorem
Subsingleton.elim
Init
src/Init/Core.lean
[]
[ "Subsingleton" ]
If a type is a subsingleton, then all of its elements are equal.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Subsingleton.helim {α β : Sort u} [h₁ : Subsingleton α] (h₂ : α = β) (a : α) (b : β) : a ≍ b
by subst h₂ apply heq_of_eq apply Subsingleton.elim
theorem
Subsingleton.helim
Init
src/Init/Core.lean
[]
[ "Subsingleton", "Subsingleton.elim", "heq_of_eq" ]
If two types are equal and one of them is a subsingleton, then all of their elements are [heterogeneously equal](lean-manual://section/HEq).
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
recSubsingleton {p : Prop} [h : Decidable p] {h₁ : p → Sort u} {h₂ : ¬p → Sort u} [h₃ : ∀ (h : p), Subsingleton (h₁ h)] [h₄ : ∀ (h : ¬p), Subsingleton (h₂ h)] : Subsingleton (h.casesOn h₂ h₁)
match h with | isTrue h => h₃ h | isFalse h => h₄ h
theorem
recSubsingleton
Init
src/Init/Core.lean
[]
[ "Decidable", "Subsingleton" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Equivalence {α : Sort u} (r : α → α → Prop) : Prop where /-- An equivalence relation is reflexive: `r x x` -/ refl : ∀ x, r x x /-- An equivalence relation is symmetric: `r x y` implies `r y x` -/ symm : ∀ {x y}, r x y → r y x /-- An equivalence relation is transitive: `r x y` and `r y z` implies `r x z` -/...
structure
Equivalence
Init
src/Init/Core.lean
[]
[]
An equivalence relation `r : α → α → Prop` is a relation that is * reflexive: `r x x`, * symmetric: `r x y` implies `r y x`, and * transitive: `r x y` and `r y z` implies `r x z`. Equality is an equivalence relation, and equivalence relations share many of the properties of equality.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
emptyRelation {α : Sort u} (_ _ : α) : Prop
False
def
emptyRelation
Init
src/Init/Core.lean
[]
[ "False" ]
The empty relation is the relation on `α` which is always `False`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Subrelation {α : Sort u} (q r : α → α → Prop)
∀ {x y}, q x y → r x y
def
Subrelation
Init
src/Init/Core.lean
[]
[]
`Subrelation q r` means that `q ⊆ r` or `∀ x y, q x y → r x y`. It is the analogue of the subset relation on relations.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
InvImage {α : Sort u} {β : Sort v} (r : β → β → Prop) (f : α → β) : α → α → Prop
fun a₁ a₂ => r (f a₁) (f a₂)
def
InvImage
Init
src/Init/Core.lean
[]
[]
The inverse image of `r : β → β → Prop` by a function `α → β` is the relation `s : α → α → Prop` defined by `s a b = r (f a) (f b)`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Relation.TransGen {α : Sort u} (r : α → α → Prop) : α → α → Prop /-- If `r a b`, then `TransGen r a b`. This is the base case of the transitive closure. -/ | single {a b : α} : r a b → TransGen r a b /-- If `TransGen r a b` and `r b c`, then `TransGen r a c`. This is the inductive case of the transitive closure...
inductive
Relation.TransGen
Init
src/Init/Core.lean
[]
[]
The transitive closure `TransGen r` of a relation `r` is the smallest relation which is transitive and contains `r`. `TransGen r a z` if and only if there exists a sequence `a r b r ... r z` of length at least 1 connecting `a` to `z`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Relation.TransGen.trans {α : Sort u} {r : α → α → Prop} {a b c} : TransGen r a b → TransGen r b c → TransGen r a c
by intro hab hbc induction hbc with | single h => exact TransGen.tail hab h | tail _ h ih => exact TransGen.tail ih h
theorem
Relation.TransGen.trans
Init
src/Init/Core.lean
[]
[]
The transitive closure is transitive.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
exists_of_subtype {α : Type u} {p : α → Prop} : { x // p x } → Exists (fun x => p x)
| ⟨a, h⟩ => ⟨a, h⟩
theorem
Subtype.exists_of_subtype
Init
src/Init/Core.lean
[]
[ "Exists" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
ext : ∀ {a1 a2 : {x // p x}}, val a1 = val a2 → a1 = a2
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
theorem
Subtype.ext
Init
src/Init/Core.lean
[]
[ "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
eq : ∀ {a1 a2 : {x // p x}}, val a1 = val a2 → a1 = a2
| ⟨_, _⟩, ⟨_, _⟩, rfl => rfl
theorem
Subtype.eq
Init
src/Init/Core.lean
[]
[ "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
eta (a : {x // p x}) (h : p (val a)) : mk (val a) h = a
by cases a exact rfl
theorem
Subtype.eta
Init
src/Init/Core.lean
[]
[ "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Sum.inhabitedLeft [Inhabited α] : Inhabited (Sum α β)
where default := Sum.inl default
def
Sum.inhabitedLeft
Init
src/Init/Core.lean
[]
[ "Inhabited", "Sum" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Sum.inhabitedRight [Inhabited β] : Inhabited (Sum α β)
where default := Sum.inr default
def
Sum.inhabitedRight
Init
src/Init/Core.lean
[]
[ "Inhabited", "Sum" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Sum.nonemptyLeft [h : Nonempty α] : Nonempty (Sum α β)
Nonempty.elim h (fun a => ⟨Sum.inl a⟩)
instance
Sum.nonemptyLeft
Init
src/Init/Core.lean
[]
[ "Nonempty", "Nonempty.elim", "Sum" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Sum.nonemptyRight [h : Nonempty β] : Nonempty (Sum α β)
Nonempty.elim h (fun b => ⟨Sum.inr b⟩) deriving instance DecidableEq for Sum
instance
Sum.nonemptyRight
Init
src/Init/Core.lean
[]
[ "DecidableEq", "Nonempty", "Nonempty.elim", "Sum" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.lexLt [LT α] [LT β] (s : α × β) (t : α × β) : Prop
s.1 < t.1 ∨ (s.1 = t.1 ∧ s.2 < t.2)
def
Prod.lexLt
Init
src/Init/Core.lean
[]
[ "LT" ]
Lexicographical order for products. Two pairs are lexicographically ordered if their first elements are ordered or if their first elements are equal and their second elements are ordered.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.lexLtDec [LT α] [LT β] [DecidableEq α] [(a b : α) → Decidable (a < b)] [(a b : β) → Decidable (a < b)] : (s t : α × β) → Decidable (Prod.lexLt s t)
fun _ _ => inferInstanceAs (Decidable (_ ∨ _))
instance
Prod.lexLtDec
Init
src/Init/Core.lean
[]
[ "Decidable", "DecidableEq", "LT", "Prod.lexLt" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.lexLt_def [LT α] [LT β] (s t : α × β) : (Prod.lexLt s t) = (s.1 < t.1 ∨ (s.1 = t.1 ∧ s.2 < t.2))
rfl
theorem
Prod.lexLt_def
Init
src/Init/Core.lean
[]
[ "LT", "Prod.lexLt", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.eta (p : α × β) : (p.1, p.2) = p
rfl
theorem
Prod.eta
Init
src/Init/Core.lean
[]
[ "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.map {α₁ : Type u₁} {α₂ : Type u₂} {β₁ : Type v₁} {β₂ : Type v₂} (f : α₁ → α₂) (g : β₁ → β₂) : α₁ × β₁ → α₂ × β₂
| (a, b) => (f a, g b)
def
Prod.map
Init
src/Init/Core.lean
[]
[]
Transforms a pair by applying functions to both elements. Examples: * `(1, 2).map (· + 1) (· * 3) = (2, 6)` * `(1, 2).map toString (· * 3) = ("1", 6)`
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.map_apply (f : α → β) (g : γ → δ) (x) (y) : Prod.map f g (x, y) = (f x, g y)
rfl
theorem
Prod.map_apply
Init
src/Init/Core.lean
[]
[ "Prod.map", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.map_fst (f : α → β) (g : γ → δ) (x) : (Prod.map f g x).1 = f x.1
rfl
theorem
Prod.map_fst
Init
src/Init/Core.lean
[]
[ "Prod.map", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Prod.map_snd (f : α → β) (g : γ → δ) (x) : (Prod.map f g x).2 = g x.2
rfl
theorem
Prod.map_snd
Init
src/Init/Core.lean
[]
[ "Prod.map", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Exists.of_psigma_prop {α : Sort u} {p : α → Prop} : (PSigma (fun x => p x)) → Exists (fun x => p x)
| ⟨x, hx⟩ => ⟨x, hx⟩
theorem
Exists.of_psigma_prop
Init
src/Init/Core.lean
[]
[ "Exists", "PSigma" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
PSigma.eta {α : Sort u} {β : α → Sort v} {a₁ a₂ : α} {b₁ : β a₁} {b₂ : β a₂} (h₁ : a₁ = a₂) (h₂ : Eq.ndrec b₁ h₁ = b₂) : PSigma.mk a₁ b₁ = PSigma.mk a₂ b₂
by subst h₁ subst h₂ exact rfl
theorem
PSigma.eta
Init
src/Init/Core.lean
[]
[ "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
PUnit.ext (a b : PUnit) : a = b
by cases a; cases b; exact rfl
theorem
PUnit.ext
Init
src/Init/Core.lean
[]
[ "PUnit", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
PUnit.subsingleton (a b : PUnit) : a = b
by cases a; cases b; exact rfl
theorem
PUnit.subsingleton
Init
src/Init/Core.lean
[]
[ "PUnit", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
PUnit.eq_punit (a : PUnit) : a = ⟨⟩
PUnit.ext a ⟨⟩
theorem
PUnit.eq_punit
Init
src/Init/Core.lean
[]
[ "PUnit", "PUnit.ext" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Setoid (α : Sort u) where /-- `x ≈ y` is the distinguished equivalence relation of a setoid. -/ r : α → α → Prop /-- The relation `x ≈ y` is an equivalence relation. -/ iseqv : Equivalence r
class
Setoid
Init
src/Init/Core.lean
[]
[ "Equivalence" ]
A setoid is a type with a distinguished equivalence relation, denoted `≈`. The `Quotient` type constructor requires a `Setoid` instance.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
refl (a : α) : a ≈ a
iseqv.refl a
theorem
Setoid.refl
Init
src/Init/Core.lean
[]
[]
A setoid's equivalence relation is reflexive.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
symm {a b : α} (hab : a ≈ b) : b ≈ a
iseqv.symm hab
theorem
Setoid.symm
Init
src/Init/Core.lean
[]
[]
A setoid's equivalence relation is symmetric.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
trans {a b c : α} (hab : a ≈ b) (hbc : b ≈ c) : a ≈ c
iseqv.trans hab hbc
theorem
Setoid.trans
Init
src/Init/Core.lean
[]
[]
A setoid's equivalence relation is transitive.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
propext {a b : Prop} : (a ↔ b) → a = b
axiom
propext
Init
src/Init/Core.lean
[]
[]
The [axiom](lean-manual://section/axioms) of **propositional extensionality**. It asserts that if propositions `a` and `b` are logically equivalent (that is, if `a` can be proved from `b` and vice versa), then `a` and `b` are *equal*, meaning `a` can be replaced with `b` in all contexts. The standard logical connectiv...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Eq.propIntro {a b : Prop} (h₁ : a → b) (h₂ : b → a) : a = b
propext <| Iff.intro h₁ h₂
theorem
Eq.propIntro
Init
src/Init/Core.lean
[]
[ "propext" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Lean.injEq_helper {P Q R : Prop} : (P → Q → R) → (P ∧ Q → R)
by intro h ⟨h₁,h₂⟩; exact h h₁ h₂ gen_injective_theorems% Array gen_injective_theorems% BitVec gen_injective_theorems% ByteArray gen_injective_theorems% Char gen_injective_theorems% DoResultBC gen_injective_theorems% DoResultPR gen_injective_theorems% DoResultPRBC gen_injective_theorems% DoResultSBC gen_injective_theo...
theorem
Lean.injEq_helper
Init
src/Init/Core.lean
[]
[ "Array", "BitVec", "ByteArray", "Char", "DoResultBC", "DoResultPR", "DoResultPRBC", "DoResultSBC", "EStateM.Result", "Except", "Fin", "ForInStep", "Lean.Name", "Lean.Syntax", "List", "MProd", "NonScalar", "Option", "PLift", "PNonScalar", "PProd", "PSigma", "PSum", "Prod...
Helper theorem for proving injectivity theorems
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.succ.inj {m n : Nat} : m.succ = n.succ → m = n
fun x => Nat.noConfusion x id
theorem
Nat.succ.inj
Init
src/Init/Core.lean
[]
[ "Nat", "id" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.succ.injEq (u v : Nat) : (u.succ = v.succ) = (u = v)
Eq.propIntro Nat.succ.inj (congrArg Nat.succ)
theorem
Nat.succ.injEq
Init
src/Init/Core.lean
[]
[ "Eq.propIntro", "Nat", "Nat.succ.inj", "congrArg" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
beq_iff_eq [BEq α] [LawfulBEq α] {a b : α} : a == b ↔ a = b
⟨eq_of_beq, beq_of_eq⟩
theorem
beq_iff_eq
Init
src/Init/Core.lean
[]
[ "BEq", "LawfulBEq" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Not.elim {α : Sort _} (H1 : ¬a) (H2 : a) : α
absurd H2 H1
def
Not.elim
Init
src/Init/Core.lean
[]
[ "absurd" ]
*Ex falso* for negation: from `¬a` and `a` anything follows. This is the same as `absurd` with the arguments flipped, but it is in the `Not` namespace so that projection notation can be used.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
And.elim (f : a → b → α) (h : a ∧ b) : α
f h.left h.right
abbrev
And.elim
Init
src/Init/Core.lean
[]
[]
Non-dependent eliminator for `And`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.elim (f : (a → b) → (b → a) → α) (h : a ↔ b) : α
f h.mp h.mpr
def
Iff.elim
Init
src/Init/Core.lean
[]
[]
Non-dependent eliminator for `Iff`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Iff.subst {a b : Prop} {p : Prop → Prop} (h₁ : a ↔ b) (h₂ : p a) : p b
Eq.subst (propext h₁) h₂
theorem
Iff.subst
Init
src/Init/Core.lean
[]
[ "Eq.subst", "propext" ]
Iff can now be used to do substitutions in a calculation
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Not.intro {a : Prop} (h : a → False) : ¬a
h
theorem
Not.intro
Init
src/Init/Core.lean
[]
[ "False" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Not.imp {a b : Prop} (H2 : ¬b) (H1 : a → b) : ¬a
mt H1 H2
theorem
Not.imp
Init
src/Init/Core.lean
[]
[ "mt" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
not_congr (h : a ↔ b) : ¬a ↔ ¬b
⟨mt h.2, mt h.1⟩
theorem
not_congr
Init
src/Init/Core.lean
[]
[ "mt" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
not_not_not : ¬¬¬a ↔ ¬a
⟨mt not_not_intro, not_not_intro⟩
theorem
not_not_not
Init
src/Init/Core.lean
[]
[ "not_not_intro" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_of_true (ha : a) (hb : b) : a ↔ b
Iff.intro (fun _ => hb) (fun _ => ha)
theorem
iff_of_true
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_of_false (ha : ¬a) (hb : ¬b) : a ↔ b
Iff.intro ha.elim hb.elim
theorem
iff_of_false
Init
src/Init/Core.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_true_left (ha : a) : (a ↔ b) ↔ b
Iff.intro (·.mp ha) (iff_of_true ha)
theorem
iff_true_left
Init
src/Init/Core.lean
[]
[ "iff_of_true" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_true_right (ha : a) : (b ↔ a) ↔ b
Iff.comm.trans (iff_true_left ha)
theorem
iff_true_right
Init
src/Init/Core.lean
[]
[ "iff_true_left" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_false_left (ha : ¬a) : (a ↔ b) ↔ ¬b
Iff.intro (mt ·.mpr ha) (iff_of_false ha)
theorem
iff_false_left
Init
src/Init/Core.lean
[]
[ "iff_of_false", "mt" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
iff_false_right (ha : ¬a) : (b ↔ a) ↔ ¬b
Iff.comm.trans (iff_false_left ha)
theorem
iff_false_right
Init
src/Init/Core.lean
[]
[ "iff_false_left" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6