def nonempty_power_depth

stelliferous@0.0.2.0 · proofs/word_power_of_two.bend:327

import stelliferous@0.0.2.0/proofs/word_power_of_two.bend as WordPowerOfTwo
import Base
import stelliferous@0.0.2.0/proofs/word_encoding.bend as WordEncoding

327# A nonempty checked owner cannot have a power-of-two capacity truncated to
328# zero. This recovers the full machine-depth bound from its existing guard.
329def nonempty_power_depth(+width: Nat,+depth: Nat,positive: {Nat.is_lt(0n,Word.to_nat(width,power(width,depth))) == True{} : Bool}) ->
330  {Nat.is_lt(depth,width) == True{} : Bool}:
331  match width:
332    case 0n: Empty.absurd({Nat.is_lt(depth,0n) == True{} : Bool},WordEncoding.false_true(positive))
333    case 1n+ +rest:
334      match depth:
335        case 0n: {==}
336        case 1n+ +previous:
337          nonempty_power_depth(rest,previous,positive_double(Word.to_nat(rest,power(rest,previous)),positive))

Uses (8)

Used by (1)