Theorem: BabySNARK.is_sound
Proof state before:
case intro
F : Type
inst✝ : Field F
n_stmt n_wit n_var : ℕ
u_stmt : Fin n_stmt → Polynomial F
u_wit : Fin n_wit → Polynomial F
v_stmt : Fin n_stmt → Polynomial F
v_wit : Fin n_wit → Polynomial F
w_stmt : Fin n_stmt → Polynomial F
w_wit : Fin n_wit → Polynomial F
t : Polynomial F
ht : (List.map (fun x => Polynomial.C (t.coeff ↑x) * Polynomial.X ^ ↑x) (List.finRange n_var)).sum = t
ht0 : t.Monic
stmt : BabySNARK.Stmt
prover : Prover F BabySNARK
eqns :
  ∀ (check_idx : BabySNARK.EqualityChecks),
    (List.map
          (fun pairing =>
            ((List.map
                    (fun pf_elem =>
                      C (BabySNARK.verificationPairingProof_G1 stmt check_idx pairing pf_elem) *
                        (List.map
                            (fun SRS_elem => C (prover.1 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
                            BabySNARK.ListSRSElements_G1).sum)
                    BabySNARK.ListProof_G1).sum +
                (List.map
                    (fun SRS_elem =>
                      C (BabySNARK.verificationPairingSRS_G1 stmt check_idx pairing SRS_elem) *
                        BabySNARK.SRSElementValue_G1 SRS_elem)
                    BabySNARK.ListSRSElements_G1).sum) *
              ((List.map
                    (fun pf_elem =>
                      C (BabySNARK.verificationPairingProof_G2 stmt check_idx pairing pf_elem) *
                        (List.map
                            (fun SRS_elem => C (prover.2 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
                            BabySNARK.ListSRSElements_G2).sum)
                    BabySNARK.ListProof_G2).sum +
                (List.map
                    (fun SRS_elem =>
                      C (BabySNARK.verificationPairingSRS_G2 stmt check_idx pairing SRS_elem) *
                        BabySNARK.SRSElementValue_G2 SRS_elem)
                    BabySNARK.ListSRSElements_G2).sum))
          (BabySNARK.ListPairings check_idx)).sum =
      0
typeI_identification :
  ∀ pfs ∈ BabySNARK.Identified_Proof_Elems,
    (List.map (fun SRS_elem => C (prover.1 pfs.1 SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
          BabySNARK.ListSRSElements_G1).sum =
      (List.map (fun SRS_elem => C (prover.2 pfs.2 SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
          BabySNARK.ListSRSElements_G2).sum
eqnI :
  (List.map
        (fun pairing =>
          ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G1 stmt ChecksIdx.CheckI pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.1 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
                          BabySNARK.ListSRSElements_G1).sum)
                  BabySNARK.ListProof_G1).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G1 stmt ChecksIdx.CheckI pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G1 SRS_elem)
                  BabySNARK.ListSRSElements_G1).sum) *
            ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G2 stmt ChecksIdx.CheckI pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.2 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
                          BabySNARK.ListSRSElements_G2).sum)
                  BabySNARK.ListProof_G2).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G2 stmt ChecksIdx.CheckI pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G2 SRS_elem)
                  BabySNARK.ListSRSElements_G2).sum))
        (BabySNARK.ListPairings ChecksIdx.CheckI)).sum =
    0
eqnII :
  (List.map
        (fun pairing =>
          ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G1 stmt ChecksIdx.CheckII pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.1 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
                          BabySNARK.ListSRSElements_G1).sum)
                  BabySNARK.ListProof_G1).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G1 stmt ChecksIdx.CheckII pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G1 SRS_elem)
                  BabySNARK.ListSRSElements_G1).sum) *
            ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G2 stmt ChecksIdx.CheckII pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.2 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
                          BabySNARK.ListSRSElements_G2).sum)
                  BabySNARK.ListProof_G2).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G2 stmt ChecksIdx.CheckII pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G2 SRS_elem)
                  BabySNARK.ListSRSElements_G2).sum))
        (BabySNARK.ListPairings ChecksIdx.CheckII)).sum =
    0
