Rel.rc_sub: def of bend-collections-laws-crypto@1.0.0.0 Import: import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/rel.bend as Rel Lines 32-40 of bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/rel.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/rel.bend&start_line=32&end_line=40 import Base import bend-collections-laws-crypto@1.0.0.0/spec/crypto/curve25519/field.bend as FS import bend-collections-laws-crypto@1.0.0.0/src/crypto/curve25519/field.bend as F import bend-collections-laws-crypto@1.0.0.0/proofs/lib/nat.bend as N import bend-collections-laws-crypto@1.0.0.0/proofs/lib/word.bend as WD import bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/arith.bend as NR import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/limbs.bend as LM import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/fieldops.bend as FO import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend as G def rc_sub(+one: Nat, +h1: {one == 1n : Nat}, +pp: Nat, +hP: {Nat.add(1n+pp, 19n) == WD.sc(255n, one) : Nat}, +x: List<&2, U32>, +y: List<&2, U32>, +a: Nat, +b: Nat, +ox: {LM.okb(32n, x, 255n) == True{} : Bool}, +cx: G.ceq(pp, FS.value(x), a), +oy: {LM.okb(32n, y, 255n) == True{} : Bool}, +cy: G.ceq(pp, FS.value(y), b)) -> G.ceq(pp, FS.value(F.sub(x, y)), FS.fsub(1n+pp, a, b)): +P = {1n+pp : Nat} +mb = Nat.mod(b, P) +e1 = FO.sub_mod(one, h1, pp, hP, x, y, ox, oy) +e2 = G.c_eq(pp, Nat.sub(Nat.add(FS.value(x), P), Nat.mod(FS.value(y), P)), Nat.sub(Nat.add(FS.value(x), P), mb), Equal.cong(Nat, Nat, z => Nat.sub(Nat.add(FS.value(x), P), z), Nat.mod(FS.value(y), P), mb, cy)) +e3 = G.c_subm(pp, FS.value(x), a, mb, cx, N.lt_le(mb, P, NR.dm_lt(pp, b))) +e4 = G.c_sym(pp, Nat.mod(Nat.sub(Nat.add(a, P), mb), P), Nat.sub(Nat.add(a, P), mb), G.c_mod(pp, Nat.sub(Nat.add(a, P), mb))) +e = G.c_trans(pp, FS.value(F.sub(x, y)), Nat.sub(Nat.add(FS.value(x), P), Nat.mod(FS.value(y), P)), FS.fsub(P, a, b), e1, G.c_trans(pp, Nat.sub(Nat.add(FS.value(x), P), Nat.mod(FS.value(y), P)), Nat.sub(Nat.add(FS.value(x), P), mb), FS.fsub(P, a, b), e2, G.c_trans(pp, Nat.sub(Nat.add(FS.value(x), P), mb), Nat.sub(Nat.add(a, P), mb), FS.fsub(P, a, b), e3, e4))) e Uses (22): 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=List 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.mod 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=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend&name=c_eq https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend&name=c_mod https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend&name=c_subm https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend&name=c_sym https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend&name=c_trans https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/cong.bend&name=ceq https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/fieldops.bend&name=sub_mod https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/curve25519/limbs.bend&name=okb https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/lib/nat.bend&name=lt_le https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/lib/word.bend&name=sc https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/arith.bend&name=dm_lt https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/curve25519/field.bend&name=fsub https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/curve25519/field.bend&name=value https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/curve25519/field.bend&name=sub