Skip to content

Commit e219401

Browse files
committed
proof(lean4/QuantumCNO): close all 4 sorries (4 → 0)
L75 quantum_state_eq_sym, L82 quantum_state_eq_trans - Original sigs `ψ =q= φ → φ =q= ψ` failed to parse under v4.16.0 (notation:50 + → precedence interaction). Parenthesised both sides. - Original proofs were `sorry` with comment "Requires complex arithmetic". The simplified `quantumStateEq` definition (line 59) actually discards the phase θ — equality is purely pointwise on amplitudes — so symmetry is `(h n).symm` and transitivity is `(h1 n).trans (h2 n)`. No complex arith required by the spec as written. L117 global_phase_is_cno (unitary conjunct) - `globalPhaseGate θ` is `fun ψ n => ψ n` which η-reduces to identity, so `innerProduct (globalPhaseGate θ ψ) (globalPhaseGate θ φ) = innerProduct ψ φ` is `rfl` directly. L180 quantum_cno_composition (identity conjunct, second leg) - Comment misdiagnosed as "Need to show U ψ =q= U (V ψ)". After `apply quantum_state_eq_trans`, transitivity routes via `V ψ`, so the second leg is just `hV_id ψ`. Inlined as a single `quantum_state_eq_trans` term to avoid the apply/sorry split.
1 parent a722440 commit e219401

1 file changed

Lines changed: 25 additions & 19 deletions

File tree

proofs/lean4/QuantumCNO.lean

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,24 @@ theorem quantum_state_eq_refl (ψ : QuantumState) : ψ =q= ψ := by
6767
intro n
6868
rfl
6969

70+
/-- Symmetry of the (simplified) quantum-state equality.
71+
72+
The simplified `quantumStateEq` definition discards `θ`; equality is
73+
purely pointwise on amplitudes. So `(-θ)` is just a placeholder phase
74+
and what we actually need is `(h n).symm` for each component. -/
7075
theorem quantum_state_eq_sym (ψ φ : QuantumState) :
71-
ψ =q= φ → φ =q= ψ := by
76+
(ψ =q= φ)(φ =q= ψ) := by
7277
intro ⟨θ, h⟩
73-
exists (-θ)
74-
intro n
75-
sorry -- Requires complex arithmetic
78+
exact ⟨-θ, fun n => (h n).symm⟩
79+
80+
/-- Transitivity of the (simplified) quantum-state equality.
7681
82+
With the placeholder phase, the transitive phase is just the sum and
83+
the pointwise equalities chain via `Eq.trans`. -/
7784
theorem quantum_state_eq_trans (ψ φ χ : QuantumState) :
78-
ψ =q= φ → φ =q= χ → ψ =q= χ := by
85+
(ψ =q= φ)(φ =q= χ)(ψ =q= χ) := by
7986
intro ⟨θ1, h1⟩ ⟨θ2, h2⟩
80-
exists1 + θ2)
81-
intro n
82-
sorry -- Requires complex arithmetic
87+
exact ⟨θ1 + θ2, fun n => (h1 n).trans (h2 n)⟩
8388

8489
/-! ## Quantum CNO Definition -/
8590

@@ -113,15 +118,15 @@ def globalPhaseGate (θ : ℝ) : QuantumGate :=
113118
theorem global_phase_is_cno (θ : ℝ) :
114119
isQuantumCNO (globalPhaseGate θ) := by
115120
unfold isQuantumCNO globalPhaseGate
116-
constructor
117-
· sorry -- Unitary
118-
constructor
121+
refine ⟨?_, ?_, trivial⟩
122+
· -- isUnitary: in the simplified spec `globalPhaseGate θ` η-reduces to
123+
-- the identity function `fun ψ => ψ`, so its image under
124+
-- `innerProduct` matches `innerProduct ψ φ` definitionally.
125+
intro ψ φ
126+
rfl
119127
· intro ψ
120128
unfold quantumStateEq
121-
exists θ
122-
intro n
123-
rfl
124-
· trivial
129+
exact ⟨θ, fun _ => rfl⟩
125130

126131
/-! ## Non-CNO Gates -/
127132

@@ -174,10 +179,11 @@ theorem quantum_cno_composition (U V : QuantumGate) :
174179
constructor
175180
· intro ψ
176181
unfold gateCompose
177-
-- U(V ψ) = U ψ (since V ψ = ψ) = ψ (since U ψ = ψ)
178-
apply quantum_state_eq_trans
179-
· exact hU_id (V ψ)
180-
· sorry -- Need to show U ψ =q= U (V ψ) when V ψ =q= ψ
182+
-- Goal: U (V ψ) =q= ψ. Chain U(Vψ)=q=Vψ (hU_id (V ψ)) with Vψ=q=ψ (hV_id ψ).
183+
-- The original `sorry` comment misdiagnosed the second goal: after
184+
-- `apply quantum_state_eq_trans`, transitivity routes via `V ψ`, so
185+
-- the second leg is just `hV_id ψ`, not a U-rewrite under =q=.
186+
exact quantum_state_eq_trans (U (V ψ)) (V ψ) ψ (hU_id (V ψ)) (hV_id ψ)
181187
· trivial
182188

183189
/-! ## Quantum Information Theory -/

0 commit comments

Comments
 (0)