This is an opaque wrapper around Nat.pow
to prevent lean from unfolding the definition of
Nat.pow
on numerals. The arbitrary precondition p
is actually a formula of the form
Nat.pow a' b' = c'
but we usually don't care to unfold this proposition so we just carry a
reference to it.
- run' : p → a.pow b = c
Unfolds the assertion.
Instances For
Unfolds the assertion.
This is the key to making the proof proceed as a balanced tree of applications instead of a linear sequence. It is just modus ponens after unwrapping the definitions.
Proves Nat.pow a b = c
where a
and b
are raw nat literals. This could be done by just
rfl
but the kernel does not have a special case implementation for Nat.pow
so this would
proceed by unary recursion on b
, which is too slow and also leads to deep recursion.
We instead do the proof by binary recursion, but this can still lead to deep recursion,
so we use an additional trick to do binary subdivision on log2 b
. As a result this produces
a proof of depth log (log b)
which will essentially never overflow before the numbers involved
themselves exceed memory limits.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Invariants: a ^ b₀ = c₀
, depth > 0
, b >>> depth = b₀
, p := Nat.pow $a $b₀ = $c₀
Main part of evalPow
.
Equations
- One or more equations did not get rendered due to their size.
- Mathlib.Meta.NormNum.evalPow.core e f a b nb pb sα (Mathlib.Meta.NormNum.Result'.isBool val proof) = failure