@[reducible, inline]
abbrev
Nat.recAux
{motive : Nat → Sort u}
(zero : motive 0)
(succ : (n : Nat) → motive n → motive (n + 1))
(t : Nat)
:
motive t
Recursor identical to Nat.rec
but uses notations 0
for Nat.zero
and · + 1
for Nat.succ
.
Used as the default Nat
eliminator by the induction
tactic.
Equations
- Nat.recAux zero succ t = Nat.rec zero succ t
Instances For
@[reducible, inline]
abbrev
Nat.casesAuxOn
{motive : Nat → Sort u}
(t : Nat)
(zero : motive 0)
(succ : (n : Nat) → motive (n + 1))
:
motive t
Recursor identical to Nat.casesOn
but uses notations 0
for Nat.zero
and · + 1
for Nat.succ
.
Used as the default Nat
eliminator by the cases
tactic.
Equations
- Nat.casesAuxOn t zero succ = Nat.casesOn t zero succ
Instances For
@[inline]
Tail-recursive version of Nat.fold
.
Equations
- Nat.foldTR f n init = Nat.foldTR.loop f n n init
Instances For
@[specialize #[]]
Equations
- Nat.foldTR.loop f n 0 x = x
- Nat.foldTR.loop f n n_1.succ x = Nat.foldTR.loop f n n_1 (f (n - n_1.succ) x)
Instances For
@[specialize #[]]
Nat.foldRev
evaluates f
on the numbers up to n
exclusive, in decreasing order:
Nat.foldRev f 3 init = f 0 <| f 1 <| f 2 <| init
Equations
- Nat.foldRev f 0 x = x
- Nat.foldRev f n.succ x = Nat.foldRev f n (f n x)
Instances For
@[specialize #[]]
Equations
- Nat.anyTR.loop f n 0 = false
- Nat.anyTR.loop f n n_1.succ = (f (n - n_1.succ) || Nat.anyTR.loop f n n_1)
Instances For
@[specialize #[]]
Equations
- Nat.allTR.loop f n 0 = true
- Nat.allTR.loop f n n_1.succ = (f (n - n_1.succ) && Nat.allTR.loop f n n_1)
Instances For
@[specialize #[]]
Nat.repeat f n a
is f^(n) a
; that is, it iterates f
n
times on a
.
Nat.repeat f 3 a = f <| f <| f <| a
Equations
- Nat.repeat f 0 x = x
- Nat.repeat f n.succ x = f (Nat.repeat f n x)
Instances For
@[inline]
Tail-recursive version of Nat.repeat
.
Equations
- Nat.repeatTR f n a = Nat.repeatTR.loop f n a
Instances For
@[specialize #[]]
Equations
- Nat.repeatTR.loop f 0 x = x
- Nat.repeatTR.loop f n.succ x = Nat.repeatTR.loop f n (f x)
Instances For
Helper "packing" theorems #
Helper Bool relation theorems #
Nat.add theorems #
Equations
Equations
Equations
Nat.mul theorems #
Equations
Equations
Equations
Inequalities #
Equations
- Nat.instAntisymmLe = { antisymm := ⋯ }
Equations
- Nat.instAntisymmNotLt = { antisymm := @Nat.instAntisymmNotLt.proof_1 }
le/lt #
zero/one/two #
succ/pred #
Basic theorems for comparing numerals #
mul + order #
power #
min/max #
Auxiliary theorems for well-founded recursion #
pred theorems #
sub theorems #
Mul sub distrib #
Helper normalization theorems #
csimp theorems #
theorem
Nat.repeat_eq_repeatTR.go
(α : Type u_1)
(f : α → α)
(init : α)
(m : Nat)
(n : Nat)
:
Nat.repeatTR.loop f m (Nat.repeat f n init) = Nat.repeat f (m + n) init
@[inline]
(start, stop).foldI f a
evaluates f
on all the numbers
from start
(inclusive) to stop
(exclusive) in increasing order:
(5, 8).foldI f init = init |> f 5 |> f 6 |> f 7
Equations
- Prod.foldI f i a = Nat.foldTR.loop f i.snd (i.snd - i.fst) a