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 |
|---|---|---|---|---|---|---|---|---|---|---|
Function.id_comp (f : α → β) : id ∘ f = f | rfl | theorem | Function.id_comp | Init | src/Init/Core.lean | [] | [
"id",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Empty.elim {C : Sort u} : Empty → C | Empty.rec | def | Empty.elim | Init | src/Init/Core.lean | [] | [
"Empty"
] | `Empty.elim : Empty → C` says that a value of any type can be constructed from
`Empty`. This can be thought of as a compiler-checked assertion that a code path is unreachable. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
PEmpty.elim {C : Sort _} : PEmpty → C | fun a => nomatch a | def | PEmpty.elim | Init | src/Init/Core.lean | [] | [
"PEmpty"
] | `PEmpty.elim : Empty → C` says that a value of any type can be constructed from
`PEmpty`. This can be thought of as a compiler-checked assertion that a code path is unreachable. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Thunk (α : Type u) : Type u where
/--
Constructs a new thunk from a function `Unit → α` that will be called when the thunk is first
forced.
The result is cached. It is re-used when the thunk is forced again.
-/
mk ::
/-- Extract the getter function out of a thunk. Use `Thunk.get` instead. -/
-- The fie... | structure | Thunk | Init | src/Init/Core.lean | [] | [
"Unit"
] | Delays evaluation. The delayed code is evaluated at most once.
A thunk is code that constructs a value when it is requested via `Thunk.get`, `Thunk.map`, or
`Thunk.bind`. The resulting value is cached, so the code is executed at most once. This is also
known as lazy or call-by-need evaluation.
The Lean runtime has sp... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Thunk.pure (a : α) : Thunk α | ⟨fun _ => a⟩ | def | Thunk.pure | Init | src/Init/Core.lean | [] | [
"Thunk"
] | Stores an already-computed value in a thunk.
Because the value has already been computed, there is no laziness. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Thunk.get (x : @& Thunk α) : α | x.fn () | def | Thunk.get | Init | src/Init/Core.lean | [] | [
"Thunk"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Thunk.fnImpl (x : Thunk α) : Unit → α | fun _ => x.get | def | Thunk.fnImpl | Init | src/Init/Core.lean | [] | [
"Thunk",
"Unit"
] | Implementation detail. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Thunk.fn_eq_fnImpl : @Thunk.fn = @Thunk.fnImpl | rfl | theorem | Thunk.fn_eq_fnImpl | Init | src/Init/Core.lean | [] | [
"Thunk.fnImpl",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Thunk.map (f : α → β) (x : Thunk α) : Thunk β | ⟨fun _ => f x.get⟩ | def | Thunk.map | Init | src/Init/Core.lean | [] | [
"Thunk"
] | Constructs a new thunk that forces `x` and then applies `x` to the result. Upon forcing, the result
of `f` is cached and the reference to the thunk `x` is dropped. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Thunk.bind (x : Thunk α) (f : α → Thunk β) : Thunk β | ⟨fun _ => (f x.get).get⟩ | def | Thunk.bind | Init | src/Init/Core.lean | [] | [
"Thunk"
] | Constructs a new thunk that applies `f` to the result of `x` when forced. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Thunk.sizeOf_eq [SizeOf α] (a : Thunk α) : sizeOf a = 1 + sizeOf a.get | by
cases a; rfl | theorem | Thunk.sizeOf_eq | Init | src/Init/Core.lean | [] | [
"SizeOf",
"Thunk",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
thunkCoe : CoeTail α (Thunk α) | where
-- Since coercions are expanded eagerly, `a` is evaluated lazily.
coe a := ⟨fun _ => a⟩ | instance | thunkCoe | Init | src/Init/Core.lean | [] | [
"CoeTail",
"Thunk"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Eq.ndrecOn.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} {b : α} (h : a = b) (m : motive a) : motive b | Eq.ndrec m h | abbrev | Eq.ndrecOn. | Init | src/Init/Core.lean | [] | [] | A variation on `Eq.ndrec` with the equality argument first. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Iff (a b : Prop) : Prop where
/-- If `a → b` and `b → a` then `a` and `b` are equivalent. -/
intro ::
/-- Modus ponens for if and only if. If `a ↔ b` and `a`, then `b`. -/
mp : a → b
/-- Modus ponens for if and only if, reversed. If `a ↔ b` and `b`, then `a`. -/
mpr : b → a | structure | Iff | Init | src/Init/Core.lean | [] | [] | If and only if, or logical bi-implication. `a ↔ b` means that `a` implies `b` and vice versa.
By `propext`, this implies that `a` and `b` are equal and hence any expression involving `a`
is equivalent to the corresponding expression with `b` instead. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Sum (α : Type u) (β : Type v) where
/-- Left injection into the sum type `α ⊕ β`. -/
| inl (val : α) : Sum α β
/-- Right injection into the sum type `α ⊕ β`. -/
| inr (val : β) : Sum α β | inductive | Sum | Init | src/Init/Core.lean | [] | [] | The disjoint union of types `α` and `β`, ordinarily written `α ⊕ β`.
An element of `α ⊕ β` is either an `a : α` wrapped in `Sum.inl` or a `b : β` wrapped in `Sum.inr`.
`α ⊕ β` is not equivalent to the set-theoretic union of `α` and `β` because its values include an
indication of which of the two types was chosen. The ... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
PSum (α : Sort u) (β : Sort v) where
/-- Left injection into the sum type `α ⊕' β`.-/
| inl (val : α) : PSum α β
/-- Right injection into the sum type `α ⊕' β`. -/
| inr (val : β) : PSum α β | inductive | PSum | Init | src/Init/Core.lean | [] | [] | The disjoint union of arbitrary sorts `α` `β`, or `α ⊕' β`.
It differs from `α ⊕ β` in that it allows `α` and `β` to have arbitrary sorts `Sort u` and `Sort v`,
instead of restricting them to `Type u` and `Type v`. This means that it can be used in situations
where one side is a proposition, like `True ⊕' Nat`. Howeve... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
PSum.inhabitedLeft {α β} [Inhabited α] : Inhabited (PSum α β) | ⟨PSum.inl default⟩ | def | PSum.inhabitedLeft | Init | src/Init/Core.lean | [] | [
"Inhabited",
"PSum"
] | If the left type in a sum is inhabited then the sum is inhabited.
This is not an instance to avoid non-canonical instances when both the left and right types are
inhabited. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
PSum.inhabitedRight {α β} [Inhabited β] : Inhabited (PSum α β) | ⟨PSum.inr default⟩ | def | PSum.inhabitedRight | Init | src/Init/Core.lean | [] | [
"Inhabited",
"PSum"
] | If the right type in a sum is inhabited then the sum is inhabited.
This is not an instance to avoid non-canonical instances when both the left and right types are
inhabited. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
PSum.nonemptyLeft [h : Nonempty α] : Nonempty (PSum α β) | Nonempty.elim h (fun a => ⟨PSum.inl a⟩) | instance | PSum.nonemptyLeft | Init | src/Init/Core.lean | [] | [
"Nonempty",
"Nonempty.elim",
"PSum"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
PSum.nonemptyRight [h : Nonempty β] : Nonempty (PSum α β) | Nonempty.elim h (fun b => ⟨PSum.inr b⟩) | instance | PSum.nonemptyRight | Init | src/Init/Core.lean | [] | [
"Nonempty",
"Nonempty.elim",
"PSum"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Sigma {α : Type u} (β : α → Type v) where
/--
Constructs a dependent pair.
Using this constructor in a context in which the type is not known usually requires a type
ascription to determine `β`. This is because the desired relationship between the two values can't
generally be determined automatically.
-/
... | structure | Sigma | Init | src/Init/Core.lean | [] | [] | Dependent pairs, in which the second element's type depends on the value of the first element. The
type `Sigma β` is typically written `Σ a : α, β a` or `(a : α) × β a`.
Although its values are pairs, `Sigma` is sometimes known as the *dependent sum type*, since it is
the type level version of an indexed summation. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
PSigma {α : Sort u} (β : α → Sort v) where
/-- Constructs a fully universe-polymorphic dependent pair. -/
mk ::
/--
The first component of a dependent pair.
-/
fst : α
/--
The second component of a dependent pair. Its type depends on the first component.
-/
snd : β fst | structure | PSigma | Init | src/Init/Core.lean | [] | [] | Fully universe-polymorphic dependent pairs, in which the second element's type depends on the value
of the first element and both types are allowed to be propositions. The type `PSigma β` is typically
written `Σ' a : α, β a` or `(a : α) ×' β a`.
In practice, this generality leads to universe level constraints that are... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Exists {α : Sort u} (p : α → Prop) : Prop where
/-- Existential introduction. If `a : α` and `h : p a`,
then `⟨a, h⟩` is a proof that `∃ x : α, p x`. -/
| intro (w : α) (h : p w) : Exists p | inductive | Exists | Init | src/Init/Core.lean | [] | [] | Existential quantification. If `p : α → Prop` is a predicate, then `∃ x : α, p x`
asserts that there is some `x` of type `α` such that `p x` holds.
To create an existential proof, use the `exists` tactic,
or the anonymous constructor notation `⟨x, h⟩`.
To unpack an existential, use `cases h` where `h` is a proof of `∃ ... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ForInStep (α : Type u) where
/--
The loop should terminate early.
`ForInStep.done` is produced by uses of `break` or `return` in the loop body.
-/
| done : α → ForInStep α
/--
The loop should continue with the next iteration, using the returned state.
`ForInStep.yield` is produced by `continue` and b... | inductive | ForInStep | Init | src/Init/Core.lean | [] | [
"Inhabited"
] | An indication of whether a loop's body terminated early that's used to compile the `for x in xs`
notation.
A collection's `ForIn` or `ForIn'` instance describes how to iterate over its elements. The monadic
action that represents the body of the loop returns a `ForInStep α`, where `α` is the local state
used to implem... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ForIn (m : Type u₁ → Type u₂) (ρ : Type u) (α : outParam (Type v)) where
/--
Monadically iterates over the contents of a collection `xs`, with a local state `b` and the
possibility of early termination.
Because a `do` block supports local mutable bindings along with `return`, and `break`, the monadic
action ... | class | ForIn | Init | src/Init/Core.lean | [] | [
"ForInStep",
"outParam"
] | Monadic iteration in `do`-blocks, using the `for x in xs` notation.
The parameter `m` is the monad of the `do`-block in which iteration is performed, `ρ` is the type of
the collection being iterated over, and `α` is the type of elements. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ForIn' (m : Type u₁ → Type u₂) (ρ : Type u) (α : outParam (Type v)) (d : outParam (Membership α ρ)) where
/--
Monadically iterates over the contents of a collection `xs`, with a local state `b` and the
possibility of early termination. At each iteration, the body of the loop is provided with a proof
that the cu... | class | ForIn' | Init | src/Init/Core.lean | [] | [
"ForInStep",
"Membership",
"outParam"
] | Monadic iteration in `do`-blocks with a membership proof, using the `for h : x in xs` notation.
The parameter `m` is the monad of the `do`-block in which iteration is performed, `ρ` is the type of
the collection being iterated over, `α` is the type of elements, and `d` is the specific membership
predicate to provide. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
DoResultPRBC (α β σ : Type u) where
/-- `pure (a : α) s` means that the block exited normally with return value `a` -/
| pure : α → σ → DoResultPRBC α β σ
/-- `return (b : β) s` means that the block exited via a `return b` early-exit command -/
| return : β → σ → DoResultPRBC α β σ
/-- `break s` means that `b... | inductive | DoResultPRBC | Init | src/Init/Core.lean | [] | [] | Auxiliary type used to compile `do` notation. It is used when compiling a do block
nested inside a combinator like `tryCatch`. It encodes the possible ways the
block can exit:
* `pure (a : α) s` means that the block exited normally with return value `a`.
* `return (b : β) s` means that the block exited via a `return b`... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
DoResultPR (α β σ : Type u) where
/-- `pure (a : α) s` means that the block exited normally with return value `a` -/
| pure : α → σ → DoResultPR α β σ
/-- `return (b : β) s` means that the block exited via a `return b` early-exit command -/
| return : β → σ → DoResultPR α β σ | inductive | DoResultPR | Init | src/Init/Core.lean | [] | [] | Auxiliary type used to compile `do` notation. It is the same as
`DoResultPRBC α β σ` except that `break` and `continue` are not available
because we are not in a loop context. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
DoResultBC (σ : Type u) where
/-- `break s` means that `break` was called, meaning that we should exit
from the containing loop -/
| break : σ → DoResultBC σ
/-- `continue s` means that `continue` was called, meaning that we should continue
to the next iteration of the containing loop -/
| continue : σ →... | inductive | DoResultBC | Init | src/Init/Core.lean | [] | [] | Auxiliary type used to compile `do` notation. It is an optimization of
`DoResultPRBC PEmpty PEmpty σ` to remove the impossible cases,
used when neither `pure` nor `return` are possible exit paths. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
DoResultSBC (α σ : Type u) where
/-- This encodes either `pure (a : α)` or `return (a : α)`:
* `pure (a : α) s` means that the block exited normally with return value `a`
* `return (b : β) s` means that the block exited via a `return b` early-exit command
The one that is actually encoded depends on the context... | inductive | DoResultSBC | Init | src/Init/Core.lean | [] | [] | Auxiliary type used to compile `do` notation. It is an optimization of
either `DoResultPRBC α PEmpty σ` or `DoResultPRBC PEmpty α σ` to remove the
impossible case, used when either `pure` or `return` is never used. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
HasEquiv (α : Sort u) where
/-- `x ≈ y` says that `x` and `y` are equivalent. Because this is a typeclass,
the notion of equivalence is type-dependent. -/
Equiv : α → α → Sort v | class | HasEquiv | Init | src/Init/Core.lean | [] | [] | `HasEquiv α` is the typeclass which supports the notation `x ≈ y` where `x y : α`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
HasSubset (α : Type u) where
/-- Subset relation: `a ⊆ b` -/
Subset : α → α → Prop | class | HasSubset | Init | src/Init/Core.lean | [] | [] | Notation type class for the subset relation `⊆`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
HasSSubset (α : Type u) where
/-- Strict subset relation: `a ⊂ b` -/
SSubset : α → α → Prop | class | HasSSubset | Init | src/Init/Core.lean | [] | [] | Notation type class for the strict subset relation `⊂`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Superset [HasSubset α] (a b : α) | Subset b a | abbrev | Superset | Init | src/Init/Core.lean | [] | [
"HasSubset"
] | Superset relation: `a ⊇ b` | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
SSuperset [HasSSubset α] (a b : α) | SSubset b a | abbrev | SSuperset | Init | src/Init/Core.lean | [] | [
"HasSSubset"
] | Strict superset relation: `a ⊃ b` | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Union (α : Type u) where
/-- `a ∪ b` is the union of `a` and `b`. -/
union : α → α → α | class | Union | Init | src/Init/Core.lean | [] | [] | Notation type class for the union operation `∪`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Inter (α : Type u) where
/-- `a ∩ b` is the intersection of `a` and `b`. -/
inter : α → α → α | class | Inter | Init | src/Init/Core.lean | [] | [] | Notation type class for the intersection operation `∩`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
SDiff (α : Type u) where
/--
`a \ b` is the set difference of `a` and `b`,
consisting of all elements in `a` that are not in `b`.
-/
sdiff : α → α → α | class | SDiff | Init | src/Init/Core.lean | [] | [] | Notation type class for the set difference `\`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
EmptyCollection (α : Type u) where
/-- `∅` or `{}` is the empty set or empty collection.
It is supported by the `EmptyCollection` typeclass. -/
emptyCollection : α | class | EmptyCollection | Init | src/Init/Core.lean | [] | [] | `EmptyCollection α` is the typeclass which supports the notation `∅`, also written as `{}`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Insert (α : outParam <| Type u) (γ : Type v) where
/-- `insert x xs` inserts the element `x` into the collection `xs`. -/
insert : α → γ → γ | class | Insert | Init | src/Init/Core.lean | [] | [
"outParam"
] | Type class for the `insert` operation.
Used to implement the `{ a, b, c }` syntax. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Singleton (α : outParam <| Type u) (β : Type v) where
/-- `singleton x` is a collection with the single element `x` (notation: `{x}`). -/
singleton : α → β | class | Singleton | Init | src/Init/Core.lean | [] | [
"outParam"
] | Type class for the `singleton` operation.
Used to implement the `{ a, b, c }` syntax. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
LawfulSingleton (α : Type u) (β : Type v) [EmptyCollection β] [Insert α β] [Singleton α β] :
Prop where
/-- `insert x ∅ = {x}` -/
insert_empty_eq (x : α) : (insert x ∅ : β) = singleton x | class | LawfulSingleton | Init | src/Init/Core.lean | [] | [
"EmptyCollection",
"Insert",
"Singleton"
] | `insert x ∅ = {x}` | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Sep (α : outParam <| Type u) (γ : Type v) where
/-- Computes `{ a ∈ c | p a }`. -/
sep : (α → Prop) → γ → γ | class | Sep | Init | src/Init/Core.lean | [] | [
"outParam"
] | Type class used to implement the notation `{ a ∈ c | p a }` | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Task (α : Type u) : Type u where
/-- `Task.pure (a : α)` constructs a task that is already resolved with value `a`. -/
pure ::
/--
Blocks the current thread until the given task has finished execution, and then returns the result
of the task. If the current thread is itself executing a (non-dedicated) task, t... | structure | Task | Init | src/Init/Core.lean | [] | [
"Inhabited",
"Nonempty"
] | `Task α` is a primitive for asynchronous computation.
It represents a computation that will resolve to a value of type `α`,
possibly being computed on another thread. This is similar to `Future` in Scala,
`Promise` in Javascript, and `JoinHandle` in Rust.
The tasks have an overridden representation in the runtime. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Priority | Nat | abbrev | Task.Priority | Init | src/Init/Core.lean | [] | [
"Nat"
] | Task priority.
Tasks with higher priority will always be scheduled before tasks with lower priority. Tasks with a
priority greater than `Task.Priority.max` are scheduled on dedicated threads. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Priority.default : Priority | 0 | def | Task.Priority.default | Init | src/Init/Core.lean | [] | [] | The default priority for spawned tasks, also the lowest priority: `0`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Priority.max : Priority | 8 | def | Task.Priority.max | Init | src/Init/Core.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Priority.dedicated : Priority | 9 | def | Task.Priority.dedicated | Init | src/Init/Core.lean | [] | [] | Indicates that a task should be scheduled on a dedicated thread.
Any priority higher than `Task.Priority.max` will result in the task being scheduled
immediately on a dedicated thread. This is particularly useful for long-running and/or
I/O-bound tasks since Lean will, by default, allocate no more non-dedicated worker... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
spawn {α : Type u} (fn : Unit → α) (prio := Priority.default) : Task α | ⟨fn ()⟩ | def | Task.spawn | Init | src/Init/Core.lean | [] | [
"Task",
"Unit"
] | `spawn fn : Task α` constructs and immediately launches a new task for
evaluating the function `fn () : α` asynchronously.
`prio`, if provided, is the priority of the task. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
map (f : α → β) (x : Task α) (prio := Priority.default) (sync := false) : Task β | ⟨f x.get⟩ | def | Task.map | Init | src/Init/Core.lean | [] | [
"Task"
] | `map f x` maps function `f` over the task `x`: that is, it constructs
(and immediately launches) a new task which will wait for the value of `x` to
be available and then calls `f` on the result.
`prio`, if provided, is the priority of the task.
If `sync` is set to true, `f` is executed on the current thread if `x` has... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
bind (x : Task α) (f : α → Task β) (prio := Priority.default) (sync := false) :
Task β | ⟨(f x.get).get⟩ | def | Task.bind | Init | src/Init/Core.lean | [] | [
"Task"
] | `bind x f` does a monad "bind" operation on the task `x` with function `f`:
that is, it constructs (and immediately launches) a new task which will wait
for the value of `x` to be available and then calls `f` on the result,
resulting in a new task which is then run for a result.
`prio`, if provided, is the priority of... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
NonScalar where
/-- You should not use this function -/ mk ::
/-- You should not use this function -/ val : Nat | structure | NonScalar | Init | src/Init/Core.lean | [] | [
"Nat"
] | `NonScalar` is a type that is not a scalar value in our runtime.
It is used as a stand-in for an arbitrary boxed value to avoid excessive
monomorphization, and it is only created using `unsafeCast`. It is somewhat
analogous to C `void*` in usage, but the type itself is not special. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
PNonScalar : Type u where
/-- You should not use this function -/
| mk (v : Nat) : PNonScalar | inductive | PNonScalar | Init | src/Init/Core.lean | [] | [
"Nat"
] | `PNonScalar` is a type that is not a scalar value in our runtime.
It is used as a stand-in for an arbitrary boxed value to avoid excessive
monomorphization, and it is only created using `unsafeCast`. It is somewhat
analogous to C `void*` in usage, but the type itself is not special.
This is the universe-polymorphic ve... | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Nat.add_zero (n : Nat) : n + 0 = n | rfl | theorem | Nat.add_zero | Init | src/Init/Core.lean | [] | [
"Nat",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
optParam_eq (α : Sort u) (default : α) : optParam α default = α | rfl | theorem | optParam_eq | Init | src/Init/Core.lean | [] | [
"optParam",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
strictOr (b₁ b₂ : Bool) | b₁ || b₂ | def | strictOr | Init | src/Init/Core.lean | [] | [
"Bool"
] | `strictOr` is the same as `or`, but it does not use short-circuit evaluation semantics:
both sides are evaluated, even if the first value is `true`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
strictAnd (b₁ b₂ : Bool) | b₁ && b₂ | def | strictAnd | Init | src/Init/Core.lean | [] | [
"Bool"
] | `strictAnd` is the same as `and`, but it does not use short-circuit evaluation semantics:
both sides are evaluated, even if the first value is `false`. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
bne {α : Type u} [BEq α] (a b : α) : Bool | !(a == b) | def | bne | Init | src/Init/Core.lean | [] | [
"BEq",
"Bool"
] | `x != y` is boolean not-equal. It is the negation of `x == y` which is supplied by
the `BEq` typeclass.
Unlike `x ≠ y` (which is notation for `Ne x y`), this is `Bool` valued instead of
`Prop` valued. It is mainly intended for programming applications. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
ReflBEq (α) [BEq α] : Prop where
/-- `==` is reflexive, that is, `(a == a) = true`. -/
protected rfl {a : α} : a == a | class | ReflBEq | Init | src/Init/Core.lean | [] | [
"BEq",
"rfl"
] | `ReflBEq α` says that the `BEq` implementation is reflexive. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
BEq.rfl [BEq α] [ReflBEq α] {a : α} : a == a | ReflBEq.rfl | theorem | BEq.rfl | Init | src/Init/Core.lean | [] | [
"BEq",
"ReflBEq"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
BEq.refl [BEq α] [ReflBEq α] (a : α) : a == a | BEq.rfl | theorem | BEq.refl | Init | src/Init/Core.lean | [] | [
"BEq",
"BEq.rfl",
"ReflBEq"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
beq_of_eq [BEq α] [ReflBEq α] {a b : α} : a = b → a == b | | rfl => BEq.rfl | theorem | beq_of_eq | Init | src/Init/Core.lean | [] | [
"BEq",
"BEq.rfl",
"ReflBEq",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_eq_of_beq_eq_false [BEq α] [ReflBEq α] {a b : α} (h : (a == b) = false) : ¬a = b | by
intro h'; subst h'; have : true = false := BEq.rfl.symm.trans h; contradiction | theorem | not_eq_of_beq_eq_false | Init | src/Init/Core.lean | [] | [
"BEq",
"ReflBEq"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
LawfulBEq (α : Type u) [BEq α] : Prop extends ReflBEq α where
/-- If `a == b` evaluates to `true`, then `a` and `b` are equal in the logic. -/
eq_of_beq : {a b : α} → a == b → a = b | class | LawfulBEq | Init | src/Init/Core.lean | [] | [
"BEq",
"ReflBEq"
] | A Boolean equality test coincides with propositional equality.
In other words:
* `a == b` implies `a = b`.
* `a == a` is true. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
instDecidableEqOfLawfulBEq [BEq α] [LawfulBEq α] : DecidableEq α | fun x y =>
match h : x == y with
| false => .isFalse (not_eq_of_beq_eq_false h)
| true => .isTrue (eq_of_beq h) | def | instDecidableEqOfLawfulBEq | Init | src/Init/Core.lean | [] | [
"BEq",
"DecidableEq",
"LawfulBEq",
"not_eq_of_beq_eq_false"
] | Non-instance for `DecidableEq` from `LawfulBEq`.
To use this, add `attribute [local instance 5] instDecidableEqOfLawfulBEq` at the top of a file. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
trivial : True | ⟨⟩ | theorem | trivial | Init | src/Init/Core.lean | [] | [
"True"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
mt {a b : Prop} (h₁ : a → b) (h₂ : ¬b) : ¬a | fun ha => h₂ (h₁ ha) | theorem | mt | Init | src/Init/Core.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_false : ¬False | id | theorem | not_false | Init | src/Init/Core.lean | [] | [
"False",
"id"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
not_not_intro {p : Prop} (h : p) : ¬ ¬ p | fun hn : ¬ p => hn h | theorem | not_not_intro | Init | src/Init/Core.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
proof_irrel {a : Prop} (h₁ h₂ : a) : h₁ = h₂ | rfl | theorem | proof_irrel | Init | src/Init/Core.lean | [] | [
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Eq.mp {α β : Sort u} (h : α = β) (a : α) : β | h ▸ a | def | Eq.mp | Init | src/Init/Core.lean | [] | [] | If `h : α = β` is a proof of type equality, then `h.mp : α → β` is the induced
"cast" operation, mapping elements of `α` to elements of `β`.
You can prove theorems about the resulting element by induction on `h`, since
`rfl.mp` is definitionally the identity function. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Eq.mpr {α β : Sort u} (h : α = β) (b : β) : α | h ▸ b | def | Eq.mpr | Init | src/Init/Core.lean | [] | [] | If `h : α = β` is a proof of type equality, then `h.mpr : β → α` is the induced
"cast" operation in the reverse direction, mapping elements of `β` to elements of `α`.
You can prove theorems about the resulting element by induction on `h`, since
`rfl.mpr` is definitionally the identity function. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Eq.substr {α : Sort u} {p : α → Prop} {a b : α} (h₁ : b = a) (h₂ : p a) : p b | h₁ ▸ h₂ | theorem | Eq.substr | Init | src/Init/Core.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
cast_eq {α : Sort u} (h : α = α) (a : α) : cast h a = a | rfl | theorem | cast_eq | Init | src/Init/Core.lean | [] | [
"cast",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Ne {α : Sort u} (a b : α) | ¬(a = b) | def | Ne | Init | src/Init/Core.lean | [] | [] | `a ≠ b`, or `Ne a b` is defined as `¬ (a = b)` or `a = b → False`,
and asserts that `a` and `b` are not equal. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Ne.intro (h : a = b → False) : a ≠ b | h | theorem | Ne.intro | Init | src/Init/Core.lean | [] | [
"False"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Ne.elim (h : a ≠ b) : a = b → False | h | theorem | Ne.elim | Init | src/Init/Core.lean | [] | [
"False"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Ne.irrefl (h : a ≠ a) : False | h rfl | theorem | Ne.irrefl | Init | src/Init/Core.lean | [] | [
"False",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Ne.symm (h : a ≠ b) : b ≠ a | fun h₁ => h (h₁.symm) | theorem | Ne.symm | Init | src/Init/Core.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ne_comm {α} {a b : α} : a ≠ b ↔ b ≠ a | ⟨Ne.symm, Ne.symm⟩ | theorem | ne_comm | Init | src/Init/Core.lean | [] | [] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
false_of_ne : a ≠ a → False | Ne.irrefl | theorem | false_of_ne | Init | src/Init/Core.lean | [] | [
"False",
"Ne.irrefl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ne_false_of_self : p → p ≠ False | fun (hp : p) (h : p = False) => h ▸ hp | theorem | ne_false_of_self | Init | src/Init/Core.lean | [] | [
"False"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ne_true_of_not : ¬p → p ≠ True | fun (hnp : ¬p) (h : p = True) =>
have : ¬True := h ▸ hnp
this trivial | theorem | ne_true_of_not | Init | src/Init/Core.lean | [] | [
"True",
"trivial"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
true_ne_false : ¬True = False | ne_false_of_self trivial | theorem | true_ne_false | Init | src/Init/Core.lean | [] | [
"False",
"True",
"ne_false_of_self",
"trivial"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
false_ne_true : False ≠ True | fun h => h.symm ▸ trivial | theorem | false_ne_true | Init | src/Init/Core.lean | [] | [
"False",
"True",
"trivial"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Bool.of_not_eq_true : {b : Bool} → ¬ (b = true) → b = false | | true, h => absurd rfl h
| false, _ => rfl | theorem | Bool.of_not_eq_true | Init | src/Init/Core.lean | [] | [
"Bool",
"absurd",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
Bool.of_not_eq_false : {b : Bool} → ¬ (b = false) → b = true | | true, _ => rfl
| false, h => absurd rfl h | theorem | Bool.of_not_eq_false | Init | src/Init/Core.lean | [] | [
"Bool",
"absurd",
"rfl"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
ne_of_beq_false [BEq α] [ReflBEq α] {a b : α} (h : (a == b) = false) : a ≠ b | not_eq_of_beq_eq_false h | theorem | ne_of_beq_false | Init | src/Init/Core.lean | [] | [
"BEq",
"ReflBEq",
"not_eq_of_beq_eq_false"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
beq_false_of_ne [BEq α] [LawfulBEq α] {a b : α} (h : a ≠ b) : (a == b) = false | have : ¬ (a == b) = true := by
intro h'; rw [eq_of_beq h'] at h; contradiction
Bool.of_not_eq_true this | theorem | beq_false_of_ne | Init | src/Init/Core.lean | [] | [
"BEq",
"Bool.of_not_eq_true",
"LawfulBEq"
] | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 | |
HEq.ndrec.{u1, u2} {α : Sort u2} {a : α} {motive : {β : Sort u2} → β → Sort u1} (m : motive a) {β : Sort u2} {b : β} (h : a ≍ b) : motive b | h.rec m | def | HEq.ndrec. | Init | src/Init/Core.lean | [] | [] | Non-dependent recursor for `HEq` | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.ndrecOn.{u1, u2} {α : Sort u2} {a : α} {motive : {β : Sort u2} → β → Sort u1} {β : Sort u2} {b : β} (h : a ≍ b) (m : motive a) : motive b | h.rec m | def | HEq.ndrecOn. | Init | src/Init/Core.lean | [] | [] | `HEq.ndrec` variant | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.homo_ndrec.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} (m : motive a) {b : α} (h : a ≍ b) : motive b | (eq_of_heq h).ndrec m | def | HEq.homo_ndrec. | Init | src/Init/Core.lean | [] | [
"eq_of_heq"
] | `HEq.ndrec` specialized to homogeneous heterogeneous equality | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.homo_ndrec_symm.{u1, u2} {α : Sort u2} {a : α} {motive : α → Sort u1} (m : motive a) {b : α} (h : b ≍ a) : motive b | (eq_of_heq h).ndrec_symm m | def | HEq.homo_ndrec_symm. | Init | src/Init/Core.lean | [] | [
"eq_of_heq"
] | `HEq.ndrec` specialized to homogeneous heterogeneous equality, symmetric variant | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.elim {α : Sort u} {a : α} {p : α → Sort v} {b : α} (h₁ : a ≍ b) (h₂ : p a) : p b | eq_of_heq h₁ ▸ h₂ | def | HEq.elim | Init | src/Init/Core.lean | [] | [
"eq_of_heq"
] | `HEq.ndrec` variant | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.subst {p : (T : Sort u) → T → Prop} (h₁ : a ≍ b) (h₂ : p α a) : p β b | HEq.ndrecOn h₁ h₂ | theorem | HEq.subst | Init | src/Init/Core.lean | [] | [] | Substitution with heterogeneous equality. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.symm (h : a ≍ b) : b ≍ a | h.rec (HEq.refl a) | theorem | HEq.symm | Init | src/Init/Core.lean | [] | [] | Heterogeneous equality is symmetric. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
HEq.trans (h₁ : a ≍ b) (h₂ : b ≍ c) : a ≍ c | HEq.subst h₂ h₁ | theorem | HEq.trans | Init | src/Init/Core.lean | [] | [
"HEq.subst"
] | Heterogeneous equality is transitive. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
heq_of_heq_of_eq (h₁ : a ≍ b) (h₂ : b = b') : a ≍ b' | HEq.trans h₁ (heq_of_eq h₂) | theorem | heq_of_heq_of_eq | Init | src/Init/Core.lean | [] | [
"HEq.trans",
"heq_of_eq"
] | Heterogeneous equality precomposes with propositional equality. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
heq_of_eq_of_heq (h₁ : a = a') (h₂ : a' ≍ b) : a ≍ b | HEq.trans (heq_of_eq h₁) h₂ | theorem | heq_of_eq_of_heq | Init | src/Init/Core.lean | [] | [
"HEq.trans",
"heq_of_eq"
] | Heterogeneous equality postcomposes with propositional equality. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
type_eq_of_heq (h : a ≍ b) : α = β | h.rec (Eq.refl α) | theorem | type_eq_of_heq | Init | src/Init/Core.lean | [] | [] | If two terms are heterogeneously equal then their types are propositionally equal. | https://github.com/leanprover/lean4 | d265d1ca745e7741a7e7f7366c22ce9c9dda57b6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.