A recursor for Nat that uses the notations 0 for Nat.zero and n + 1 for Nat.succ.
It is otherwise identical to the default recursor Nat.rec. It is used by the induction tactic
by default for Nat.
Equations
- Nat.recAux zero succ t = Nat.rec zero succ t
Instances For
A case analysis principle for Nat that uses the notations 0 for Nat.zero and n + 1 for
Nat.succ.
It is otherwise identical to the default recursor Nat.casesOn. It is used as the default Nat
case analysis principle for Nat by the cases tactic.
Equations
- Nat.casesAuxOn t zero succ = Nat.casesOn t zero succ
Instances For
Applies a function to a starting value the specified number of times.
In other words, f is iterated n times on a.
Examples:
Nat.repeat f 3 a = f <| f <| f <| aNat.repeat (· ++ "!") 4 "Hello" = "Hello!!!!"
Equations
- Nat.repeat f 0 x✝ = x✝
- Nat.repeat f n.succ x✝ = f (Nat.repeat f n x✝)
Instances For
Applies a function to a starting value the specified number of times.
In other words, f is iterated n times on a.
This is a tail-recursive version of Nat.repeat that's used at runtime.
Examples:
Nat.repeatTR f 3 a = f <| f <| f <| aNat.repeatTR (· ++ "!") 4 "Hello" = "Hello!!!!"
Equations
- Nat.repeatTR f n a = Nat.repeatTR.loop f n a
Instances For
Equations
- Nat.repeatTR.loop f 0 x✝ = x✝
- Nat.repeatTR.loop f n.succ x✝ = Nat.repeatTR.loop f n (f x✝)
Instances For
The Boolean less-than 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: