DivisionRemainder.subtraction_conservation: def of bend-collections-laws-math@1.0.0.0 Import: import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/division_remainder.bend as DivisionRemainder Lines 24-26 of bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/division_remainder.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/division_remainder.bend&start_line=24&end_line=26 import Base import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/map_difference_order.bend as Order import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/word_comparison.bend as Compare import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/subtraction_bounds.bend as Sub import bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/division_bounds.bend as Bounds def subtraction_conservation(+r: U32, +d: U32, above: {U32.is_ge(r, d) == True{} : Bool}) -> {U32.to_nat(r) == Nat.add(U32.to_nat(d), U32.to_nat(U32.sub(r, d))) : Nat}: +enough = Equal.trans(Bool, Nat.is_le(U32.to_nat(d), U32.to_nat(r)), Nat.is_ge(U32.to_nat(r), U32.to_nat(d)), True{}, Equal.sym(Bool, Nat.is_ge(U32.to_nat(r), U32.to_nat(d)), Nat.is_le(U32.to_nat(d), U32.to_nat(r)), Bounds.ge_reverse(U32.to_nat(r), U32.to_nat(d))), Equal.trans(Bool, Nat.is_ge(U32.to_nat(r), U32.to_nat(d)), U32.is_ge(r, d), True{}, Equal.sym(Bool, U32.is_ge(r, d), Nat.is_ge(U32.to_nat(r), U32.to_nat(d)), Compare.u32_ge(r, d)), above)) Equal.trans(Nat, U32.to_nat(r), Nat.add(U32.to_nat(d), Nat.sub(U32.to_nat(r), U32.to_nat(d))), Nat.add(U32.to_nat(d), U32.to_nat(U32.sub(r, d))), Equal.sym(Nat, Nat.add(U32.to_nat(d), Nat.sub(U32.to_nat(r), U32.to_nat(d))), U32.to_nat(r), Order.add_complement(U32.to_nat(r), U32.to_nat(d), enough)), Equal.cong(Nat, Nat, x => Nat.add(U32.to_nat(d), x), Nat.sub(U32.to_nat(r), U32.to_nat(d)), U32.to_nat(U32.sub(r, d)), Equal.sym(Nat, U32.to_nat(U32.sub(r, d)), Nat.sub(U32.to_nat(r), U32.to_nat(d)), Sub.u32_exact(r, d, enough)))) Uses (17): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.cong https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.trans 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_ge 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=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_ge https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/division_bounds.bend&name=ge_reverse https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/map_difference_order.bend&name=add_complement https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/subtraction_bounds.bend&name=u32_exact https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/proofs/lib/lemmas/proofs/word_comparison.bend&name=u32_ge