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
GE.ge {α : Type u} [LE α] (a b : α) : Prop
LE.le b a
def
GE.ge
Init
src/Init/Prelude.lean
[]
[ "LE" ]
`a ≥ b` is an abbreviation for `b ≤ a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
GT.gt {α : Type u} [LT α] (a b : α) : Prop
LT.lt b a
def
GT.gt
Init
src/Init/Prelude.lean
[]
[ "LT" ]
`a > b` is an abbreviation for `b < a`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
DecidableLT (α : Type u) [LT α]
DecidableRel (LT.lt : α → α → Prop)
abbrev
DecidableLT
Init
src/Init/Prelude.lean
[]
[ "DecidableRel", "LT" ]
Abbreviation for `DecidableRel (· < · : α → α → Prop)`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
DecidableLE (α : Type u) [LE α]
DecidableRel (LE.le : α → α → Prop)
abbrev
DecidableLE
Init
src/Init/Prelude.lean
[]
[ "DecidableRel", "LE" ]
Abbreviation for `DecidableRel (· ≤ · : α → α → Prop)`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Max (α : Type u) where /-- Returns the greater of its two arguments. -/ max : α → α → α
class
Max
Init
src/Init/Prelude.lean
[]
[]
An overloaded operation to find the greater of two values of type `α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
maxOfLe [LE α] [DecidableRel (@LE.le α _)] : Max α
where max x y := ite (LE.le x y) y x
def
maxOfLe
Init
src/Init/Prelude.lean
[]
[ "DecidableRel", "LE", "Max", "ite" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Min (α : Type u) where /-- Returns the lesser of its two arguments. -/ min : α → α → α
class
Min
Init
src/Init/Prelude.lean
[]
[]
An overloaded operation to find the lesser of two values of type `α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
minOfLe [LE α] [DecidableRel (@LE.le α _)] : Min α
where min x y := ite (LE.le x y) x y
def
minOfLe
Init
src/Init/Prelude.lean
[]
[ "DecidableRel", "LE", "Min", "ite" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Trans (r : α → β → Sort u) (s : β → γ → Sort v) (t : outParam (α → γ → Sort w)) where /-- Compose two proofs by transitivity, generalized over the relations involved. -/ trans : r a b → s b c → t a c
class
Trans
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
Transitive chaining of proofs, used e.g. by `calc`. It takes two relations `r` and `s` as "input", and produces an "output" relation `t`, with the property that `r a b` and `s b c` implies `t a c`. The `calc` tactic uses this so that when it sees a chain with `a ≤ b` and `b < c` it knows that this should be a proof of...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HAdd (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a + b` computes the sum of `a` and `b`. The meaning of this notation is type-dependent. -/ hAdd : α → β → γ
class
HAdd
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous addition. This enables the notation `a + b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HSub (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a - b` computes the difference of `a` and `b`. The meaning of this notation is type-dependent. * For natural numbers, this operator saturates at 0: `a - b = 0` when `a ≤ b`. -/ hSub : α → β → γ
class
HSub
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous subtraction. This enables the notation `a - b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HMul (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a * b` computes the product of `a` and `b`. The meaning of this notation is type-dependent. -/ hMul : α → β → γ
class
HMul
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous multiplication. This enables the notation `a * b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HDiv (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a / b` computes the result of dividing `a` by `b`. The meaning of this notation is type-dependent. * For most types like `Nat`, `Int`, `Rat`, `Real`, `a / 0` is defined to be `0`. * For `Nat`, `a / b` rounds downwards. * For `Int`, `a / b` roun...
class
HDiv
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous division. This enables the notation `a / b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HMod (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a % b` computes the remainder upon dividing `a` by `b`. The meaning of this notation is type-dependent. * For `Nat` and `Int` it satisfies `a % b + b * (a / b) = a`, and `a % 0` is defined to be `a`. -/ hMod : α → β → γ
class
HMod
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous modulo / remainder. This enables the notation `a % b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HPow (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a ^ b` computes `a` to the power of `b`. The meaning of this notation is type-dependent. -/ hPow : α → β → γ
class
HPow
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous exponentiation. This enables the notation `a ^ b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HSMul (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a • b` computes the product of `a` and `b`. The meaning of this notation is type-dependent, but it is intended to be used for left actions. -/ hSMul : α → β → γ
class
HSMul
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous scalar multiplication. This enables the notation `a • b : γ` where `a : α`, `b : β`. It is assumed to represent a left action in some sense. The notation `a • b` is augmented with a macro (below) to have it elaborate as a left action. Only the `b` argument participates in the e...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HAppend (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a ++ b` is the result of concatenation of `a` and `b`, usually read "append". The meaning of this notation is type-dependent. -/ hAppend : α → β → γ
class
HAppend
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The notation typeclass for heterogeneous append. This enables the notation `a ++ b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HOrElse (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a <|> b` executes `a` and returns the result, unless it fails in which case it executes and returns `b`. Because `b` is not always executed, it is passed as a thunk so it can be forced only when needed. The meaning of this notation is type-dep...
class
HOrElse
Init
src/Init/Prelude.lean
[]
[ "Unit", "outParam" ]
The typeclass behind the notation `a <|> b : γ` where `a : α`, `b : β`. Because `b` is "lazy" in this notation, it is passed as `Unit → β` to the implementation so it can decide when to evaluate it.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HAndThen (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a >> b` executes `a`, ignores the result, and then executes `b`. If `a` fails then `b` is not executed. Because `b` is not always executed, it is passed as a thunk so it can be forced only when needed. The meaning of this notation is type-dep...
class
HAndThen
Init
src/Init/Prelude.lean
[]
[ "Unit", "outParam" ]
The typeclass behind the notation `a >> b : γ` where `a : α`, `b : β`. Because `b` is "lazy" in this notation, it is passed as `Unit → β` to the implementation so it can decide when to evaluate it.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HAnd (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a &&& b` computes the bitwise AND of `a` and `b`. The meaning of this notation is type-dependent. -/ hAnd : α → β → γ
class
HAnd
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The typeclass behind the notation `a &&& b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HXor (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a ^^^ b` computes the bitwise XOR of `a` and `b`. The meaning of this notation is type-dependent. -/ hXor : α → β → γ
class
HXor
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The typeclass behind the notation `a ^^^ b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HOr (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a ||| b` computes the bitwise OR of `a` and `b`. The meaning of this notation is type-dependent. -/ hOr : α → β → γ
class
HOr
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The typeclass behind the notation `a ||| b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HShiftLeft (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a <<< b` computes `a` shifted to the left by `b` places. The meaning of this notation is type-dependent. * On `Nat`, this is equivalent to `a * 2 ^ b`. * On `UInt8` and other fixed width unsigned types, this is the same but truncated to...
class
HShiftLeft
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The typeclass behind the notation `a <<< b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HShiftRight (α : Type u) (β : Type v) (γ : outParam (Type w)) where /-- `a >>> b` computes `a` shifted to the right by `b` places. The meaning of this notation is type-dependent. * On `Nat` and fixed width unsigned types like `UInt8`, this is equivalent to `a / 2 ^ b`. -/ hShiftRight : α → β → γ
class
HShiftRight
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The typeclass behind the notation `a >>> b : γ` where `a : α`, `b : β`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Zero (α : Type u) where /-- The zero element of the type. -/ zero : α
class
Zero
Init
src/Init/Prelude.lean
[]
[]
A type with a zero element.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
One (α : Type u) where /-- The "one" element of the type. -/ one : α
class
One
Init
src/Init/Prelude.lean
[]
[]
A type with a "one" element.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Add (α : Type u) where /-- `a + b` computes the sum of `a` and `b`. See `HAdd`. -/ add : α → α → α
class
Add
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HAdd`: `a + b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Sub (α : Type u) where /-- `a - b` computes the difference of `a` and `b`. See `HSub`. -/ sub : α → α → α
class
Sub
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HSub`: `a - b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Mul (α : Type u) where /-- `a * b` computes the product of `a` and `b`. See `HMul`. -/ mul : α → α → α
class
Mul
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HMul`: `a * b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Neg (α : Type u) where /-- `-a` computes the negative or opposite of `a`. The meaning of this notation is type-dependent. -/ neg : α → α
class
Neg
Init
src/Init/Prelude.lean
[]
[]
The notation typeclass for negation. This enables the notation `-a : α` where `a : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Div (α : Type u) where /-- `a / b` computes the result of dividing `a` by `b`. See `HDiv`. -/ div : α → α → α
class
Div
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HDiv`: `a / b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Inv (α : Type u) where /-- `a⁻¹` computes the inverse of `a`. The meaning of this notation is type-dependent. -/ inv : α → α
class
Inv
Init
src/Init/Prelude.lean
[]
[]
The notation typeclass for inverses. This enables the notation `a⁻¹ : α` where `a : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Mod (α : Type u) where /-- `a % b` computes the remainder upon dividing `a` by `b`. See `HMod`. -/ mod : α → α → α
class
Mod
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HMod`: `a % b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Dvd (α : Type _) where /-- Divisibility. `a ∣ b` (typed as `\|`) means that there is some `c` such that `b = a * c`. -/ dvd : α → α → Prop
class
Dvd
Init
src/Init/Prelude.lean
[]
[]
Notation typeclass for the `∣` operation (typed as `\|`), which represents divisibility.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Pow (α : Type u) (β : Type v) where /-- `a ^ b` computes `a` to the power of `b`. See `HPow`. -/ pow : α → β → α
class
Pow
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HPow`: `a ^ b : α` where `a : α`, `b : β`. (The right argument is not the same as the left since we often want this even in the homogeneous case.) Types can choose to subscribe to particular defaulting behavior by providing an instance to either `NatPow` or `HomogeneousPow`: - `NatPow` is f...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
NatPow (α : Type u) where /-- `a ^ n` computes `a` to the power of `n` where `n : Nat`. See `Pow`. -/ protected pow : α → Nat → α
class
NatPow
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
The homogeneous version of `Pow` where the exponent is a `Nat`. The purpose of this class is that it provides a default `Pow` instance, which can be used to specialize the exponent to `Nat` during elaboration. For example, if `x ^ 2` should preferentially elaborate with `2 : Nat` then `x`'s type should provide an inst...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
HomogeneousPow (α : Type u) where /-- `a ^ b` computes `a` to the power of `b` where `a` and `b` both have the same type. -/ protected pow : α → α → α
class
HomogeneousPow
Init
src/Init/Prelude.lean
[]
[]
The completely homogeneous version of `Pow` where the exponent has the same type as the base. The purpose of this class is that it provides a default `Pow` instance, which can be used to specialize the exponent to have the same type as the base's type during elaboration. This is to say, a type should provide an instanc...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
SMul (M : Type u) (α : Type v) where /-- `m • a : α` denotes the product of `m : M` and `a : α`. The meaning of this notation is type-dependent, but it is intended to be used for left actions. -/ smul : M → α → α
class
SMul
Init
src/Init/Prelude.lean
[]
[]
Typeclass for types with a scalar multiplication operation, denoted `•` (`\bu`)
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Append (α : Type u) where /-- `a ++ b` is the result of concatenation of `a` and `b`. See `HAppend`. -/ append : α → α → α
class
Append
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HAppend`: `a ++ b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
OrElse (α : Type u) where /-- The implementation of `a <|> b : α`. See `HOrElse`. -/ orElse : α → (Unit → α) → α
class
OrElse
Init
src/Init/Prelude.lean
[]
[ "Unit" ]
The homogeneous version of `HOrElse`: `a <|> b : α` where `a b : α`. Because `b` is "lazy" in this notation, it is passed as `Unit → α` to the implementation so it can decide when to evaluate it.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
AndThen (α : Type u) where /-- The implementation of `a >> b : α`. See `HAndThen`. -/ andThen : α → (Unit → α) → α
class
AndThen
Init
src/Init/Prelude.lean
[]
[ "Unit" ]
The homogeneous version of `HAndThen`: `a >> b : α` where `a b : α`. Because `b` is "lazy" in this notation, it is passed as `Unit → α` to the implementation so it can decide when to evaluate it.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
AndOp (α : Type u) where /-- The implementation of `a &&& b : α`. See `HAnd`. -/ and : α → α → α
class
AndOp
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HAnd`: `a &&& b : α` where `a b : α`. (It is called `AndOp` because `And` is taken for the propositional connective.)
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
XorOp (α : Type u) where /-- The implementation of `a ^^^ b : α`. See `HXor`. -/ xor : α → α → α
class
XorOp
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HXor`: `a ^^^ b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
OrOp (α : Type u) where /-- The implementation of `a ||| b : α`. See `HOr`. -/ or : α → α → α
class
OrOp
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HOr`: `a ||| b : α` where `a b : α`. (It is called `OrOp` because `Or` is taken for the propositional connective.)
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Complement (α : Type u) where /-- The implementation of `~~~a : α`. -/ complement : α → α
class
Complement
Init
src/Init/Prelude.lean
[]
[]
The typeclass behind the notation `~~~a : α` where `a : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
ShiftLeft (α : Type u) where /-- The implementation of `a <<< b : α`. See `HShiftLeft`. -/ shiftLeft : α → α → α
class
ShiftLeft
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HShiftLeft`: `a <<< b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
ShiftRight (α : Type u) where /-- The implementation of `a >>> b : α`. See `HShiftRight`. -/ shiftRight : α → α → α
class
ShiftRight
Init
src/Init/Prelude.lean
[]
[]
The homogeneous version of `HShiftRight`: `a >>> b : α` where `a b : α`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHAdd [Add α] : HAdd α α α
where hAdd a b := Add.add a b
instance
instHAdd
Init
src/Init/Prelude.lean
[]
[ "Add", "HAdd" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHSub [Sub α] : HSub α α α
where hSub a b := Sub.sub a b
instance
instHSub
Init
src/Init/Prelude.lean
[]
[ "HSub", "Sub" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHMul [Mul α] : HMul α α α
where hMul a b := Mul.mul a b
instance
instHMul
Init
src/Init/Prelude.lean
[]
[ "HMul", "Mul" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHDiv [Div α] : HDiv α α α
where hDiv a b := Div.div a b
instance
instHDiv
Init
src/Init/Prelude.lean
[]
[ "Div", "HDiv" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHMod [Mod α] : HMod α α α
where hMod a b := Mod.mod a b
instance
instHMod
Init
src/Init/Prelude.lean
[]
[ "HMod", "Mod" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHPow [Pow α β] : HPow α β α
where hPow a b := Pow.pow a b
instance
instHPow
Init
src/Init/Prelude.lean
[]
[ "HPow", "Pow" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instPowNat [NatPow α] : Pow α Nat
where pow a n := NatPow.pow a n
instance
instPowNat
Init
src/Init/Prelude.lean
[]
[ "Nat", "NatPow", "Pow" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instHSMul {α β} [SMul α β] : HSMul α β β
where hSMul := SMul.smul
instance
instHSMul
Init
src/Init/Prelude.lean
[]
[ "HSMul", "SMul" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Membership (α : outParam (Type u)) (γ : Type v) where /-- The membership relation `a ∈ s : Prop` where `a : α`, `s : γ`. -/ mem : γ → α → Prop
class
Membership
Init
src/Init/Prelude.lean
[]
[ "outParam" ]
The typeclass behind the notation `a ∈ s : Prop` where `a : α`, `s : γ`. Because `α` is an `outParam`, the "container type" `γ` determines the type of the elements of the container.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.add : (@& Nat) → (@& Nat) → Nat
| a, Nat.zero => a | a, Nat.succ b => Nat.succ (Nat.add a b)
def
Nat.add
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
Addition of natural numbers, typically used via the `+` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instAddNat : Add Nat
where add := Nat.add
instance
instAddNat
Init
src/Init/Prelude.lean
[]
[ "Add", "Nat", "Nat.add" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.mul : (@& Nat) → (@& Nat) → Nat
| _, 0 => 0 | a, Nat.succ b => Nat.add (Nat.mul a b) a
def
Nat.mul
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.add" ]
Multiplication of natural numbers, usually accessed via the `*` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instMulNat : Mul Nat
where mul := Nat.mul
instance
instMulNat
Init
src/Init/Prelude.lean
[]
[ "Mul", "Nat", "Nat.mul" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.pow (m : @& Nat) : (@& Nat) → Nat
| 0 => 1 | succ n => Nat.mul (Nat.pow m n) m
def
Nat.pow
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.mul" ]
The power operation on natural numbers, usually accessed via the `^` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instNatPowNat : NatPow Nat
⟨Nat.pow⟩
instance
instNatPowNat
Init
src/Init/Prelude.lean
[]
[ "Nat", "NatPow" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.beq : (@& Nat) → (@& Nat) → Bool
| zero, zero => true | zero, succ _ => false | succ _, zero => false | succ n, succ m => beq n m
def
Nat.beq
Init
src/Init/Prelude.lean
[]
[ "Bool", "Nat" ]
Boolean equality of natural numbers, usually accessed via the `==` operator. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.eq_of_beq_eq_true : {n m : Nat} → Eq (beq n m) true → Eq n m
| zero, zero, _ => rfl | zero, succ _, h => Bool.noConfusion h | succ _, zero, h => Bool.noConfusion h | succ n, succ m, h => have : Eq (beq n m) true := h have : Eq n m := eq_of_beq_eq_true this this ▸ rfl
theorem
Nat.eq_of_beq_eq_true
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.ne_of_beq_eq_false : {n m : Nat} → Eq (beq n m) false → Not (Eq n m)
| zero, zero, h₁, _ => Bool.noConfusion h₁ | zero, succ _, _, h₂ => Nat.noConfusion h₂ | succ _, zero, _, h₂ => Nat.noConfusion h₂ | succ n, succ m, h₁, h₂ => have : Eq (beq n m) false := h₁ Nat.noConfusion h₂ (fun h₂ => absurd h₂ (ne_of_beq_eq_false this))
theorem
Nat.ne_of_beq_eq_false
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "Not", "absurd" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
noConfusion_of_Nat.aux : (a : Nat) → (Nat.beq a a).rec False True
| Nat.zero => True.intro | Nat.succ n => noConfusion_of_Nat.aux n
theorem
noConfusion_of_Nat.aux
Init
src/Init/Prelude.lean
[]
[ "False", "Nat", "Nat.beq", "True" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
noConfusion_of_Nat {α : Sort u} (f : α → Nat) {a b : α} (h : Eq a b) : (Nat.beq (f a) (f b)).rec False True
congrArg f h ▸ noConfusion_of_Nat.aux (f a)
theorem
noConfusion_of_Nat
Init
src/Init/Prelude.lean
[]
[ "Eq", "False", "Nat", "Nat.beq", "True", "congrArg", "noConfusion_of_Nat.aux" ]
A helper theorem to deduce `False` from `a = b` when `f a ≠ f b` for some function `f : α → Nat` (typically `.ctorIdx`). Used as a simpler alternative to the no-confusion theorems.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.decEq (n m : @& Nat) : Decidable (Eq n m)
match h:beq n m with | true => isTrue (eq_of_beq_eq_true h) | false => isFalse (ne_of_beq_eq_false h)
def
Nat.decEq
Init
src/Init/Prelude.lean
[]
[ "Decidable", "Eq", "Nat" ]
A decision procedure for equality of natural numbers, usually accessed via the `DecidableEq Nat` instance. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model. Examples: * `Nat.decE...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.ble : @& Nat → @& Nat → Bool
| zero, _ => true | succ _, zero => false | succ n, succ m => ble n m
def
Nat.ble
Init
src/Init/Prelude.lean
[]
[ "Bool", "Nat" ]
The Boolean less-than-or-equal-to comparison on natural numbers. This function is overridden in both the kernel and the compiler to efficiently evaluate using the arbitrary-precision arithmetic library. The definition provided here is the logical model. Examples: * `Nat.ble 2 5 = true` * `Nat.ble 5 2 = false` * `N...
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le (n : Nat) : Nat → Prop /-- Non-strict inequality is reflexive: `n ≤ n` -/ | refl : Nat.le n n /-- If `n ≤ m`, then `n ≤ m + 1`. -/ | step {m} : Nat.le n m → Nat.le n (succ m)
inductive
Nat.le
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
Non-strict, or weak, inequality of natural numbers, usually accessed via the `≤` operator.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instLENat : LE Nat
where le := Nat.le
instance
instLENat
Init
src/Init/Prelude.lean
[]
[ "LE", "Nat", "Nat.le" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt (n m : Nat) : Prop
Nat.le (succ n) m
def
Nat.lt
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.le" ]
Strict inequality of natural numbers, usually accessed via the `<` operator. It is defined as `n < m = n + 1 ≤ m`.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
instLTNat : LT Nat
where lt := Nat.lt
instance
instLTNat
Init
src/Init/Prelude.lean
[]
[ "LT", "Nat", "Nat.lt" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.not_succ_le_zero (n : Nat) : LE.le (succ n) 0 → False
-- No injectivity tactic until `attribute [gen_constructor_elims] Nat` have : ∀ m, Eq m 0 → LE.le (succ n) m → False := fun _ hm hle => Nat.le.casesOn (motive := fun m _ => Eq m 0 → False) hle (fun h => Nat.noConfusion h) (fun _ h => Nat.noConfusion h) hm this 0 rfl
theorem
Nat.not_succ_le_zero
Init
src/Init/Prelude.lean
[]
[ "Eq", "False", "Nat", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.not_lt_zero (n : Nat) : Not (LT.lt n 0)
not_succ_le_zero n
theorem
Nat.not_lt_zero
Init
src/Init/Prelude.lean
[]
[ "Nat", "Not" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.zero_le : (n : Nat) → LE.le 0 n
| zero => Nat.le.refl | succ n => Nat.le.step (zero_le n)
theorem
Nat.zero_le
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.succ_le_succ : LE.le n m → LE.le (succ n) (succ m)
| Nat.le.refl => Nat.le.refl | Nat.le.step h => Nat.le.step (succ_le_succ h)
theorem
Nat.succ_le_succ
Init
src/Init/Prelude.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.zero_lt_succ (n : Nat) : LT.lt 0 (succ n)
succ_le_succ (zero_le n)
theorem
Nat.zero_lt_succ
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_succ_of_le (h : LE.le n m) : LE.le n (succ m)
Nat.le.step h
theorem
Nat.le_succ_of_le
Init
src/Init/Prelude.lean
[]
[]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_trans {n m k : Nat} : LE.le n m → LE.le m k → LE.le n k
| h, Nat.le.refl => h | h₁, Nat.le.step h₂ => Nat.le.step (Nat.le_trans h₁ h₂)
theorem
Nat.le_trans
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt_of_lt_of_le {n m k : Nat} : LT.lt n m → LE.le m k → LT.lt n k
Nat.le_trans
theorem
Nat.lt_of_lt_of_le
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.le_trans" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt_trans {n m k : Nat} (h₁ : LT.lt n m) : LT.lt m k → LT.lt n k
Nat.le_trans (le_succ_of_le h₁)
theorem
Nat.lt_trans
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.le_trans" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_succ (n : Nat) : LE.le n (succ n)
Nat.le.step Nat.le.refl
theorem
Nat.le_succ
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_refl (n : Nat) : LE.le n n
Nat.le.refl
theorem
Nat.le_refl
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.succ_pos (n : Nat) : LT.lt 0 (succ n)
zero_lt_succ n
theorem
Nat.succ_pos
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.pred : (@& Nat) → Nat
| 0 => 0 | succ a => a
def
Nat.pred
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
The predecessor of a natural number is one less than it. The predecessor of `0` is defined to be `0`. This definition is overridden in the compiler with an efficient implementation. This definition is the logical model.
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.pred_le_pred : {n m : Nat} → LE.le n m → LE.le (pred n) (pred m)
| _, _, Nat.le.refl => Nat.le.refl | 0, succ _, Nat.le.step h => h | succ _, succ _, Nat.le.step h => Nat.le_trans (le_succ _) h
theorem
Nat.pred_le_pred
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.le_trans" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_of_succ_le_succ {n m : Nat} : LE.le (succ n) (succ m) → LE.le n m
pred_le_pred
theorem
Nat.le_of_succ_le_succ
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_of_lt_succ {m n : Nat} : LT.lt m (succ n) → LE.le m n
le_of_succ_le_succ
theorem
Nat.le_of_lt_succ
Init
src/Init/Prelude.lean
[]
[ "Nat" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.eq_or_lt_of_le : {n m: Nat} → LE.le n m → Or (Eq n m) (LT.lt n m)
| zero, zero, _ => Or.inl rfl | zero, succ _, _ => Or.inr (Nat.succ_le_succ (Nat.zero_le _)) | succ _, zero, h => absurd h (not_succ_le_zero _) | succ n, succ m, h => have : LE.le n m := Nat.le_of_succ_le_succ h match Nat.eq_or_lt_of_le this with | Or.inl h => Or.inl (h ▸ rfl) | Or.inr h =...
def
Nat.eq_or_lt_of_le
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "Nat.le_of_succ_le_succ", "Nat.succ_le_succ", "Nat.zero_le", "Or", "absurd", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt_or_ge (n m : Nat) : Or (LT.lt n m) (GE.ge n m)
match m with | zero => Or.inr (zero_le n) | succ m => match Nat.lt_or_ge n m with | Or.inl h => Or.inl (le_succ_of_le h) | Or.inr h => match Nat.eq_or_lt_of_le h with | Or.inl h1 => Or.inl (h1 ▸ Nat.le_refl _) | Or.inr h1 => Or.inr h1
theorem
Nat.lt_or_ge
Init
src/Init/Prelude.lean
[]
[ "GE.ge", "Nat", "Nat.eq_or_lt_of_le", "Nat.le_refl", "Or" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.not_succ_le_self : (n : Nat) → Not (LE.le (succ n) n)
| 0 => not_succ_le_zero _ | succ n => fun h => absurd (le_of_succ_le_succ h) (not_succ_le_self n)
theorem
Nat.not_succ_le_self
Init
src/Init/Prelude.lean
[]
[ "Nat", "Not", "absurd" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt_irrefl (n : Nat) : Not (LT.lt n n)
Nat.not_succ_le_self n
theorem
Nat.lt_irrefl
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.not_succ_le_self", "Not" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt_of_le_of_lt {n m k : Nat} (h₁ : LE.le n m) (h₂ : LT.lt m k) : LT.lt n k
Nat.le_trans (Nat.succ_le_succ h₁) h₂
theorem
Nat.lt_of_le_of_lt
Init
src/Init/Prelude.lean
[]
[ "Nat", "Nat.le_trans", "Nat.succ_le_succ" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_antisymm {n m : Nat} (h₁ : LE.le n m) (h₂ : LE.le m n) : Eq n m
match h₁ with | Nat.le.refl => rfl | Nat.le.step h => absurd (Nat.lt_of_le_of_lt h h₂) (Nat.lt_irrefl n)
theorem
Nat.le_antisymm
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "Nat.lt_irrefl", "Nat.lt_of_le_of_lt", "absurd", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.lt_of_le_of_ne {n m : Nat} (h₁ : LE.le n m) (h₂ : Not (Eq n m)) : LT.lt n m
match Nat.lt_or_ge n m with | Or.inl h₃ => h₃ | Or.inr h₃ => absurd (Nat.le_antisymm h₁ h₃) h₂
theorem
Nat.lt_of_le_of_ne
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "Nat.le_antisymm", "Nat.lt_or_ge", "Not", "absurd" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.le_of_ble_eq_true (h : Eq (Nat.ble n m) true) : LE.le n m
match n, m with | 0, _ => Nat.zero_le _ | succ _, succ _ => Nat.succ_le_succ (le_of_ble_eq_true h)
theorem
Nat.le_of_ble_eq_true
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat.ble", "Nat.succ_le_succ", "Nat.zero_le" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.ble_self_eq_true : (n : Nat) → Eq (Nat.ble n n) true
| 0 => rfl | succ n => ble_self_eq_true n
theorem
Nat.ble_self_eq_true
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "Nat.ble", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.ble_succ_eq_true : {n m : Nat} → Eq (Nat.ble n m) true → Eq (Nat.ble n (succ m)) true
| 0, _, _ => rfl | succ n, succ _, h => ble_succ_eq_true (n := n) h
theorem
Nat.ble_succ_eq_true
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat", "Nat.ble", "rfl" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6
Nat.ble_eq_true_of_le (h : LE.le n m) : Eq (Nat.ble n m) true
match h with | Nat.le.refl => Nat.ble_self_eq_true n | Nat.le.step h => Nat.ble_succ_eq_true (ble_eq_true_of_le h)
theorem
Nat.ble_eq_true_of_le
Init
src/Init/Prelude.lean
[]
[ "Eq", "Nat.ble", "Nat.ble_self_eq_true", "Nat.ble_succ_eq_true" ]
https://github.com/leanprover/lean4
d265d1ca745e7741a7e7f7366c22ce9c9dda57b6