AFTD Auto-Formalizing Theoretical Domains

ks2_yes_instance_congr_outer

theoremverified

The yes-instance property depends on the encoded vectors only through their outer products: for all c, α, d and lists vs, vs' of encoded vectors, if the list of outer products ks2_instance_outer d p' for p' in vs' equals the list of outer products ks2_instance_outer d p for p in vs, then ks2_yes_instance c α d vs' holds if and only if ks2_yes_instance c α d vs holds.

Statement

theorem ks2_yes_instance_congr_outer (c : ℝ) (α : ℚ) (d : ℕ) (vs vs' : List (ℚ × List (ℚ × ℚ)))
    (h : vs'.map (ks2_instance_outer d) = vs.map (ks2_instance_outer d)) :
    ks2_yes_instance c α d vs' ↔ ks2_yes_instance c α d vs
Source
Helper for OP-2182: with ks2_distinct_phase_twist it shows that re-phasing an instance to make its vectors distinct keeps validity and the answer.
Verified
26 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • ks2_yes_instanceWith explicit arguments c : ℝ, α : ℚ, d : ℕ and vs : List (ℚ × List (ℚ × ℚ)), in this order, the proposition that (α, vs) is a valid input…
  • ks2_instance_outerWith explicit arguments d : ℕ and p : ℚ × List (ℚ × ℚ), in this order: the d×d complex matrix v v† (type Matrix (Fin d) (Fin d) ℂ), where…
  • ks2_instance_vectorWith explicit arguments d : ℕ and p : ℚ × List (ℚ × ℚ), in this order, where p = (t, w): the complex vector Fin d → ℂ whose j-th…

The proof, explained

Whether an encoded vector list constitutes a yes-instance of the KS2 problem depends solely on the list of outer products of its vectors. The proof reduces the equivalence to a one-directional transfer lemma: if two lists have identical outer products, yes-instance validity transfers from one to the other. Most conditions in the definition (the identity sum, the length of the sign sequence, and the signed operator norm) depend only on the outer products directly, while each vector's Euclidean norm is recovered as the trace of its outer product matrix.

  1. To establish the equivalence, it suffices to prove that whenever two lists us and ws have the same outer products, ks2_yes_instance for us implies ks2_yes_instance for ws.

    We set up an auxiliary implication `key` between two arbitrary lists `us` and `ws` having the same outer products. We introduce the assumption that `us` is a yes-instance, destructuring its definition into the positivity parameter α > 0 (h0), the per-vector squared norm bounds (h1), the outer product sum equaling the identity (h2), and the witness sign list s of length |us| with its operator norm bound (hs, h3).

    lines 4–7

      have key : ∀ (us ws : List (ℚ × List (ℚ × ℚ))),
          us.map (ks2_instance_outer d) = ws.map (ks2_instance_outer d) →
          ks2_yes_instance c α d us → ks2_yes_instance c α d ws := by
        intro us ws h ⟨h0, h1, h2, s, hs, h3⟩
  2. For every encoded vector p, its squared Euclidean norm equals the real part of the trace of its outer product matrix.

    The outer product is the rank-one matrix v(p) v(p)*. Its diagonal entries are v(p)ⱼ · v(p)ⱼ*, which equal ‖v(p)ⱼ‖². The trace sums these diagonal entries, so its real part recovers the squared Euclidean norm of v(p).

    lines 8–12

    uses ks2_instance_outer, Matrix.trace, Matrix.vecMulVec_apply, Complex.mul_conj, Complex.normSq_eq_norm_sq, Complex.ofReal_pow

        have hnorm : ∀ p, (∑ j, ‖ks2_instance_vector d p j‖ ^ 2 : ℝ) =
            (Matrix.trace (ks2_instance_outer d p)).re := by
          intro p
          simp [ks2_instance_outer, Matrix.trace, Matrix.vecMulVec_apply, Complex.mul_conj,
            Complex.normSq_eq_norm_sq, ← Complex.ofReal_pow]
  3. A signed sum of outer products along a vector list depends only on the list of outer products.

    Using `List.zipWith_map_right`, the signed combination of outer products of elements in xs is rewritten as the signed combination over the mapped list of outer products xs.map (ks2_instance_outer d).

    lines 13–17

    uses List.zipWith_map_right

        have hz : ∀ (s : List Bool) (xs : List (ℚ × List (ℚ × ℚ))),
            List.zipWith (fun b p => (if b then (1 : ℂ) else -1) • ks2_instance_outer d p) s xs =
            List.zipWith (fun b (M : Matrix (Fin d) (Fin d) ℂ) => (if b then (1 : ℂ) else -1) • M) s
              (xs.map (ks2_instance_outer d)) := by
          intro s xs; rw [List.zipWith_map_right]
  4. The lists us and ws have equal length.

    Applying `List.length` to both sides of the hypothesis `us.map (...) = ws.map (...)` shows `us.length = ws.length`, because mapping preserves list lengths.

    line 18

    uses congrArg, List.length

        have hlen : us.length = ws.length := by simpa using congrArg List.length h
  5. The yes-instance conditions for ws hold, provided its vectors satisfy the squared norm bound.

    We transfer the yes-instance witness from `us` to `ws`: α > 0 is unchanged; the sum of outer products equals 1 because `ws.map (...)` equals `us.map (...)`; the same sign sequence s works because `s.length = us.length = ws.length`; and the operator norm bound holds because the signed sum depends only on the mapped outer products, which coincide.

    line 19

        refine ⟨h0, ?_, by rw [← h]; exact h2, s, by omega, by rw [hz, ← h, ← hz]; exact h3⟩
  6. Every vector in ws satisfies the squared norm bound.

    For any q in ws, its outer product belongs to the mapped outer products of ws, hence to those of us. By `List.mem_map.mp`, there is some vector p in us with the identical outer product. Since the squared Euclidean norm is the real trace of the outer product, q and p have identical squared norms, so q satisfies the same bound α as p.

    lines 20–24

    uses List.mem_map_of_mem, List.mem_map.mp

        intro q hq
        have : ks2_instance_outer d q ∈ us.map (ks2_instance_outer d) := by
          rw [h]; exact List.mem_map_of_mem hq
        obtain ⟨p, hp, hpq⟩ := List.mem_map.mp this
        rw [hnorm, ← hpq, ← hnorm]; exact h1 p hp
  7. The yes-instance property for vs' is equivalent to the yes-instance property for vs.

    Applying the helper lemma `key` to the hypothesis h gives the forward direction, and applying it to the symmetric equality h.symm gives the backward direction.

    line 25

      exact ⟨key _ _ h, key _ _ h.symm⟩
ks2_instance_outer
The rank-one outer product matrix v v* associated with an encoded vector.
Matrix.trace
The trace of a square matrix, defined as the sum of its diagonal entries.
Matrix.vecMulVec_apply
The (i, j)-entry of an outer product matrix v w* equals v_i * w_j.
Complex.mul_conj
For any complex number z, the product z * z̄ equals the squared absolute value |z|².
Complex.normSq_eq_norm_sq
The algebraic squared norm of a complex number equals the square of its standard norm ‖z‖².
Complex.ofReal_pow
The complex coercion of a real power rⁿ equals (r : ℂ)ⁿ.
List.zipWith_map_right
Combining lists with a mapped second list, zipWith g l₁ (l₂.map f), equals zipWith (fun a b => g a (f b)) l₁ l₂.
congrArg
If two arguments are equal, applying the same function yields equal results: a₁ = a₂ implies f(a₁) = f(a₂).
List.length
The number of elements in a list.
List.mem_map_of_mem
If a is an element of l, then f(a) is an element of l.map(f).
List.mem_map.mp
If an element belongs to l.map(f), then it equals f(a) for some element a in l.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

theorem ks2_yes_instance_congr_outer (c : ℝ) (α : ℚ) (d : ℕ) (vs vs' : List (ℚ × List (ℚ × ℚ)))    (h : vs'.map (ks2_instance_outer d) = vs.map (ks2_instance_outer d)) :    ks2_yes_instance c α d vs' ↔ ks2_yes_instance c α d vs := by  have key : ∀ (us ws : List (ℚ × List (ℚ × ℚ))),      us.map (ks2_instance_outer d) = ws.map (ks2_instance_outer d) →      ks2_yes_instance c α d us → ks2_yes_instance c α d ws := by    intro us ws h ⟨h0, h1, h2, s, hs, h3⟩    have hnorm : ∀ p, (∑ j, ‖ks2_instance_vector d p j‖ ^ 2 : ℝ) =        (Matrix.trace (ks2_instance_outer d p)).re := by      intro p      simp [ks2_instance_outer, Matrix.trace, Matrix.vecMulVec_apply, Complex.mul_conj,        Complex.normSq_eq_norm_sq, ← Complex.ofReal_pow]    have hz : ∀ (s : List Bool) (xs : List (ℚ × List (ℚ × ℚ))),        List.zipWith (fun b p => (if b then (1 : ℂ) else -1) • ks2_instance_outer d p) s xs =        List.zipWith (fun b (M : Matrix (Fin d) (Fin d) ℂ) => (if b then (1 : ℂ) else -1) • M) s          (xs.map (ks2_instance_outer d)) := by      intro s xs; rw [List.zipWith_map_right]    have hlen : us.length = ws.length := by simpa using congrArg List.length h    refine ⟨h0, ?_, by rw [← h]; exact h2, s, by omega, by rw [hz, ← h, ← hz]; exact h3⟩    intro q hq    have : ks2_instance_outer d q ∈ us.map (ks2_instance_outer d) := by      rw [h]; exact List.mem_map_of_mem hq    obtain ⟨p, hp, hpq⟩ := List.mem_map.mp this    rw [hnorm, ← hpq, ← hnorm]; exact h1 p hp  exact ⟨key _ _ h, key _ _ h.symm⟩
See it in the graphDiscuss this resultChallenge it