⊢ (((List.map (fun i => Polynomial.C (stmt i) * u_stmt i) (List.finRange n_stmt)).sum +
              (List.map
                  (fun i =>
                    Polynomial.C ((fun prover i => prover.1 Proof_Idx.B (SRS_Elements_Idx.βu i)) prover i) * u_wit i)
                  (List.finRange n_wit)).sum) ^
            2 -
          1).modByMonic
      t =
    0
Tactic:
clear eqns
Proof state after:
case intro
F : Type
inst✝ : Field F
n_stmt n_wit n_var : ℕ
u_stmt : Fin n_stmt → Polynomial F
u_wit : Fin n_wit → Polynomial F
v_stmt : Fin n_stmt → Polynomial F
v_wit : Fin n_wit → Polynomial F
w_stmt : Fin n_stmt → Polynomial F
w_wit : Fin n_wit → Polynomial F
t : Polynomial F
ht : (List.map (fun x => Polynomial.C (t.coeff ↑x) * Polynomial.X ^ ↑x) (List.finRange n_var)).sum = t
ht0 : t.Monic
stmt : BabySNARK.Stmt
prover : Prover F BabySNARK
typeI_identification :
  ∀ pfs ∈ BabySNARK.Identified_Proof_Elems,
    (List.map (fun SRS_elem => C (prover.1 pfs.1 SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
          BabySNARK.ListSRSElements_G1).sum =
      (List.map (fun SRS_elem => C (prover.2 pfs.2 SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
          BabySNARK.ListSRSElements_G2).sum
eqnI :
  (List.map
        (fun pairing =>
          ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G1 stmt ChecksIdx.CheckI pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.1 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
                          BabySNARK.ListSRSElements_G1).sum)
                  BabySNARK.ListProof_G1).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G1 stmt ChecksIdx.CheckI pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G1 SRS_elem)
                  BabySNARK.ListSRSElements_G1).sum) *
            ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G2 stmt ChecksIdx.CheckI pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.2 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
                          BabySNARK.ListSRSElements_G2).sum)
                  BabySNARK.ListProof_G2).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G2 stmt ChecksIdx.CheckI pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G2 SRS_elem)
                  BabySNARK.ListSRSElements_G2).sum))
        (BabySNARK.ListPairings ChecksIdx.CheckI)).sum =
    0
eqnII :
  (List.map
        (fun pairing =>
          ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G1 stmt ChecksIdx.CheckII pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.1 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G1 SRS_elem)
                          BabySNARK.ListSRSElements_G1).sum)
                  BabySNARK.ListProof_G1).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G1 stmt ChecksIdx.CheckII pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G1 SRS_elem)
                  BabySNARK.ListSRSElements_G1).sum) *
            ((List.map
                  (fun pf_elem =>
                    C (BabySNARK.verificationPairingProof_G2 stmt ChecksIdx.CheckII pairing pf_elem) *
                      (List.map (fun SRS_elem => C (prover.2 pf_elem SRS_elem) * BabySNARK.SRSElementValue_G2 SRS_elem)
                          BabySNARK.ListSRSElements_G2).sum)
                  BabySNARK.ListProof_G2).sum +
              (List.map
                  (fun SRS_elem =>
                    C (BabySNARK.verificationPairingSRS_G2 stmt ChecksIdx.CheckII pairing SRS_elem) *
                      BabySNARK.SRSElementValue_G2 SRS_elem)
                  BabySNARK.ListSRSElements_G2).sum))
        (BabySNARK.ListPairings ChecksIdx.CheckII)).sum =
    0
⊢ (((List.map (fun i => Polynomial.C (stmt i) * u_stmt i) (List.finRange n_stmt)).sum +
              (List.map
                  (fun i =>
                    Polynomial.C ((fun prover i => prover.1 Proof_Idx.B (SRS_Elements_Idx.βu i)) prover i) * u_wit i)
                  (List.finRange n_wit)).sum) ^
            2 -
          1).modByMonic
      t =
    0