Documentation

HexECPP.Affine

inductive Hex.ECPP.Point :

Coordinates used when checking a primality certificate's scalar multiplication: either the point at infinity or a finite pair of natural numbers. Curve membership and reduced coordinates are checked separately.

Instances For
    Equations
    Instances For
      def Hex.ECPP.modSub (n a b : Nat) :

      Natural subtraction interpreted modulo n, for canonical operands.

      Equations
      Instances For
        def Hex.ECPP.onCurve (n a b x y : Nat) :

        The equation of the short Weierstrass curve.

        Equations
        Instances For

          A canonical point has both coordinates below the modulus.

          Equations
          Instances For

            Infinity belongs to every short curve; finite points satisfy its equation.

            Equations
            Instances For
              def Hex.ECPP.addWithInverse (n x₁ y₁ x₂ d v : Nat) (inverses : List Nat) :

              Complete one division branch, consuming exactly one inverse witness.

              Equations
              Instances For
                def Hex.ECPP.add? (n a : Nat) (P Q : Point) (inverses : List Nat) :

                Partial affine addition with explicit inverse witnesses.

                Equations
                Instances For
                  def Hex.ECPP.checkedAdd? (n a b : Nat) (P Q : Point) (inverses : List Nat) :

                  Replay accepts only canonical points on the supplied curve after each addition. This makes both arithmetic invariants local, executable checks.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Hex.ECPP.checkedAdd_facts {n a b : Nat} {P Q R : Point} {ws rest : List Nat} (h : checkedAdd? n a b P Q ws = some (R, rest)) :
                    add? n a P Q ws = some (R, rest) ∧ Point.canonical n R = true ∧ Point.onCurve n a b R = true

                    Accepted checked additions satisfy the raw branch and both local arithmetic invariants.

                    theorem Hex.ECPP.modSub_lt {n a b : Nat} (hn : 0 < n) :
                    modSub n a b < n

                    Modular subtraction returns a canonical residue for a positive modulus.

                    theorem Hex.ECPP.addWithInverse_canonical {n x₁ y₁ x₂ d v : Nat} {ws rest : List Nat} {R : Point} (hn : 0 < n) (h : addWithInverse n x₁ y₁ x₂ d v ws = some (R, rest)) :

                    A successful division branch returns canonical coordinates.

                    theorem Hex.ECPP.addWithInverse_spec {n x₁ y₁ x₂ d v : Nat} {ws rest : List Nat} {R : Point} (h : addWithInverse n x₁ y₁ x₂ d v ws = some (R, rest)) :
                    ∃ (u : Nat), ws = u :: rest ∧ u < n ∧ d * u % n = 1 ∧ R = Point.affine (modSub n (modSub n (v * u % n * (v * u % n) % n) x₁) x₂) (modSub n (v * u % n * modSub n x₁ (modSub n (modSub n (v * u % n * (v * u % n) % n) x₁) x₂) % n) y₁)

                    A successful division branch used exactly the next checked witness.