Offline · exact source
Exact Lean source

PhysicalFlatGrassmannSpectral

formalization/Cloning/PhysicalFlatGrassmannSpectral.lean

Source hash: 7cf17e86be60bae5a624e6a1864e9a2653cbcae967ec34d3136399846e0d0b80

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.PCTPhysicalStateSpectrum
2import Mathlib.LinearAlgebra.Matrix.Rank
3import Mathlib.Logic.Equiv.Fin.Basic
4 
5/-! Every actual Hermitian idempotent of rank r is a unitary conjugate of
6the coordinate rank-r projector. The rank and projector assumptions are
7literal matrix properties, with no supplied diagonalizer. -/
8noncomputable section
9open scoped BigOperators Matrix MatrixOrder ComplexOrder
10namespace Cloning.PhysicalFlatGrassmann
11set_option backward.isDefEq.respectTransparency false
12set_option maxHeartbeats 1000000
13set_option linter.unusedSectionVars false
14 
15variable {r k : ℕ}
16 
17def coordinateProjector (r k : ℕ) : Matrix (Fin (r+k)) (Fin (r+k)) ℂ :=
18  Matrix.diagonal (fun i => if i.val < r then 1 else 0)
19 
20theorem eigenvalue_zero_or_one {P : Matrix (Fin (r+k)) (Fin (r+k)) ℂ}
21    (hP : P.IsHermitian) (hPP : P*P=P) (i : Fin (r+k)) :
22    hP.eigenvalues i = 0 ∨ hP.eigenvalues i = 1 := by
23  have h := congrArg (Unitary.conjStarAlgAut ℂ _ (star hP.eigenvectorUnitary)) hPP
24  rw [map_mul, hP.conjStarAlgAut_star_eigenvectorUnitary] at h
25  have hi := congrArg (fun M : Matrix (Fin (r+k)) (Fin (r+k)) ℂ => (M i i).re) h
26  simp only [Matrix.diagonal_mul_diagonal, Matrix.diagonal_apply_eq,
27    Function.comp_apply, RCLike.ofReal_eq_complex_ofReal, ← Complex.ofReal_mul,
28    Complex.ofReal_re] at hi
29  have hz : hP.eigenvalues i * (hP.eigenvalues i - 1) = 0 := by nlinarith
30  rcases mul_eq_zero.mp hz with hz | hz
31  · exact Or.inl hz
32  · exact Or.inr (by linarith)
33 
34/-- A permutation orders the actual zero/one eigenvalues into r ones and k
35zeros, with cardinalities derived from the literal matrix rank. -/
36theorem exists_projector_eigenvalue_order
37    {P : Matrix (Fin (r+k)) (Fin (r+k)) ℂ}
38    (hP : P.IsHermitian) (hPP : P*P=P) (hrank : P.rank = r) :
39    ∃ e : Fin (r+k) ≃ Fin (r+k), ∀ i,
40      hP.eigenvalues (e i) = if i.val < r then 1 else 0 := by
41  let p : Fin (r+k) → Prop := fun i => hP.eigenvalues i ≠ 0
42  have hc : Fintype.card {i // p i} = r := hP.rank_eq_card_non_zero_eigs.symm.trans hrank
43  have hz : Fintype.card {i // ¬p i} = k := by
44    rw [Fintype.card_subtype_compl, Fintype.card_fin, hc]
45    omega
46  let ep : Fin r ≃ {i // p i} := Fintype.equivOfCardEq (by simp only [Fintype.card_fin, hc])
47  let ez : Fin k ≃ {i // ¬p i} := Fintype.equivOfCardEq (by simp only [Fintype.card_fin, hz])
48  let e : Fin (r+k) ≃ Fin (r+k) := finSumFinEquiv.symm.trans
49    ((ep.sumCongr ez).trans (Equiv.sumCompl p))
50  refine ⟨e,?_⟩
51  intro i
52  refine Fin.addCases (fun j => ?_) (fun j => ?_) i
53  · have hp : hP.eigenvalues (ep j).val ≠ 0 := (ep j).property
54    have hv := (eigenvalue_zero_or_one hP hPP (ep j).val).resolve_left hp
55    simpa [e, Fin.isLt] using hv
56  · have hp : hP.eigenvalues (ez j).val = 0 := not_not.mp (ez j).property
57    simpa [e] using hp
58 
59def permutedEigenvectorUnitary {P : Matrix (Fin (r+k)) (Fin (r+k)) ℂ}
60    (hP : P.IsHermitian) (e : Fin (r+k) ≃ Fin (r+k)) :
61    unitary (Matrix (Fin (r+k)) (Fin (r+k)) ℂ) :=
62  ⟨fun i j => (hP.eigenvectorUnitary : Matrix (Fin (r+k)) (Fin (r+k)) ℂ) i (e j), by
63    apply Matrix.mem_unitaryGroup_iff'.mpr
64    ext i j
65    have h := congrArg (fun M : Matrix (Fin (r+k)) (Fin (r+k)) ℂ => M (e i) (e j))
66      (Unitary.star_mul_self_of_mem hP.eigenvectorUnitary.property)
67    simpa only [Matrix.star_eq_conjTranspose, Matrix.mul_apply, Matrix.conjTranspose_apply,
68      Matrix.one_apply, e.injective.eq_iff] using h⟩
69 
70theorem exists_unitary_projector
71    (P : Matrix (Fin (r+k)) (Fin (r+k)) ℂ)
72    (hP : P.IsHermitian) (hPP : P*P=P) (hrank : P.rank = r) :
73    ∃ U : unitary (Matrix (Fin (r+k)) (Fin (r+k)) ℂ),
74      P = (U : Matrix (Fin (r+k)) (Fin (r+k)) ℂ) * coordinateProjector r k * (U : Matrix (Fin (r+k)) (Fin (r+k)) ℂ)ᴴ := by
75  obtain ⟨e,he⟩ := exists_projector_eigenvalue_order hP hPP hrank
76  let U := permutedEigenvectorUnitary hP e
77  have hint : P * (U : Matrix (Fin (r+k)) (Fin (r+k)) ℂ) = (U : Matrix (Fin (r+k)) (Fin (r+k)) ℂ) * coordinateProjector r k := by
78    ext i j
79    rw [coordinateProjector, Matrix.mul_diagonal]
80    have h := congrFun (hP.mulVec_eigenvectorBasis (e j)) i
81    rw [he j] at h
82    split_ifs at h ⊢ <;>
83      simpa only [U, permutedEigenvectorUnitary, Matrix.mul_apply, Matrix.mulVec,
84        dotProduct, Matrix.IsHermitian.eigenvectorUnitary_apply, Pi.smul_apply,
85        RCLike.real_smul_eq_coe_smul (K:=ℂ), smul_eq_mul,
86        RCLike.ofReal_one, RCLike.ofReal_zero, one_mul, mul_one, zero_mul, mul_zero] using h
87  refine ⟨U,?_⟩
88  have hU : (U : Matrix (Fin (r+k)) (Fin (r+k)) ℂ) * (U : Matrix (Fin (r+k)) (Fin (r+k)) ℂ)ᴴ = 1 :=
89    Unitary.mul_star_self_of_mem U.property
90  rw [← hint, Matrix.mul_assoc, hU, Matrix.mul_one]
91 
92end Cloning.PhysicalFlatGrassmann