W64m128.QSUB: def of bend-collections-laws-crypto@1.0.0.0 Import: import bend-collections-laws-crypto@1.0.0.0/proofs/math/typed/w64m128.bend as W64m128 Lines 104-108 of bend-collections-laws-crypto@1.0.0.0/proofs/math/typed/w64m128.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/math/typed/w64m128.bend&start_line=104&end_line=108 import Base import bend-collections-laws-crypto@1.0.0.0/src/math/w64.bend as X import bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend as WU import bend-collections-laws-crypto@1.0.0.0/proofs/lib/word.bend as WD # a - b wraps: (a - b mod 2^64) + b == a + 2^64 * qs def QSUB(+one: Nat, +a: WU.U64, +b: WU.U64) -> Nat: match a b: case WU.U64{+al, +ah} WU.U64{+bl, +bh}: Nat.add(WD.bo(U32.is_lt(ah, bh), one), WD.bo(U32.is_lt(U32.sub(ah, bh), X.b32(U32.is_lt(al, bl))), one)) Uses (7): 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=U32.is_lt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/lib/word.bend&name=bo https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend&name=U64 https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/math/w64.bend&name=b32