import OAI.Computability.UniqueGames.Quadratic.AlignmentCertificateLemmas import OAI.Computability.UniqueGames.Quadratic.Block namespace OAI section /-! # The binary trace annihilator of a quadratic-block hyperplane The trace annihilator of the field hyperplane perpendicular to a nonzero vector is exactly its field line. Scaling test vectors first upgrades binary trace orthogonality to field-valued orthogonality; explicit coordinate test vectors then identify the annihilator. No earlier gadget result is used. -/ namespace UniqueGamesTheorem.Quadratic variable {F : Type*} [Field F] private theorem dot_sub_right (v y z : Vec F) : dot v (y - z) = dot v y - dot v z := by simp [dot] ring private theorem dot_single (v : Vec F) (i : Fin 3) (a : F) : dot v (Pi.single i a) = v i * a := by fin_cases i <;> simp [dot] /-- The field-valued annihilator of a nonzero vector's perpendicular hyperplane is the line generated by that vector. -/ theorem annihilator_hyperplane_iff_mem_line {v z : Vec F} (hv : v ≠ 0) : (∀ y ∈ hyperplane v, dot z y = 0) ↔ z ∈ line v := by constructor · intro hz have hv' : ∃ i : Fin 3, v i ≠ 0 := by by_contra! h exact hv (funext h) obtain ⟨i, hi⟩ := hv' apply (mem_line_iff v z).mpr refine ⟨z i / v i, ?_⟩ ext j have hy : Pi.single j (1 : F) - (v j / v i) • Pi.single i (1 : F) ∈ hyperplane v := by rw [mem_hyperplane, dot_sub_right, dot_smul_right, dot_single, dot_single] simp [div_mul_cancel₀ _ hi] have hzero := hz _ hy rw [dot_sub_right, dot_smul_right, dot_single, dot_single, mul_one, mul_one, sub_eq_zero] at hzero change (z i / v i) * v j = z j rw [hzero] simp only [div_eq_mul_inv] ring · intro hz y hy obtain ⟨t, rfl⟩ := (mem_line_iff v z).mp hz rw [dot_smul_left, (mem_hyperplane v y).mp hy, mul_zero] variable [Finite F] [Algebra (ZMod 2) F] /-- Exact trace-annihilator identity for the field hyperplane. Trace nondegeneracy is provided by the proved finite-field trace pairing theorem. -/ theorem trace_annihilator_hyperplane_iff_mem_line {v z : Vec F} (hv : v ≠ 0) : (∀ y ∈ hyperplane v, traceBinary (dot z y) = 0) ↔ z ∈ line v := by rw [← annihilator_hyperplane_iff_mem_line hv] constructor · intro hz y hy apply (trace_mul_vanish_iff (dot z y)).mp intro t have ht := hz (t • y) ((hyperplane v).smul_mem t hy) simpa only [dot_smul_right] using ht · intro hz y hy rw [hz y hy, map_zero] /-- The same annihilator identity in set notation, using the actual trace. -/ theorem trace_annihilator_hyperplane (v : Vec F) (hv : v ≠ 0) : {z : Vec F | ∀ y ∈ hyperplane v, Algebra.trace (ZMod 2) F (dot z y) = 0} = (line v : Set (Vec F)) := by ext z exact trace_annihilator_hyperplane_iff_mem_line hv end UniqueGamesTheorem.Quadratic end end OAI