Fieldpow.exp_sqrt: def of bend-collections-laws-crypto@1.0.0.0 Import: import bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldpow.bend as Fieldpow Lines 314-323 of bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldpow.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldpow.bend&start_line=314&end_line=323 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/math/natural/arith.bend as NR 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/bitsv.bend as BV # 4 hv(sqrt bits) = p + 1, so hv(sqrt bits) = (p + 1) / 4 def exp_sqrt(+one: Nat, +h1: {one == 1n : Nat}) -> {BV.hv(F.sqrt_bits(), one, 0n) == Nat.div(Nat.add(1n+K.pp(one), 1n), 4n) : Nat}: +d = FS.digits(one, L.norm16([975n, 0n, 1n])) +h = BV.hv(F.sqrt_bits(), one, 0n) +e = NR.add_cancel(Nat.add(d, one), BV.hv(L.cbits(L.bits(L.norm16([975n, 0n, 1n]))), one, 0n), Nat.add(1n+K.pp(one), one), sq_g(one, h1)) +e4 = Equal.trans(Nat, Nat.add(Nat.add(h, h), Nat.add(h, h)), BV.hv(L.cbits(L.bits(L.norm16([975n, 0n, 1n]))), one, 0n), Nat.add(1n+K.pp(one), one), Equal.sym(Nat, BV.hv(L.cbits(L.bits(L.norm16([975n, 0n, 1n]))), one, 0n), Nat.add(Nat.add(h, h), Nat.add(h, h)), sq_four(one)), e) %Equal.sym(Nat, 1n, one, Equal.sym(Nat, one, 1n, h1)) : {BV.hv(F.sqrt_bits(), one, 0n) == Nat.div(Nat.add(1n+K.pp(one), _), 4n) : Nat} %Equal.sym(Nat, Nat.add(1n+K.pp(one), one), Nat.add(Nat.add(BV.hv(F.sqrt_bits(), one, 0n), BV.hv(F.sqrt_bits(), one, 0n)), Nat.add(BV.hv(F.sqrt_bits(), one, 0n), BV.hv(F.sqrt_bits(), one, 0n))), Equal.sym(Nat, Nat.add(Nat.add(BV.hv(F.sqrt_bits(), one, 0n), BV.hv(F.sqrt_bits(), one, 0n)), Nat.add(BV.hv(F.sqrt_bits(), one, 0n), BV.hv(F.sqrt_bits(), one, 0n))), Nat.add(1n+K.pp(one), one), e4)) : {BV.hv(F.sqrt_bits(), one, 0n) == Nat.div(_, 4n) : Nat} %Equal.sym(Nat, Nat.add(Nat.add(BV.hv(F.sqrt_bits(), one, 0n), BV.hv(F.sqrt_bits(), one, 0n)), Nat.add(BV.hv(F.sqrt_bits(), one, 0n), BV.hv(F.sqrt_bits(), one, 0n))), Nat.add(Nat.mul(BV.hv(F.sqrt_bits(), one, 0n), 4n), 0n), four_h(BV.hv(F.sqrt_bits(), one, 0n))) : {BV.hv(F.sqrt_bits(), one, 0n) == Nat.div(_, 4n) : Nat} Equal.sym(Nat, Nat.div(Nat.add(Nat.mul(BV.hv(F.sqrt_bits(), one, 0n), 4n), 0n), 4n), BV.hv(F.sqrt_bits(), one, 0n), NR.div_of(BV.hv(F.sqrt_bits(), one, 0n), 3n, 0n, {==})) Uses (19): 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=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.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.mul https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/bitsv.bend&name=hv 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/fieldpow.bend&name=four_h https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldpow.bend&name=sq_four https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/crypto/secp256k1/fieldpow.bend&name=sq_g https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/arith.bend&name=add_cancel https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/proofs/math/natural/arith.bend&name=div_of https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/spec/crypto/secp256k1/field.bend&name=digits https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/field.bend&name=sqrt_bits https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/limbs.bend&name=bits https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/limbs.bend&name=cbits https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-crypto@1.0.0.0/src/crypto/secp256k1/limbs.bend&name=norm16