PROOF.nat.add_sub_le: def of bend-osdev-algo@0.1.0.0 Import: import bend-osdev-algo@0.1.0.0/PROOF.bend as PROOF Lines 146-156 of bend-osdev-algo@0.1.0.0/PROOF.bend: https://jend.leeeet.dev/read.txt?path=bend-osdev-algo@0.1.0.0/PROOF.bend&start_line=146&end_line=156 import Base # k <= l <= n gives k + (n - l) <= n def nat.add_sub_le(k: Nat, l: Nat, n: Nat, e: {Nat.is_le(k, l) == True{} : Bool}, f: {Nat.is_le(l, n) == True{} : Bool}) -> {Nat.is_le(Nat.add(k, Nat.sub(n, l)), n) == True{} : Bool}: match k l n: case 0n _ _: nat.sub_le(n, l) case 1n+kp 0n _: Empty.absurd({Nat.is_le(Nat.add(1n+kp, Nat.sub(n, 0n)), n) == True{} : Bool}, absurd.ft(e)) case 1n+kp 1n+lp 0n: Empty.absurd({Nat.is_le(Nat.add(1n+kp, 0n), 0n) == True{} : Bool}, absurd.ft(f)) case 1n+kp 1n+lp 1n+np: nat.add_sub_le(kp, lp, np, e, f) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Empty.absurd https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.sub https://jend.leeeet.dev/definition.txt?path=bend-osdev-algo@0.1.0.0/PROOF.bend&name=absurd.ft https://jend.leeeet.dev/definition.txt?path=bend-osdev-algo@0.1.0.0/PROOF.bend&name=nat.sub_le