Fieldops.sub_v: def of bend-collections-laws-crypto@1.0.0.0 Import: import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend as Fieldops Lines 144-154 of bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend&start_line=144&end_line=154 import Base import bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/field.bend as FS import bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/limbs.bend as L import bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/field.bend as F import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/limbs.bend as LV import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/consts.bend as K import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/negate.bend as NG def sub_v(+one: Nat, +h1: {one == 1n : Nat}, +a: List<&2, Nat>, +b: List<&2, Nat>, +ha: {FS.reduced(one, FS.prime(one), a) == True{} : Bool}, +hb: {FS.reduced(one, FS.prime(one), b) == True{} : Bool}) -> {FS.value(one, F.sub(a, b)) == FS.msub(FS.prime(one), FS.value(one, a), FS.value(one, b)) : Nat}: %Equal.sym(List<&2, Nat>, F.sub(a, b), F.reduce(L.add(a, L.neg_raw(F.c(), b))), sub_go(one, h1, a, b, ha)) : {FS.value(one, _) == FS.msub(FS.prime(one), FS.value(one, a), FS.value(one, b)) : Nat} %Equal.sym(Nat, FS.value(one, F.reduce(L.add(a, L.neg_raw(F.c(), b)))), Nat.mod(LV.ev(L.add(a, L.neg_raw(F.c(), b))), FS.prime(one)), red_v(one, h1, L.add(a, L.neg_raw(F.c(), b)), sub_hx(one, h1, a, b, ha, hb))) : {_ == Nat.mod(Nat.sub(Nat.add(FS.value(one, a), FS.prime(one)), Nat.mod(FS.value(one, b), FS.prime(one))), FS.prime(one)) : Nat} %Equal.sym(Nat, LV.ev(L.add(a, L.neg_raw(F.c(), b))), Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), LV.add_v(a, L.neg_raw(F.c(), b))) : {Nat.mod(_, FS.prime(one)) == Nat.mod(Nat.sub(Nat.add(FS.value(one, a), FS.prime(one)), Nat.mod(FS.value(one, b), FS.prime(one))), FS.prime(one)) : Nat} %Equal.sym(Nat, FS.value(one, a), LV.ev(a), LV.ev_value(one, h1, a)) : {Nat.mod(Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), FS.prime(one)) == Nat.mod(Nat.sub(Nat.add(_, FS.prime(one)), Nat.mod(FS.value(one, b), FS.prime(one))), FS.prime(one)) : Nat} %Equal.sym(Nat, FS.value(one, b), LV.ev(b), LV.ev_value(one, h1, b)) : {Nat.mod(Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), FS.prime(one)) == Nat.mod(Nat.sub(Nat.add(LV.ev(a), FS.prime(one)), Nat.mod(_, FS.prime(one))), FS.prime(one)) : Nat} %Equal.sym(Nat, FS.prime(one), 1n+K.pp(one), K.prime_eq(one, h1)) : {Nat.mod(Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), _) == Nat.mod(Nat.sub(Nat.add(LV.ev(a), FS.prime(one)), Nat.mod(LV.ev(b), FS.prime(one))), FS.prime(one)) : Nat} %Equal.sym(Nat, FS.prime(one), 1n+K.pp(one), K.prime_eq(one, h1)) : {Nat.mod(Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), 1n+K.pp(one)) == Nat.mod(Nat.sub(Nat.add(LV.ev(a), _), Nat.mod(LV.ev(b), FS.prime(one))), FS.prime(one)) : Nat} %Equal.sym(Nat, FS.prime(one), 1n+K.pp(one), K.prime_eq(one, h1)) : {Nat.mod(Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), 1n+K.pp(one)) == Nat.mod(Nat.sub(Nat.add(LV.ev(a), 1n+K.pp(one)), Nat.mod(LV.ev(b), _)), FS.prime(one)) : Nat} %Equal.sym(Nat, FS.prime(one), 1n+K.pp(one), K.prime_eq(one, h1)) : {Nat.mod(Nat.add(LV.ev(a), LV.ev(L.neg_raw(F.c(), b))), 1n+K.pp(one)) == Nat.mod(Nat.sub(Nat.add(LV.ev(a), 1n+K.pp(one)), Nat.mod(LV.ev(b), 1n+K.pp(one))), _) : Nat} NG.sub_mod(K.pp(one), LV.ev(a), LV.ev(b), LV.ev(L.neg_raw(F.c(), b)), rlt(one, h1, b, hb), negr_e(one, h1, b, hb)) Uses (27): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Equal.sym 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=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/consts.bend&name=pp https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/consts.bend&name=prime_eq https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend&name=negr_e https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend&name=red_v https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend&name=rlt https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend&name=sub_go https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldops.bend&name=sub_hx https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/limbs.bend&name=add_v https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/limbs.bend&name=ev https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/limbs.bend&name=ev_value https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/negate.bend&name=sub_mod https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/field.bend&name=msub https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/field.bend&name=prime https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/field.bend&name=reduced https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/field.bend&name=value https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/field.bend&name=c https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/field.bend&name=reduce https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/field.bend&name=sub https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/limbs.bend&name=add https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/limbs.bend&name=neg_raw