Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion. • 103 items • Updated • 3
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 |
|---|---|---|---|---|---|---|---|---|---|---|
binderNameHint {α : Sort u} {β : Sort v} {γ : Sort w} (v : α) (binder : β) (e : γ) : γ | e | def | binderNameHint | Init | src/Init/BinderNameHint.lean | [
"Init.Tactics"
] | [] | The expression `binderNameHint v binder e` defined to be `e`.
If it is used on the right-hand side of an equation that is used for rewriting by `rw` or `simp`,
and `v` is a local variable, and `binder` is an expression that (after beta-reduction) is a binder
(`fun w => …` or `∀ w, …`), then it will rename `v` to the n... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
if_true {_ : Decidable True} (t e : α) : ite True t e = t | if_pos trivial | theorem | if_true | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"True",
"if_pos",
"ite",
"trivial"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
if_false {_ : Decidable False} (t e : α) : ite False t e = e | if_neg id | theorem | if_false | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"False",
"id",
"if_neg",
"ite"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ite_id [Decidable c] {α} (t : α) : (if c then t else t) = t | by split <;> rfl | theorem | ite_id | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
apply_dite (f : α → β) (P : Prop) [Decidable P] (x : P → α) (y : ¬P → α) :
f (dite P x y) = dite P (fun h => f (x h)) (fun h => f (y h)) | by
by_cases h : P <;> simp [h] | theorem | apply_dite | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"dite"
] | A function applied to a `dite` is a `dite` of that function applied to each of the branches. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
apply_ite (f : α → β) (P : Prop) [Decidable P] (x y : α) :
f (ite P x y) = ite P (f x) (f y) | apply_dite f P (fun _ => x) (fun _ => y) | theorem | apply_ite | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"apply_dite",
"ite"
] | A function applied to a `ite` is a `ite` of that function applied to each of the branches. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
dite_eq_ite [Decidable P] :
(dite P (fun _ => a) (fun _ => b)) = ite P a b | rfl | theorem | dite_eq_ite | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"dite",
"ite",
"rfl"
] | A `dite` whose results do not actually depend on the condition may be reduced to an `ite`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
dif_eq_if (c : Prop) {h : Decidable c} {α : Sort u} (t : α) (e : α) : dite c (fun _ => t) (fun _ => e) = ite c t e | match h with
| isTrue _ => rfl
| isFalse _ => rfl | theorem | dif_eq_if | Init | src/Init/ByCases.lean | [
"Init.SimpLemmas"
] | [
"Decidable",
"dite",
"ite",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
indefiniteDescription {α : Sort u} (p : α → Prop) (h : ∃ x, p x) : {x // p x} | choice <| let ⟨x, px⟩ := h; ⟨⟨x, px⟩⟩ | def | Classical.indefiniteDescription | Init | src/Init/Classical.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
choose {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : α | (indefiniteDescription p h).val | def | Classical.choose | Init | src/Init/Classical.lean | [] | [] | Given that there exists an element satisfying `p`, returns one such element.
This is a straightforward consequence of, and equivalent to, `Classical.choice`.
See also `choose_spec`, which asserts that the returned value has property `p`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
choose_spec {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : p (choose h) | (indefiniteDescription p h).property | theorem | Classical.choose_spec | Init | src/Init/Classical.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
em (p : Prop) : p ∨ ¬p | let U (x : Prop) : Prop := x = True ∨ p
let V (x : Prop) : Prop := x = False ∨ p
have exU : ∃ x, U x := ⟨True, Or.inl rfl⟩
have exV : ∃ x, V x := ⟨False, Or.inl rfl⟩
let u : Prop := choose exU
let v : Prop := choose exV
have u_def : U u := choose_spec exU
have v_def : V v := choose_spec exV
have not_uv_... | theorem | Classical.em | Init | src/Init/Classical.lean | [] | [
"False",
"True",
"funext",
"mt",
"propext",
"rfl"
] | **Diaconescu's theorem**: excluded middle from choice, Function extensionality and propositional extensionality. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
exists_true_of_nonempty {α : Sort u} : Nonempty α → ∃ _ : α, True | | ⟨x⟩ => ⟨x, trivial⟩ | theorem | Classical.exists_true_of_nonempty | Init | src/Init/Classical.lean | [] | [
"Nonempty",
"True"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
inhabited_of_nonempty {α : Sort u} (h : Nonempty α) : Inhabited α | ⟨choice h⟩ | def | Classical.inhabited_of_nonempty | Init | src/Init/Classical.lean | [] | [
"Inhabited",
"Nonempty"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
inhabited_of_exists {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : Inhabited α | inhabited_of_nonempty (Exists.elim h (fun w _ => ⟨w⟩)) | def | Classical.inhabited_of_exists | Init | src/Init/Classical.lean | [] | [
"Exists.elim",
"Inhabited"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
decidableInhabited (a : Prop) : Inhabited (Decidable a) | where
default := inferInstance | def | Classical.decidableInhabited | Init | src/Init/Classical.lean | [] | [
"Decidable",
"Inhabited",
"inferInstance"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
typeDecidableEq (α : Sort u) : DecidableEq α | fun _ _ => inferInstance | def | Classical.typeDecidableEq | Init | src/Init/Classical.lean | [] | [
"DecidableEq",
"inferInstance"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
typeDecidable (α : Sort u) : PSum α (α → False) | match (propDecidable (Nonempty α)) with
| (isTrue hp) => PSum.inl (@default _ (inhabited_of_nonempty hp))
| (isFalse hn) => PSum.inr (fun a => absurd (Nonempty.intro a) hn) | def | Classical.typeDecidable | Init | src/Init/Classical.lean | [] | [
"False",
"Nonempty",
"PSum",
"absurd"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
strongIndefiniteDescription {α : Sort u} (p : α → Prop) (h : Nonempty α) : {x : α // (∃ y : α, p y) → p x} | @dite _ (∃ x : α, p x) (propDecidable _)
(fun (hp : ∃ x : α, p x) =>
show {x : α // (∃ y : α, p y) → p x} from
let xp := indefiniteDescription _ hp;
⟨xp.val, fun _ => xp.property⟩)
(fun hp => ⟨choice h, fun h => absurd h hp⟩) | def | Classical.strongIndefiniteDescription | Init | src/Init/Classical.lean | [] | [
"Nonempty",
"absurd",
"dite"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
epsilon {α : Sort u} [h : Nonempty α] (p : α → Prop) : α | (strongIndefiniteDescription p h).val | def | Classical.epsilon | Init | src/Init/Classical.lean | [] | [
"Nonempty"
] | The Hilbert epsilon function. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
epsilon_spec_aux {α : Sort u} (h : Nonempty α) (p : α → Prop) : (∃ y, p y) → p (@epsilon α h p) | (strongIndefiniteDescription p h).property | theorem | Classical.epsilon_spec_aux | Init | src/Init/Classical.lean | [] | [
"Nonempty"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
epsilon_spec {α : Sort u} {p : α → Prop} (hex : ∃ y, p y) : p (@epsilon α hex.nonempty p) | epsilon_spec_aux hex.nonempty p hex | theorem | Classical.epsilon_spec | Init | src/Init/Classical.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
epsilon_singleton {α : Sort u} (x : α) : @epsilon α ⟨x⟩ (fun y => y = x) = x | @epsilon_spec α (fun y => y = x) ⟨x, rfl⟩ | theorem | Classical.epsilon_singleton | Init | src/Init/Classical.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
axiomOfChoice {α : Sort u} {β : α → Sort v} {r : ∀ x, β x → Prop} (h : ∀ x, ∃ y, r x y) : ∃ (f : ∀ x, β x), ∀ x, r x (f x) | ⟨_, fun x => choose_spec (h x)⟩ | theorem | Classical.axiomOfChoice | Init | src/Init/Classical.lean | [] | [] | the axiom of choice | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
skolem {α : Sort u} {b : α → Sort v} {p : ∀ x, b x → Prop} : (∀ x, ∃ y, p x y) ↔ ∃ (f : ∀ x, b x), ∀ x, p x (f x) | ⟨axiomOfChoice, fun ⟨f, hw⟩ (x) => ⟨f x, hw x⟩⟩ | theorem | Classical.skolem | Init | src/Init/Classical.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
propComplete (a : Prop) : a = True ∨ a = False | match em a with
| Or.inl ha => Or.inl (eq_true ha)
| Or.inr hn => Or.inr (eq_false hn) | theorem | Classical.propComplete | Init | src/Init/Classical.lean | [] | [
"False",
"True",
"eq_false",
"eq_true"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
byCases {p q : Prop} (hpq : p → q) (hnpq : ¬p → q) : q | Decidable.byCases (dec := propDecidable _) hpq hnpq | theorem | Classical.byCases | Init | src/Init/Classical.lean | [] | [
"Decidable.byCases"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
byContradiction {p : Prop} (h : ¬p → False) : p | Decidable.byContradiction (dec := propDecidable _) h | theorem | Classical.byContradiction | Init | src/Init/Classical.lean | [] | [
"Decidable.byContradiction",
"False"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_not : ¬¬a ↔ a | Decidable.not_not | theorem | Classical.not_not | Init | src/Init/Classical.lean | [] | [
"Decidable.not_not"
] | The Double Negation Theorem: `¬¬P` is equivalent to `P`.
The left-to-right direction, double negation elimination (DNE),
is classically true but not constructively. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
decidable_of_decidable_not (p : Prop) [h : Decidable (¬ p)] : Decidable p | match h with
| isFalse h => isTrue (Classical.not_not.mp h)
| isTrue h => isFalse h | def | Classical.decidable_of_decidable_not | Init | src/Init/Classical.lean | [] | [
"Decidable"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
dite_not [hn : Decidable (¬p)] (x : ¬p → α) (y : ¬¬p → α) :
dite (¬p) x y = dite p (fun h => y (not_not_intro h)) x | by
cases hn <;> rename_i g
· simp [not_not.mp g]
· simp [g] | theorem | Classical.dite_not | Init | src/Init/Classical.lean | [] | [
"Decidable",
"dite",
"dite_not",
"not_not_intro"
] | Negation of the condition `P : Prop` in a `dite` is the same as swapping the branches. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
ite_not (p : Prop) [Decidable (¬ p)] (x y : α) : ite (¬p) x y = ite p y x | dite_not (fun _ => x) (fun _ => y) | theorem | Classical.ite_not | Init | src/Init/Classical.lean | [] | [
"Decidable",
"dite_not",
"ite",
"ite_not"
] | Negation of the condition `P : Prop` in a `ite` is the same as swapping the branches. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
decide_not (p : Prop) [Decidable (¬ p)] : decide (¬p) = !decide p | byCases (fun h : p => by simp_all) (fun h => by simp_all) | theorem | Classical.decide_not | Init | src/Init/Classical.lean | [] | [
"Decidable",
"decide_not"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_forall {p : α → Prop} : (¬∀ x, p x) ↔ ∃ x, ¬p x | Decidable.not_forall | theorem | Classical.not_forall | Init | src/Init/Classical.lean | [] | [
"Decidable.not_forall"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_forall_not {p : α → Prop} : (¬∀ x, ¬p x) ↔ ∃ x, p x | Decidable.not_forall_not | theorem | Classical.not_forall_not | Init | src/Init/Classical.lean | [] | [
"Decidable.not_forall_not"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_exists_not {p : α → Prop} : (¬∃ x, ¬p x) ↔ ∀ x, p x | Decidable.not_exists_not | theorem | Classical.not_exists_not | Init | src/Init/Classical.lean | [] | [
"Decidable.not_exists_not"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
forall_or_exists_not (P : α → Prop) : (∀ a, P a) ∨ ∃ a, ¬ P a | by
rw [← not_forall]; exact em _ | theorem | Classical.forall_or_exists_not | Init | src/Init/Classical.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
exists_or_forall_not (P : α → Prop) : (∃ a, P a) ∨ ∀ a, ¬ P a | by
rw [← not_exists]; exact em _ | theorem | Classical.exists_or_forall_not | Init | src/Init/Classical.lean | [] | [
"not_exists"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
or_iff_not_imp_left : a ∨ b ↔ (¬a → b) | Decidable.or_iff_not_imp_left | theorem | Classical.or_iff_not_imp_left | Init | src/Init/Classical.lean | [] | [
"Decidable.or_iff_not_imp_left"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
or_iff_not_imp_right : a ∨ b ↔ (¬b → a) | Decidable.or_iff_not_imp_right | theorem | Classical.or_iff_not_imp_right | Init | src/Init/Classical.lean | [] | [
"Decidable.or_iff_not_imp_right"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_imp_iff_and_not : ¬(a → b) ↔ a ∧ ¬b | Decidable.not_imp_iff_and_not | theorem | Classical.not_imp_iff_and_not | Init | src/Init/Classical.lean | [] | [
"Decidable.not_imp_iff_and_not"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_and_iff_not_or_not : ¬(a ∧ b) ↔ ¬a ∨ ¬b | Decidable.not_and_iff_not_or_not | theorem | Classical.not_and_iff_not_or_not | Init | src/Init/Classical.lean | [] | [
"Decidable.not_and_iff_not_or_not"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_iff : ¬(a ↔ b) ↔ (¬a ↔ b) | Decidable.not_iff | theorem | Classical.not_iff | Init | src/Init/Classical.lean | [] | [
"Decidable.not_iff"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
imp_iff_left_iff : (b ↔ a → b) ↔ a ∨ b | Decidable.imp_iff_left_iff | theorem | Classical.imp_iff_left_iff | Init | src/Init/Classical.lean | [] | [
"Decidable.imp_iff_left_iff"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
imp_iff_right_iff : (a → b ↔ b) ↔ a ∨ b | Decidable.imp_iff_right_iff | theorem | Classical.imp_iff_right_iff | Init | src/Init/Classical.lean | [] | [
"Decidable.imp_iff_right_iff"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
and_or_imp : a ∧ b ∨ (a → c) ↔ a → b ∨ c | Decidable.and_or_imp | theorem | Classical.and_or_imp | Init | src/Init/Classical.lean | [] | [
"Decidable.and_or_imp"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_imp : ¬(a → b) ↔ a ∧ ¬b | Decidable.not_imp_iff_and_not | theorem | Classical.not_imp | Init | src/Init/Classical.lean | [] | [
"Decidable.not_imp_iff_and_not"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
imp_and_neg_imp_iff (p : Prop) {q : Prop} : (p → q) ∧ (¬p → q) ↔ q | Iff.intro (fun (a : _ ∧ _) => (Classical.em p).rec a.left a.right)
(fun a => And.intro (fun _ => a) (fun _ => a)) | theorem | Classical.imp_and_neg_imp_iff | Init | src/Init/Classical.lean | [] | [
"Classical.em"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Exists.choose {p : α → Prop} (P : ∃ a, p a) : α | Classical.choose P | def | Exists.choose | Init | src/Init/Classical.lean | [] | [
"Classical.choose"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Exists.choose_spec {p : α → Prop} (P : ∃ a, p a) : p P.choose | Classical.choose_spec P
grind_pattern Exists.choose_spec => P.choose | theorem | Exists.choose_spec | Init | src/Init/Classical.lean | [] | [
"Classical.choose_spec"
] | Show that an element extracted from `P : ∃ a, p a` using `P.choose` satisfies `p`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Coe (α : semiOutParam (Sort u)) (β : Sort v) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | Coe | Init | src/Init/Coe.lean | [] | [
"semiOutParam"
] | `Coe α β` is the typeclass for coercions from `α` to `β`. It can be transitively
chained with other `Coe` instances, and coercion is automatically used when
`x` has type `α` but it is used in a context where `β` is expected.
You can use the `↑x` operator to explicitly trigger coercion. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeTC (α : Sort u) (β : Sort v) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeTC | Init | src/Init/Coe.lean | [] | [] | Auxiliary class implementing `Coe*`.
Users should generally not implement this directly. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeOut (α : Sort u) (β : semiOutParam (Sort v)) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeOut | Init | src/Init/Coe.lean | [] | [
"semiOutParam"
] | `CoeOut α β` is for coercions that are applied from left-to-right. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeOTC (α : Sort u) (β : Sort v) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeOTC | Init | src/Init/Coe.lean | [] | [] | Auxiliary class implementing `CoeOut* Coe*`.
Users should generally not implement this directly. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeHead (α : Sort u) (β : semiOutParam (Sort v)) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeHead | Init | src/Init/Coe.lean | [] | [
"semiOutParam"
] | `CoeHead α β` is for coercions that are applied from left-to-right at most once
at beginning of the coercion chain. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeHTC (α : Sort u) (β : Sort v) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeHTC | Init | src/Init/Coe.lean | [] | [] | Auxiliary class implementing `CoeHead CoeOut* Coe*`.
Users should generally not implement this directly. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeTail (α : semiOutParam (Sort u)) (β : Sort v) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeTail | Init | src/Init/Coe.lean | [] | [
"semiOutParam"
] | `CoeTail α β` is for coercions that can only appear at the end of a
sequence of coercions. That is, `α` can be further coerced via `Coe σ α` and
`CoeHead τ σ` instances but `β` will only be the expected type of the expression. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeHTCT (α : Sort u) (β : Sort v) where
/-- Coerces a value of type `α` to type `β`. Accessible by the notation `↑x`,
or by double type ascription `((x : α) : β)`. -/
coe : α → β | class | CoeHTCT | Init | src/Init/Coe.lean | [] | [] | Auxiliary class implementing `CoeHead* Coe* CoeTail?`.
Users should generally not implement this directly. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeDep (α : Sort u) (_ : α) (β : Sort v) where
/-- The resulting value of type `β`. The input `x : α` is a parameter to
the type class, so the value of type `β` may possibly depend on additional
typeclasses on `x`. -/
coe : β | class | CoeDep | Init | src/Init/Coe.lean | [] | [] | `CoeDep α (x : α) β` is a typeclass for dependent coercions, that is, the type `β`
can depend on `x` (or rather, the value of `x` is available to typeclass search
so an instance that relates `β` to `x` is allowed).
Dependent coercions do not participate in the transitive chaining process of
regular coercions: they mus... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeT (α : Sort u) (_ : α) (β : Sort v) where
/-- The resulting value of type `β`. The input `x : α` is a parameter to
the type class, so the value of type `β` may possibly depend on additional
typeclasses on `x`. -/
coe : β | class | CoeT | Init | src/Init/Coe.lean | [] | [] | `CoeT` is the core typeclass which is invoked by Lean to resolve a type error.
It can also be triggered explicitly with the notation `↑x` or by double type
ascription `((x : α) : β)`.
A `CoeT` chain has the grammar `CoeHead? CoeOut* Coe* CoeTail? | CoeDep`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeFun (α : Sort u) (γ : outParam (α → Sort v)) where
/-- Coerces a value `f : α` to type `γ f`, which should be either be a
function type or another `CoeFun` type, in order to resolve a mistyped
application `f x`. -/
coe : (f : α) → γ f | class | CoeFun | Init | src/Init/Coe.lean | [] | [
"outParam"
] | `CoeFun α (γ : α → Sort v)` is a coercion to a function. `γ a` should be a
(coercion-to-)function type, and this is triggered whenever an element
`f : α` appears in an application like `f x`, which would not make sense since
`f` does not have a function type.
`CoeFun` instances apply to `CoeOut` as well. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
CoeSort (α : Sort u) (β : outParam (Sort v)) where
/-- Coerces a value of type `α` to `β`, which must be a universe. -/
coe : α → β | class | CoeSort | Init | src/Init/Coe.lean | [] | [
"outParam"
] | `CoeSort α β` is a coercion to a sort. `β` must be a universe, and this is
triggered when `a : α` appears in a place where a type is expected, like
`(x : a)` or `a → a`.
`CoeSort` instances apply to `CoeOut` as well. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
boolToProp : Coe Bool Prop | where
coe b := Eq b true | instance | boolToProp | Init | src/Init/Coe.lean | [] | [
"Bool",
"Coe",
"Eq"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
boolToSort : CoeSort Bool Prop | where
coe b := b | instance | boolToSort | Init | src/Init/Coe.lean | [] | [
"Bool",
"CoeSort"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
decPropToBool (p : Prop) [Decidable p] : CoeDep Prop p Bool | where
coe := decide p | instance | decPropToBool | Init | src/Init/Coe.lean | [] | [
"Bool",
"CoeDep",
"Decidable"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
subtypeCoe {α : Sort u} {p : α → Prop} : CoeOut (Subtype p) α | where
coe v := v.val | instance | subtypeCoe | Init | src/Init/Coe.lean | [] | [
"CoeOut",
"Subtype"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Lean.Internal.liftCoeM {m : Type u → Type v} {n : Type u → Type w} {α β : Type u}
[MonadLiftT m n] [∀ a, CoeT α a β] [Monad n] (x : m α) : n β | do
let a ← liftM x
pure (CoeT.coe a) | abbrev | Lean.Internal.liftCoeM | Init | src/Init/Coe.lean | [] | [
"CoeT",
"Monad",
"MonadLiftT",
"liftM"
] | Helper definition used by the elaborator. It is not meant to be used directly by users.
This is used for coercions between monads, in the case where we want to apply
a monad lift and a coercion on the result type at the same time. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Lean.Internal.coeM {m : Type u → Type v} {α β : Type u}
[∀ a, CoeT α a β] [Monad m] (x : m α) : m β | do
let a ← x
pure (CoeT.coe a) | abbrev | Lean.Internal.coeM | Init | src/Init/Coe.lean | [] | [
"CoeT",
"Monad"
] | Helper definition used by the elaborator. It is not meant to be used directly by users.
This is used for coercing the result type under a monad. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
"rfl" : conv => `(conv| tactic => rfl) | macro | rfl | Init | src/Init/Conv.lean | [] | [] | `rfl` closes one conv goal "trivially", by using reflexivity
(that is, no rewriting). | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"done" : conv => `(conv| tactic' => done) | macro | done | Init | src/Init/Conv.lean | [] | [] | `done` succeeds iff there are no goals remaining. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"trace_state" : conv => `(conv| tactic' => trace_state) | macro | trace_state | Init | src/Init/Conv.lean | [] | [] | `trace_state` prints the current goal state. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
(name := allGoals) tk:"all_goals " s:convSeq : conv =>
`(conv| tactic' => all_goals%$tk conv' => $s) | macro | all_goals | Init | src/Init/Conv.lean | [] | [] | `all_goals tac` runs `tac` on each goal, concatenating the resulting goals, if any. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
(name := anyGoals) tk:"any_goals " s:convSeq : conv =>
`(conv| tactic' => any_goals%$tk conv' => $s) | macro | any_goals | Init | src/Init/Conv.lean | [] | [] | `any_goals tac` applies the tactic `tac` to every goal, and succeeds if at
least one application succeeds. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
(name := case) tk:"case " args:sepBy1(caseArg, "|") arr:" => " s:convSeq : conv =>
`(conv| tactic' => case%$tk $args|* =>%$arr conv' => ($s); all_goals rfl) | macro | case | Init | src/Init/Conv.lean | [] | [] | * `case tag => tac` focuses on the goal with case name `tag` and solves it using `tac`,
or else fails.
* `case tag x₁ ... xₙ => tac` additionally renames the `n` most recent hypotheses
with inaccessible names to the given names.
* `case tag₁ | tag₂ => tac` is equivalent to `(case tag₁ => tac); (case tag₂ => tac)`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
(name := case') tk:"case' " args:sepBy1(caseArg, "|") arr:" => " s:convSeq : conv =>
`(conv| tactic' => case'%$tk $args|* =>%$arr conv' => $s) | macro | case' | Init | src/Init/Conv.lean | [] | [] | `case'` is similar to the `case tag => tac` tactic, but does not ensure the goal
has been solved after applying `tac`, nor admits the goal if `tac` failed.
Recall that `case` closes the goal using `sorry` when `tac` fails, and
the tactic execution is not interrupted. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"next" args:(ppSpace binderIdent)* " => " tac:convSeq : conv => `(conv| case _ $args* => $tac) | macro | next | Init | src/Init/Conv.lean | [] | [] | `next => tac` focuses on the next goal and solves it using `tac`, or else fails.
`next x₁ ... xₙ => tac` additionally renames the `n` most recent hypotheses with
inaccessible names to the given names. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
(name := focus) tk:"focus " s:convSeq : conv => `(conv| tactic' => focus%$tk conv' => $s) | macro | focus | Init | src/Init/Conv.lean | [] | [] | `focus tac` focuses on the main goal, suppressing all other goals, and runs `tac` on it.
Usually `· tac`, which enforces that the goal is closed by `tac`, should be preferred. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
dot:unicode("· ", ". ") s:convSeq : conv => `(conv| {%$dot ($s) }) | macro | · | Init | src/Init/Conv.lean | [] | [] | `· conv` focuses on the main conv goal and tries to solve it using `s`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
(name := failIfSuccess) tk:"fail_if_success " s:convSeq : conv =>
`(conv| tactic' => fail_if_success%$tk conv' => $s) | macro | fail_if_success | Init | src/Init/Conv.lean | [] | [] | `fail_if_success t` fails if the tactic `t` succeeds. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"rw" c:optConfig s:rwRuleSeq : conv => `(conv| rewrite $c:optConfig $s) | macro | rw | Init | src/Init/Conv.lean | [] | [] | `rw [rules]` applies the given list of rewrite rules to the target.
See the `rw` tactic for more information. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"erw" c:optConfig s:rwRuleSeq : conv => `(conv| rw $[$(getConfigItems c)]* (transparency := .default) $s:rwRuleSeq) | macro | erw | Init | src/Init/Conv.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 | |
"args" : conv => `(conv| congr) | macro | args | Init | src/Init/Conv.lean | [] | [] | `args` traverses into all arguments. Synonym for `congr`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"left" : conv => `(conv| lhs) | macro | left | Init | src/Init/Conv.lean | [] | [] | `left` traverses into the left argument. Synonym for `lhs`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"right" : conv => `(conv| rhs) | macro | right | Init | src/Init/Conv.lean | [] | [] | `right` traverses into the right argument. Synonym for `rhs`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"intro" xs:(ppSpace colGt binderIdent)* : conv => `(conv| ext $xs*) | macro | intro | Init | src/Init/Conv.lean | [] | [] | `intro` traverses into binders. Synonym for `ext`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
"apply " e:term : conv => `(conv| tactic => apply $e) | macro | apply | Init | src/Init/Conv.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | ||
"try " t:convSeq : conv => `(conv| first | $t | skip) | macro | try | Init | src/Init/Conv.lean | [] | [] | `try tac` runs `tac` and succeeds even if `tac` failed. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
:1 x:conv tk:" <;> " y:conv:0 : conv =>
`(conv| tactic' => (conv' => $x:conv) <;>%$tk (conv' => $y:conv)) | macro | <;> | Init | src/Init/Conv.lean | [] | [] | `tac <;> tac'` runs `tac` on the main goal and `tac'` on each produced goal, concatenating all goals
produced by `tac'`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
inline {α : Sort u} (a : α) : α | a | def | inline | Init | src/Init/Core.lean | [] | [] | `inline (f x)` is an indication to the compiler to inline the definition of `f`
at the application site itself (by comparison to the `@[inline]` attribute,
which applies to all applications of the function). | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
id_def {α : Sort u} (a : α) : id a = a | rfl | theorem | id_def | Init | src/Init/Core.lean | [] | [
"id",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
eagerReduce {α : Sort u} (a : α) : α | a | def | eagerReduce | Init | src/Init/Core.lean | [] | [] | A helper gadget for instructing the kernel to eagerly reduce terms.
When the gadget wraps the argument of an application, then when checking that
the expected and inferred type of the argument match, the kernel will evaluate terms more eagerly.
It is often used to wrap `Eq.refl true` proof terms as `eagerReduce (Eq.re... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
flip {α : Sort u} {β : Sort v} {φ : Sort w} (f : α → β → φ) : β → α → φ | fun b a => f a b | def | flip | Init | src/Init/Core.lean | [] | [] | `flip f a b` is `f b a`. It is useful for "point-free" programming,
since it can sometimes be used to avoid introducing variables.
For example, `(·<·)` is the less-than relation,
and `flip (·<·)` is the greater-than relation. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Function.const_apply {y : β} {x : α} : const α y x = y | rfl | theorem | Function.const_apply | Init | src/Init/Core.lean | [] | [
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.comp_apply {f : β → δ} {g : α → β} {x : α} : comp f g x = f (g x) | rfl | theorem | Function.comp_apply | Init | src/Init/Core.lean | [] | [
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.comp_def {α β δ} (f : β → δ) (g : α → β) : f ∘ g = fun x => f (g x) | rfl | theorem | Function.comp_def | Init | src/Init/Core.lean | [] | [
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.const_comp {f : α → β} {c : γ} :
(Function.const β c ∘ f) = Function.const α c | rfl | theorem | Function.const_comp | Init | src/Init/Core.lean | [] | [
"Function.const",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.comp_const {f : β → γ} {b : β} :
(f ∘ Function.const α b) = Function.const α (f b) | rfl | theorem | Function.comp_const | Init | src/Init/Core.lean | [] | [
"Function.const",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.true_comp {f : α → β} : ((fun _ => true) ∘ f) = fun _ => true | rfl | theorem | Function.true_comp | Init | src/Init/Core.lean | [] | [
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.false_comp {f : α → β} : ((fun _ => false) ∘ f) = fun _ => false | rfl | theorem | Function.false_comp | Init | src/Init/Core.lean | [] | [
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Function.comp_id (f : α → β) : f ∘ id = f | rfl | theorem | Function.comp_id | Init | src/Init/Core.lean | [] | [
"id",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Structured dataset of definitions and theorems from the Lean 4 standard library (Init + Std).
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6| Column | Type | Description |
|---|---|---|
| statement | string | Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof |
| proof | string | Verbatim proof/body, empty if the declaration has none |
| type | string | Declaration keyword |
| symbolic_name | string | Declaration identifier |
| library | string | Sub-library |
| filename | string | Repository-relative source path |
| imports | list[string] | File-level Require/Import modules |
| deps | list[string] | Intra-corpus identifiers referenced |
| docstring | string | Preceding documentation comment, empty if absent |
| source_url | string | Upstream repository |
| commit | string | Upstream commit extracted |
| Type | Count |
|---|---|
| theorem | 42,996 |
| def | 7,688 |
| abbrev | 441 |
| structure | 426 |
| opaque | 383 |
| instance | 349 |
| class | 313 |
| inductive | 184 |
| macro | 172 |
| axiom | 15 |
| class inductive | 2 |
| class abbrev | 1 |
apply_dite (f : α → β) (P : Prop) [Decidable P] (x : P → α) (y : ¬P → α) :
f (dite P x y) = dite P (fun h => f (x h)) (fun h => f (y h))
by
by_cases h : P <;> simp [h]
apply_dite | src/Init/ByCases.leanEach declaration is split into a statement (signature/claim) and a proof (body) that are disjoint
and together form the complete declaration, for proof modeling, autoformalization, retrieval, and
dependency analysis via deps.
@misc{lean4_stdlib_dataset,
title = {Lean4-Stdlib},
author = {Norton, Charles},
year = {2026},
note = {Extracted from https://github.com/leanprover/lean4, commit d265d1ca745e},
url = {https://huggingface.co/datasets/phanerozoic/Lean4-Stdlib}
}