~/bend-docscommunity

proof_shape.bend checks

raw source on the hub · import lawful-halves@0.1.0.0/proof_shape.bend as Proof_shape

4 imports
import Base
import ./defs.bend as D
import ./halves.bend as H
import ./proof_nat.bend as N

Definitions

def sp source · line 10 · raw

@n:Nat -> 0x4491e44095d47e1e063354e32a033566/defs.Tree<&2, Unit>

def bs source · line 17 · raw

@+f:Nat -> @big:Bool -> @+n:Nat -> 0x4491e44095d47e1e063354e32a033566/defs.Tree<&2, Unit>

def count_cons source · line 28 · raw

@+s:0x4491e44095d47e1e063354e32a033566/defs.Tree<&2, Unit> -> {0x4491e44095d47e1e063354e32a033566/defs.count(0x4491e44095d47e1e063354e32a033566/halves.cons(&2, Unit, Unit{}, s)) == 1n+0x4491e44095d47e1e063354e32a033566/defs.count(s) : Nat}

def count_sp source · line 37 · raw

@+n:Nat -> {0x4491e44095d47e1e063354e32a033566/defs.count(sp(n)) == n : Nat}

def count_bs source · line 46 · raw

@+f:Nat -> @big:Bool -> @+n:Nat -> {0x4491e44095d47e1e063354e32a033566/defs.count(bs(f, big, n)) == n : Nat}

def bal_node source · line 61 · raw

@+h:Nat -> @+m:Nat -> @-x:0x4491e44095d47e1e063354e32a033566/defs.Tree<&2, Unit> -> @-y:0x4491e44095d47e1e063354e32a033566/defs.Tree<&2, Unit> -> @cx:{0x4491e44095d47e1e063354e32a033566/defs.count(x) == h : Nat} -> @cy:{0x4491e44095d47e1e063354e32a033566/defs.count(y) == m : Nat} -> @l1:{Nat.is_lt(0n, h) == True{} : Bool} -> @l2:{Nat.is_le(h, m) == True{} : Bool} -> @l3:{Nat.is_le(m, 1n+h) == True{} : Bool} -> @bx:{0x4491e44095d47e1e063354e32a033566/defs.balanced(x) == True{} : Bool} -> @by:{0x4491e44095d47e1e063354e32a033566/defs.balanced(y) == True{} : Bool} -> {0x4491e44095d47e1e063354e32a033566/defs.balanced(0x4491e44095d47e1e063354e32a033566/defs.Node{x, y}) == True{} : Bool}

A Node is balanced when its parts are and their counts h, m have 0 < h <= m <= h + 1.

def bal_bs source · line 77 · raw

@+f:Nat -> @+n:Nat -> @+hf:{Nat.is_le(n, 1n+f) == True{} : Bool} -> {0x4491e44095d47e1e063354e32a033566/defs.balanced(bs(f, Nat.is_lt(1n, n), n)) == True{} : Bool}

bs(f, n >= 2, n) is balanced when n <= f + 1 (the tree of n values has f = n).