def ilog_go
import bend-collections-laws-math@1.0.0.0/src/math/natural.bend as Naturalimport Base
252# the largest k with b^k <= n: p is b^k, `up` is p * b <= n, asked as
253# p <= n / b so no product above n is formed
254def ilog_go(fuel: Nat, +n: Nat, +b: Nat, +k: Nat, +p: Nat, +up: Bool) -> Nat:
255 match fuel up:
256 case 0n _:
257 k
258 case 1n+f False{}:
259 k
260 case 1n+f True{}:
261 ilog_go(f, n, b, 1n+k, Nat.mul(p, b), Nat.is_le(Nat.mul(p, b), Nat.div(n, b)))
Uses (5)
Used by (10)
- bend-collections-laws-math@1.0.0.0/src/math/natural:ilog_ok
- bend-collections-laws-math@1.0.0.0/proofs/math/natural/logs:ilog_value
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/natfuel:il_140
- bend-collections-laws-math@1.0.0.0/proofs/math/natural/logs:ilog_ok
- bend-collections-laws-math@1.0.0.0/proofs/math/typed/natfuel:il_fuel
- …