Repository navigation
Expand file tree
/
Copy pathSubmission.lean
More file actions
1905 lines (1901 loc) · 90.2 KB
/
Copy pathSubmission.lean
File metadata and controls
1905 lines (1901 loc) · 90.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import Mathlib.Analysis.Matrix.Spectrum
import Mathlib.Algebra.Order.Floor.Semifield
import Mathlib.LinearAlgebra.Eigenspace.Basic
import Mathlib.LinearAlgebra.Matrix.Rank
import Mathlib.Analysis.InnerProductSpace.GramMatrix
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
import Mathlib.Tactic.FieldSimp
import Mathlib.Data.ENat.Lattice
import ChallengeDeps
import Submission.Helpers
open EquiangularLinesFixedAngle
open Filter
open scoped RealInnerProductSpace
set_option autoImplicit false
namespace Submission
theorem spectral_order_attained (lambda : ℝ) (hfinite : spectralRadiusOrder lambda < ⊤) :
∃ (n : ℕ) (G : SimpleGraph (Fin n)),
(n : ℕ∞) = spectralRadiusOrder lambda ∧
(show ENNReal from by
classical
exact spectralRadius ℝ (G.adjMatrix ℝ)) = ENNReal.ofReal lambda := by
classical
obtain ⟨n, hn⟩ := ENat.exists_eq_iInf (fun n : ℕ =>
⨅ (_ : ∃ G : SimpleGraph (Fin n),
spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal lambda), (n : ℕ∞))
have hn' :
(⨅ (_ : ∃ G : SimpleGraph (Fin n),
spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal lambda), (n : ℕ∞)) =
spectralRadiusOrder lambda := hn
by_cases hG : ∃ G : SimpleGraph (Fin n),
spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal lambda
· have horder : (n : ℕ∞) = spectralRadiusOrder lambda := by
simpa only [iInf_pos hG] using hn'
obtain ⟨G, hG⟩ := hG
exact ⟨n, G, horder, hG⟩
· have htop : spectralRadiusOrder lambda = ⊤ := by
simpa only [iInf_neg hG] using hn'.symm
exact False.elim ((ne_of_lt hfinite) htop)
theorem configuration_dist_separated (α : ℝ) (hα : α ∈ Set.Ioo 0 1)
(d : ℕ) (E : EquiangularLines α d)
{x y : EuclideanSpace ℝ (Fin d)} (hx : x ∈ E.carrier) (hy : y ∈ E.carrier)
(hxy : x ≠ y) : 1 - α < dist x y := by
have hi : ⟪x, y⟫ ≤ α := by
calc
⟪x, y⟫ ≤ |⟪x, y⟫| := le_abs_self _
_ = α := E.angle hx hy hxy
have hs := norm_sub_sq_real x y
rw [E.norm x hx, E.norm y hy, ← dist_eq_norm] at hs
have hn := dist_nonneg (x := x) (y := y)
have hsq : (1 - α) ^ 2 < 2 * (1 - α) := by
have hp : 0 < (1 - α) * (1 + α) :=
mul_pos (sub_pos.mpr hα.2) (by linarith only [hα.1])
nlinarith only [hp]
apply (sq_lt_sq₀ (sub_nonneg.mpr hα.2.le) hn).mp
linarith only [hs, hi, hsq]
theorem configuration_cardinality_bounded :
∀ (α : ℝ), α ∈ Set.Ioo 0 1 → ∀ d : ℕ,
∃ B : ℕ, ∀ E : EquiangularLines α d, E.carrier.ncard ≤ B := by
classical
intro α hα d
obtain ⟨t, _, ht, hcover⟩ :=
(isCompact_sphere (0 : EuclideanSpace ℝ (Fin d)) 1).finite_cover_balls
(show 0 < (1 - α) / 2 by linarith [hα.2])
refine ⟨t.ncard, ?_⟩
intro E
have hball : ∀ x ∈ E.carrier, ∃ c ∈ t, dist x c < (1 - α) / 2 := by
intro x hx
have hs : x ∈ Metric.sphere (0 : EuclideanSpace ℝ (Fin d)) 1 := by
simpa only [Metric.mem_sphere, dist_zero_right] using E.norm x hx
rcases Set.mem_iUnion₂.mp (hcover hs) with ⟨c, hc, hxc⟩
exact ⟨c, hc, hxc⟩
let f : EuclideanSpace ℝ (Fin d) → EuclideanSpace ℝ (Fin d) := fun x =>
if hx : x ∈ E.carrier then (hball x hx).choose else 0
have hf : ∀ x ∈ E.carrier, f x ∈ t ∧ dist x (f x) < (1 - α) / 2 := by
intro x hx
dsimp only [f]
rw [dif_pos hx]
exact (hball x hx).choose_spec
apply Set.ncard_le_ncard_of_injOn f (fun x hx => (hf x hx).1) ?_ ht
intro x hx y hy hfxy
by_contra hxy
have hsep := configuration_dist_separated α hα d E hx hy hxy
have htri := dist_triangle x (f x) y
have hfx := (hf x hx).2
have hfy := (hf y hy).2
rw [← hfxy, dist_comm y (f x)] at hfy
linarith only [hsep, htri, hfx, hfy]
theorem configuration_cardinality_le_N :
∀ (α : ℝ), α ∈ Set.Ioo 0 1 →
∀ (d : ℕ) (E : EquiangularLinesFixedAngle.EquiangularLines α d),
E.carrier.ncard ≤ EquiangularLinesFixedAngle.N α d := by
intro α hα d E
obtain ⟨B, hB⟩ := configuration_cardinality_bounded α hα d
have hbounded : BddAbove (Set.range
(fun F : EquiangularLinesFixedAngle.EquiangularLines α d => F.carrier.ncard)) := by
refine ⟨B, ?_⟩
rintro _ ⟨F, rfl⟩
exact hB F
exact le_ciSup hbounded E
theorem euclidean_gram_rank_le {d n : ℕ}
(v : Fin n → EuclideanSpace ℝ (Fin d)) : (Matrix.gram ℝ v).rank ≤ d := by
classical
let b := EuclideanSpace.basisFun (Fin d) ℝ
let M : Matrix (Fin d) (Fin n) ℝ := Matrix.of (fun i j => b.repr (v j) i)
have hg : Matrix.gram ℝ v = M.conjTranspose * M :=
Matrix.gram_eq_conjTranspose_mul b v
calc
(Matrix.gram ℝ v).rank = (M.conjTranspose * M).rank := congrArg Matrix.rank hg
_ ≤ M.rank := Matrix.rank_mul_le_right _ _
_ ≤ d := by simpa only [Fintype.card_fin] using Matrix.rank_le_card_height M
theorem real_matrix_rank_smul_le {m n : ℕ} (a : ℝ)
(A : Matrix (Fin m) (Fin n) ℝ) : (a • A).rank ≤ A.rank := by
rw [Matrix.rank, Matrix.rank]
apply Submodule.finrank_mono
rintro x ⟨c, rfl⟩
refine ⟨a • c, ?_⟩
simp only [Matrix.mulVecLin_apply, Matrix.mulVec_smul, Matrix.smul_mulVec]
theorem upper_spectralRadius_relabel {ι κ : Type*} [Fintype ι] [Fintype κ]
[DecidableEq ι] [DecidableEq κ] (A : Matrix ι ι ℝ) (e : κ ≃ ι) :
spectralRadius ℝ (A.submatrix e e) = spectralRadius ℝ A := by
have hs : spectrum ℝ (A.submatrix e e) = spectrum ℝ A :=
AlgEquiv.spectrum_eq (Matrix.reindexAlgEquiv ℝ ℝ e.symm) A
simp only [spectralRadius_eq_of_unital, hs]
theorem upper_spectral_order_le {ι : Type*} [Fintype ι] [DecidableEq ι]
(G : SimpleGraph ι) [DecidableRel G.Adj] (lambda : ℝ)
(hG : spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal lambda) :
spectralRadiusOrder lambda ≤ (Fintype.card ι : ℕ∞) := by
classical
let e : Fin (Fintype.card ι) ≃ ι := (Fintype.equivFin ι).symm
let H := G.comap e
let : DecidableRel H.Adj := Classical.decRel H.Adj
have hA : H.adjMatrix ℝ = (G.adjMatrix ℝ).submatrix e e := by
ext i j
simp [H, SimpleGraph.adjMatrix_apply]
have hH : spectralRadius ℝ (H.adjMatrix ℝ) = ENNReal.ofReal lambda := by
rw [hA, upper_spectralRadius_relabel]
exact hG
unfold spectralRadiusOrder
exact iInf_le_of_le (Fintype.card ι) (iInf_le_of_le ⟨H, hH⟩ le_rfl)
theorem upper_eigenspace_add_rank {ι : Type*} [Fintype ι] [DecidableEq ι]
(A : Matrix ι ι ℝ) (lambda : ℝ) :
Module.finrank ℝ (Module.End.eigenspace A.mulVecLin lambda) +
(lambda • (1 : Matrix ι ι ℝ) - A).rank = Fintype.card ι := by
have hker : LinearMap.ker (lambda • (1 : Matrix ι ι ℝ) - A).mulVecLin =
Module.End.eigenspace A.mulVecLin lambda := by
ext x
rw [LinearMap.mem_ker, Module.End.mem_eigenspace_iff]
simp only [Matrix.mulVecLin_apply, Matrix.sub_mulVec, Matrix.smul_mulVec,
Matrix.one_mulVec, sub_eq_zero]
exact eq_comm
have h := LinearMap.finrank_range_add_finrank_ker
(lambda • (1 : Matrix ι ι ℝ) - A).mulVecLin
rw [hker, ← Matrix.rank, Module.finrank_fintype_fun_eq_card] at h
omega
theorem upper_eigenspace_relabel {ι κ : Type*} [Fintype ι] [Fintype κ]
[DecidableEq ι] [DecidableEq κ] (A : Matrix ι ι ℝ) (e : κ ≃ ι) (lambda : ℝ) :
Module.finrank ℝ (Module.End.eigenspace (A.submatrix e e).mulVecLin lambda) =
Module.finrank ℝ (Module.End.eigenspace A.mulVecLin lambda) := by
have h1 := upper_eigenspace_add_rank (A.submatrix e e) lambda
have h2 := upper_eigenspace_add_rank A lambda
have heq : lambda • (1 : Matrix κ κ ℝ) - A.submatrix e e =
(lambda • (1 : Matrix ι ι ℝ) - A).submatrix e e := by
ext i j
simp [Matrix.one_apply, e.injective.eq_iff]
rw [heq, Matrix.rank_submatrix, Fintype.card_congr e] at h1
omega
theorem upper_gram_psd_rank (α : ℝ) (hα : α ∈ Set.Ioo 0 1) (d n : ℕ)
(v : Fin n → EuclideanSpace ℝ (Fin d)) (A : Matrix (Fin n) (Fin n) ℝ)
(hgram : Matrix.gram ℝ v = (1 - α) • (1 : Matrix (Fin n) (Fin n) ℝ) +
α • Matrix.of (fun _ _ : Fin n => (1 : ℝ)) - (2 * α) • A) :
let P := ((1 - α) / (2 * α)) • (1 : Matrix (Fin n) (Fin n) ℝ) - A +
(1 / 2 : ℝ) • Matrix.of (fun _ _ : Fin n => (1 : ℝ))
P.PosSemidef ∧ P.rank ≤ d := by
have hα0 : α ≠ 0 := ne_of_gt hα.1
have heq : ((1 - α) / (2 * α)) • (1 : Matrix (Fin n) (Fin n) ℝ) - A +
(1 / 2 : ℝ) • Matrix.of (fun _ _ : Fin n => (1 : ℝ)) =
(1 / (2 * α)) • Matrix.gram ℝ v := by
rw [hgram]
ext i j
simp only [Matrix.add_apply, Matrix.sub_apply, Matrix.smul_apply, smul_eq_mul]
field_simp [hα0]
ring
dsimp only
rw [heq]
exact ⟨(Matrix.posSemidef_gram ℝ v).smul (by
have hp := hα.1
positivity),
(real_matrix_rank_smul_le _ _).trans (euclidean_gram_rank_le v)⟩
theorem upper_psd_eigenvalue_exception {ι : Type*} [Fintype ι] [DecidableEq ι]
[Nonempty ι] (A : Matrix ι ι ℝ) (hA : A.IsHermitian) (lambda : ℝ)
(hP : (lambda • (1 : Matrix ι ι ℝ) - A +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))).PosSemidef) :
∃ j : ι, ∀ i : ι, i ≠ j → hA.eigenvalues i ≤ lambda := by
classical
have hone (i : ι) : dotProduct (hA.eigenvectorBasis i).ofLp
(hA.eigenvectorBasis i).ofLp = 1 := by
have h := (orthonormal_iff_ite.mp hA.eigenvectorBasis.orthonormal) i i
simpa only [EuclideanSpace.inner_eq_star_dotProduct, star_trivial,
if_pos rfl, ite_true] using h
have hsum (i : ι) (hi : lambda < hA.eigenvalues i) :
(∑ k, (hA.eigenvectorBasis i).ofLp k) ≠ 0 := by
intro hz
have h := hP.dotProduct_mulVec_nonneg (hA.eigenvectorBasis i).ofLp
simp only [star_trivial] at h
rw [Helpers.component_rank_one_quadratic, hz, zero_pow (by decide : 2 ≠ 0),
mul_zero, add_zero, Matrix.sub_mulVec, Matrix.smul_mulVec, Matrix.one_mulVec,
dotProduct_sub, dotProduct_smul, hA.mulVec_eigenvectorBasis, dotProduct_smul,
hone, smul_eq_mul] at h
simp only [smul_eq_mul, mul_one] at h
linarith
by_cases hex : ∃ j, lambda < hA.eigenvalues j
· obtain ⟨j, hj⟩ := hex
refine ⟨j, ?_⟩
intro i hij
by_contra hi
have hi' : lambda < hA.eigenvalues i := lt_of_not_ge hi
let x := (hA.eigenvectorBasis j).ofLp
let y := (hA.eigenvectorBasis i).ofLp
let a := ∑ k, x k
let b := ∑ k, y k
let z := b • x - a • y
have hx : A.mulVec x = hA.eigenvalues j • x := hA.mulVec_eigenvectorBasis j
have hy : A.mulVec y = hA.eigenvalues i • y := hA.mulVec_eigenvectorBasis i
have hxy : dotProduct x y = 0 := by
have h := hA.eigenvectorBasis.orthonormal.inner_eq_zero hij.symm
simpa only [EuclideanSpace.inner_eq_star_dotProduct, star_trivial,
dotProduct_comm] using h
have hyx : dotProduct y x = 0 := by rw [dotProduct_comm, hxy]
have hzsum : ∑ k, z k = 0 := by
simp only [z, Pi.sub_apply, Pi.smul_apply, smul_eq_mul,
Finset.sum_sub_distrib, ← Finset.mul_sum]
change b * a - a * b = 0
ring
have hzn : dotProduct z z = b ^ 2 + a ^ 2 := by
simp only [z, sub_dotProduct, dotProduct_sub, smul_dotProduct,
dotProduct_smul, hxy, hyx, smul_eq_mul]
rw [hone j, hone i]
ring
have hzq : dotProduct z (A.mulVec z) =
b ^ 2 * hA.eigenvalues j + a ^ 2 * hA.eigenvalues i := by
simp only [z, Matrix.mulVec_sub, Matrix.mulVec_smul,
hx, hy, sub_dotProduct, dotProduct_sub, smul_dotProduct,
dotProduct_smul, smul_eq_mul, hxy, hyx]
rw [hone j, hone i]
ring
have h := hP.dotProduct_mulVec_nonneg z
simp only [star_trivial] at h
rw [Helpers.component_rank_one_quadratic, hzsum, zero_pow (by decide : 2 ≠ 0),
mul_zero, add_zero, Matrix.sub_mulVec, Matrix.smul_mulVec, Matrix.one_mulVec,
dotProduct_sub, dotProduct_smul, smul_eq_mul, hzn, hzq] at h
have h1 := mul_pos (sq_pos_of_ne_zero (hsum i hi')) (sub_pos.mpr hj)
have h2 := mul_nonneg (sq_nonneg a) (sub_nonneg.mpr hi'.le)
change 0 < b ^ 2 * (hA.eigenvalues j - lambda) at h1
nlinarith only [h, h1, h2]
· exact ⟨Classical.choice ‹Nonempty ι›, fun i _ => le_of_not_gt (fun hi => hex ⟨i, hi⟩)⟩
theorem upper_rank_one_submatrix {ι κ : Type*} [DecidableEq ι] [DecidableEq κ]
(A : Matrix ι ι ℝ) (lambda : ℝ) (e : κ → ι) (he : Function.Injective e) :
(lambda • (1 : Matrix ι ι ℝ) - A +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))).submatrix e e =
lambda • (1 : Matrix κ κ ℝ) - A.submatrix e e +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ)) := by
ext i j
simp [Matrix.one_apply, he.eq_iff]
theorem upper_uniform_connected_multiplicity (Δ : ℕ) (ε : ℝ) (hε : 0 < ε) :
∃ M : ℕ, ∀ {ι : Type} [Fintype ι] [DecidableEq ι]
(G : SimpleGraph ι) [DecidableRel G.Adj] (lambda : ℝ),
M ≤ Fintype.card ι → 0 < lambda → G.Connected →
(∀ i, ({j | G.Adj i j} : Set ι).ncard ≤ Δ) →
(lambda • (1 : Matrix ι ι ℝ) - G.adjMatrix ℝ +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))).PosSemidef →
(Module.finrank ℝ (Module.End.eigenspace (G.adjMatrix ℝ).mulVecLin lambda) : ℝ) ≤
ε * (Fintype.card ι : ℝ) := by
classical
obtain ⟨M, hM⟩ := Helpers.uniform_second_eigenvalue_multiplicity Δ ε hε
refine ⟨M, ?_⟩
intro ι _ _ G _ lambda hsize hlam hG hdegree hP
let e : Fin (Fintype.card ι) ≃ ι := (Fintype.equivFin ι).symm
let H := G.comap e
let : DecidableRel H.Adj := Classical.decRel H.Adj
have hA : H.adjMatrix ℝ = (G.adjMatrix ℝ).submatrix e e := by
ext i j
simp [H, SimpleGraph.adjMatrix_apply]
have hH : H.Connected := (SimpleGraph.Iso.comap e G).connected_iff.mpr hG
let : Nonempty (Fin (Fintype.card ι)) := hH.nonempty
have hdeg : ∀ i, ({j | H.Adj i j} : Set (Fin (Fintype.card ι))).ncard ≤ Δ := by
intro i
apply le_trans _ (hdegree (e i))
exact Set.ncard_le_ncard_of_injOn e (fun j hj => hj)
(fun _ _ _ _ he => e.injective he)
have hPH : (lambda • (1 : Matrix (Fin (Fintype.card ι)) (Fin (Fintype.card ι)) ℝ) -
H.adjMatrix ℝ + (1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))).PosSemidef := by
rw [hA, ← upper_rank_one_submatrix _ _ e e.injective]
exact hP.submatrix e
have hHerm : (H.adjMatrix ℝ).IsHermitian := by
change (H.adjMatrix ℝ).conjTranspose = H.adjMatrix ℝ
rw [Matrix.conjTranspose_eq_transpose_of_trivial, H.transpose_adjMatrix]
have hb := hM (Fintype.card ι) H lambda hsize hlam hH hdeg hHerm
(upper_psd_eigenvalue_exception _ hHerm lambda hPH)
rw [hA, upper_eigenspace_relabel] at hb
exact hb
noncomputable def upperComponentRadius {n : ℕ} (G : SimpleGraph (Fin n))
(C : G.ConnectedComponent) : ENNReal := by
classical
letI : Fintype C.supp := Fintype.ofFinite C.supp
letI : DecidableEq C.supp := Classical.decEq C.supp
letI : DecidableRel C.toSimpleGraph.Adj := Classical.decRel C.toSimpleGraph.Adj
exact spectralRadius ℝ (C.toSimpleGraph.adjMatrix ℝ)
theorem upper_graph_bound_cases (Δ : ℕ) (ε : ℝ) (hε : 0 < ε) :
∃ M : ℕ, ∀ (n d : ℕ) (G : SimpleGraph (Fin n))
(lambda : ℝ), 0 < lambda →
(∀ i, ({j | G.Adj i j} : Set (Fin n)).ncard ≤ Δ) →
let A : Matrix (Fin n) (Fin n) ℝ :=
(letI : DecidableRel G.Adj := Classical.decRel G.Adj; G.adjMatrix ℝ)
let P := lambda • (1 : Matrix (Fin n) (Fin n) ℝ) - A +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))
P.PosSemidef → P.rank ≤ d →
((¬ ∃ C, ENNReal.ofReal lambda < upperComponentRadius G C) ∧
P.rank = if ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard = 0 then n else
n + 1 - ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard) ∨
(n : ℝ) ≤ (d : ℝ) + 1 + M + ε * n := by
classical
obtain ⟨M, hM⟩ := upper_uniform_connected_multiplicity Δ ε hε
refine ⟨M, ?_⟩
intro n d G lambda hlam hdeg
let : DecidableRel G.Adj := Classical.decRel G.Adj
dsimp only
let P := lambda • (1 : Matrix (Fin n) (Fin n) ℝ) - G.adjMatrix ℝ +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))
intro hP hrank
let : Fintype G.ConnectedComponent := Fintype.ofFinite _
let (C : G.ConnectedComponent) : Fintype C.supp := Fintype.ofFinite _
let (C : G.ConnectedComponent) : DecidableEq C.supp := Classical.decEq _
let (C : G.ConnectedComponent) : DecidableRel C.toSimpleGraph.Adj := Classical.decRel _
have hc := Helpers.component_rank_one_accounting n G lambda hlam hP
change
((¬ ∃ C, ENNReal.ofReal lambda < upperComponentRadius G C) →
P.rank = if ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard = 0 then n else
n + 1 - ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard) ∧
((∃ C, ENNReal.ofReal lambda < upperComponentRadius G C) →
∃ C, ENNReal.ofReal lambda < upperComponentRadius G C ∧
(∀ D, D ≠ C → upperComponentRadius G D < ENNReal.ofReal lambda) ∧
Module.finrank ℝ (Module.End.eigenspace (G.adjMatrix ℝ).mulVecLin lambda) =
Module.finrank ℝ (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda) ∧
n ≤ P.rank + 1 + Module.finrank ℝ (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda)) at hc
by_cases hex : ∃ C, ENNReal.ofReal lambda < upperComponentRadius G C
· right
obtain ⟨C, _, _, _, hn⟩ := hc.2 hex
have hcard : Nat.card C = Nat.card C.supp := Nat.card_congr
{ toFun := fun i => ⟨i.val, i.property⟩
invFun := fun i => ⟨i.val, i.property⟩
left_inv := fun _ => rfl
right_inv := fun _ => rfl }
have hCn : Fintype.card C.supp ≤ n := by
simpa only [Fintype.card_fin] using
Fintype.card_le_of_injective (Subtype.val : C.supp → Fin n) Subtype.val_injective
have hm : (Module.finrank ℝ (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda) : ℝ) ≤ M + ε * n := by
by_cases hsize : M ≤ Fintype.card C.supp
· have hsub : (G.adjMatrix ℝ).submatrix (Subtype.val : C.supp → Fin n)
Subtype.val = C.toSimpleGraph.adjMatrix ℝ := by
ext i j
change (G.adjMatrix ℝ) i.val j.val = (G.induce C.supp).adjMatrix ℝ i j
simp only [SimpleGraph.adjMatrix_apply, SimpleGraph.induce_adj]
have hPC : (lambda • (1 : Matrix C.supp C.supp ℝ) -
C.toSimpleGraph.adjMatrix ℝ +
(1 / 2 : ℝ) • Matrix.of (fun _ _ => (1 : ℝ))).PosSemidef := by
have hh := hP.submatrix (Subtype.val : C.supp → Fin n)
rw [upper_rank_one_submatrix _ _ _ Subtype.val_injective] at hh
convert hh using 1
ext i j
simp only [Matrix.submatrix_apply, Matrix.add_apply, Matrix.sub_apply,
Matrix.smul_apply, smul_eq_mul]
congr 2
have hh := hM C.toSimpleGraph lambda hsize hlam C.connected_toSimpleGraph
(Helpers.induced_graph_degree_bound G C.supp Δ hdeg) hPC
simp only [← Nat.card_eq_fintype_card] at hh
rw [hcard] at hh
have hcast : (Fintype.card C.supp : ℝ) ≤ n := by exact_mod_cast hCn
simp only [← Nat.card_eq_fintype_card] at hcast
have hmul := mul_le_mul_of_nonneg_left hcast hε.le
have hMn : (0 : ℝ) ≤ M := Nat.cast_nonneg _
linarith
· have hsmall : Module.finrank ℝ (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda) ≤ M := by
have hh := Submodule.finrank_le (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda)
rw [Module.finrank_fintype_fun_eq_card] at hh
simp only [← Nat.card_eq_fintype_card] at hh hsize
rw [hcard] at hh
omega
have hh : (Module.finrank ℝ (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda) : ℝ) ≤ M := by
exact_mod_cast hsmall
have hprod : 0 ≤ ε * (n : ℝ) := mul_nonneg hε.le (Nat.cast_nonneg _)
linarith
have hn' : (n : ℝ) ≤ (d : ℝ) + 1 + Module.finrank ℝ (Module.End.eigenspace
(C.toSimpleGraph.adjMatrix ℝ).mulVecLin lambda) := by
exact_mod_cast hn.trans (Nat.add_le_add_right (Nat.add_le_add_right hrank 1) _)
linarith
· exact Or.inl ⟨hex, hc.1 hex⟩
theorem upper_critical_count_mul_le (n : ℕ) (G : SimpleGraph (Fin n)) (lambda : ℝ)
(q : ℕ) (hq : (q : ℕ∞) ≤ spectralRadiusOrder lambda) :
q * ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard ≤ n := by
classical
let : Fintype G.ConnectedComponent := Fintype.ofFinite _
let (C : G.ConnectedComponent) : Fintype C.supp := Fintype.ofFinite _
let (C : G.ConnectedComponent) : DecidableEq C.supp := Classical.decEq _
let (C : G.ConnectedComponent) : DecidableRel C.toSimpleGraph.Adj := Classical.decRel _
let S := Finset.univ.filter (fun C => upperComponentRadius G C = ENNReal.ofReal lambda)
have ht : ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard = S.card := by
simp only [Set.ncard_eq_toFinset_card', Set.toFinset_ofPred, S]
have hsize (C : G.ConnectedComponent) (hC : C ∈ S) : q ≤ Fintype.card C.supp := by
have hr : spectralRadius ℝ (C.toSimpleGraph.adjMatrix ℝ) = ENNReal.ofReal lambda := by
exact (Finset.mem_filter.mp hC).2
have hh := hq.trans (upper_spectral_order_le C.toSimpleGraph lambda hr)
have hcard : Fintype.card C = Fintype.card C.supp := Fintype.card_congr
{ toFun := fun i => ⟨i.val, i.property⟩
invFun := fun i => ⟨i.val, i.property⟩
left_inv := fun _ => rfl
right_inv := fun _ => rfl }
rw [hcard] at hh
exact_mod_cast hh
have htotal : (∑ C : G.ConnectedComponent, Fintype.card C.supp) = n := by
have hh := Helpers.component_sum_by_components G (fun _ => (1 : ℝ))
simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one,
Fintype.card_fin] at hh
exact_mod_cast hh
rw [ht]
calc
q * S.card = ∑ C ∈ S, q := by simp [mul_comm]
_ ≤ ∑ C ∈ S, Fintype.card C.supp := Finset.sum_le_sum hsize
_ ≤ ∑ C : G.ConnectedComponent, Fintype.card C.supp :=
Finset.sum_le_sum_of_subset (Finset.filter_subset _ _)
_ = n := htotal
theorem upper_no_critical_of_infinite (n : ℕ) (G : SimpleGraph (Fin n)) (lambda : ℝ)
(htop : spectralRadiusOrder lambda = ⊤) :
({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent).ncard = 0 := by
classical
have hempty : ({C | upperComponentRadius G C = ENNReal.ofReal lambda} :
Set G.ConnectedComponent) = ∅ := by
apply Set.eq_empty_iff_forall_notMem.mpr
intro C hC
let : Fintype C.supp := Fintype.ofFinite _
let : DecidableEq C.supp := Classical.decEq _
let : DecidableRel C.toSimpleGraph.Adj := Classical.decRel _
have hr : spectralRadius ℝ (C.toSimpleGraph.adjMatrix ℝ) = ENNReal.ofReal lambda := hC
have hh := upper_spectral_order_le C.toSimpleGraph lambda hr
rw [htop] at hh
exact (not_le_of_gt (ENat.natCast_lt_top (Fintype.card C))) hh
rw [hempty, Set.ncard_empty]
theorem upper_rank_count_floor (n d q t r : ℕ) (hq : 2 ≤ q) (hd : q ≤ d)
(ht : q * t ≤ n) (hr : r = if t = 0 then n else n + 1 - t) (hrd : r ≤ d) :
n ≤ ⌊(q * (d - 1) : ℝ) / (q - 1 : ℝ)⌋₊ := by
have hqR : (2 : ℝ) ≤ q := by exact_mod_cast hq
have hdR : (q : ℝ) ≤ d := by exact_mod_cast hd
have hden : 0 < (q : ℝ) - 1 := by linarith
apply Nat.le_floor
apply (le_div_iff₀ hden).mpr
by_cases hz : t = 0
· rw [hz, if_pos rfl] at hr
have hnd : n ≤ d := by omega
have hnR : (n : ℝ) ≤ d := by exact_mod_cast hnd
nlinarith
· rw [if_neg hz] at hr
have htn : t ≤ n := by nlinarith
have hn : n + 1 ≤ d + t := by omega
have hnR : (n : ℝ) + 1 ≤ (d : ℝ) + t := by exact_mod_cast hn
have htR : (q : ℝ) * t ≤ (n : ℝ) := by exact_mod_cast ht
nlinarith
theorem upper_N_le_of_unit_bound (α : ℝ) (d B : ℕ)
(hB : ∀ (n : ℕ) (v : Fin n → EuclideanSpace ℝ (Fin d)),
(∀ i, ‖v i‖ = 1) →
(∀ i j, i ≠ j → |inner ℝ (v i) (v j)| = α) → n ≤ B) : N α d ≤ B := by
classical
apply ciSup_le'
intro E
by_cases hz : E.carrier.ncard = 0
· rw [hz]
exact Nat.zero_le _
· have hfin := Set.finite_of_ncard_ne_zero hz
let : Fintype E.carrier := hfin.fintype
let e : Fin (Fintype.card E.carrier) ≃ E.carrier := (Fintype.equivFin _).symm
have hh := hB (Fintype.card E.carrier) (fun i => (e i).val)
(fun i => E.norm (e i).val (e i).property)
(fun i j hij => E.angle (e i).property (e j).property (by
intro he
exact hij (e.injective (Subtype.ext he))))
rwa [Set.fintypeCard_eq_ncard] at hh
theorem upper_unit_vector_bound_cases (α : ℝ) (hα : α ∈ Set.Ioo 0 1)
(ε : ℝ) (hε : 0 < ε) :
∃ M : ℕ, ∀ (d n : ℕ) (v : Fin n → EuclideanSpace ℝ (Fin d)),
(∀ i, ‖v i‖ = 1) →
(∀ i j, i ≠ j → |inner ℝ (v i) (v j)| = α) →
(∃ G : SimpleGraph (Fin n),
(if ({C | upperComponentRadius G C = ENNReal.ofReal ((1 - α) / (2 * α))} :
Set G.ConnectedComponent).ncard = 0 then n else
n + 1 - ({C | upperComponentRadius G C = ENNReal.ofReal ((1 - α) / (2 * α))} :
Set G.ConnectedComponent).ncard) ≤ d) ∨
(n : ℝ) ≤ (d : ℝ) + 1 + M + ε * n := by
classical
obtain ⟨Δ, hΔ⟩ := Helpers.uniform_switching_with_gram_data α hα
obtain ⟨M, hM⟩ := upper_graph_bound_cases Δ ε hε
refine ⟨M, ?_⟩
intro d n v hnorm hangle
obtain ⟨σ, G, _, _, _, _, _, _, hdegree, hgram⟩ := hΔ d n v hnorm hangle
let : DecidableRel G.Adj := Classical.decRel G.Adj
have hP := upper_gram_psd_rank α hα d n (fun i => σ i • v i) (G.adjMatrix ℝ) hgram
have hlam : 0 < (1 - α) / (2 * α) :=
div_pos (sub_pos.mpr hα.2) (mul_pos (by norm_num) hα.1)
rcases hM n d G _ hlam hdegree hP.1 hP.2 with hc | hb
· left
refine ⟨G, ?_⟩
rw [← hc.2]
exact hP.2
· exact Or.inr hb
theorem upper_absorb_finite (n d q M : ℕ) (hq : 2 ≤ q)
(hd : 2 * q * (M + 2) ≤ d)
(hb : (n : ℝ) ≤ (d : ℝ) + 1 + M + (1 / (2 * (q : ℝ))) * n) :
n ≤ ⌊(q * (d - 1) : ℝ) / (q - 1 : ℝ)⌋₊ := by
have hqR : (2 : ℝ) ≤ q := by exact_mod_cast hq
have hqpos : 0 < (q : ℝ) := by linarith
have hM : (0 : ℝ) ≤ M := Nat.cast_nonneg _
have hdR : 2 * (q : ℝ) * ((M : ℝ) + 2) ≤ d := by exact_mod_cast hd
have hcancel : (2 * (q : ℝ)) * ((1 / (2 * (q : ℝ))) * n) = n := by
field_simp
<;> ring
have hbase : (n : ℝ) * (2 * (q : ℝ) - 1) ≤
2 * (q : ℝ) * ((d : ℝ) + (M : ℝ) + 1) := by
have hh := mul_le_mul_of_nonneg_left hb (show 0 ≤ 2 * (q : ℝ) by positivity)
simp only [mul_add, hcancel] at hh
nlinarith only [hh]
have hthreshold := mul_le_mul_of_nonneg_left hdR hqpos.le
have hcompare : 2 * (q : ℝ) * ((d : ℝ) + (M : ℝ) + 1) * ((q : ℝ) - 1) ≤
(q : ℝ) * ((d : ℝ) - 1) * (2 * (q : ℝ) - 1) := by
nlinarith [mul_nonneg hqpos.le hM]
apply Nat.le_floor
apply (le_div_iff₀ (show 0 < (q : ℝ) - 1 by linarith)).mpr
apply (mul_le_mul_iff_left₀ (show 0 < 2 * (q : ℝ) - 1 by linarith)).mp
calc
(n : ℝ) * ((q : ℝ) - 1) * (2 * (q : ℝ) - 1) =
((n : ℝ) * (2 * (q : ℝ) - 1)) * ((q : ℝ) - 1) := by ring
_ ≤ (2 * (q : ℝ) * ((d : ℝ) + (M : ℝ) + 1)) * ((q : ℝ) - 1) :=
mul_le_mul_of_nonneg_right hbase (by linarith)
_ ≤ (q : ℝ) * ((d : ℝ) - 1) * (2 * (q : ℝ) - 1) := hcompare
theorem upper_absorb_infinite (n d M : ℕ) (ε : ℝ) (hε : 0 < ε)
(hd : 2 * ((M : ℝ) + 1) / ε ≤ (d : ℝ))
(hb : (n : ℝ) ≤ (d : ℝ) + 1 + M + (ε / (2 * (1 + ε))) * n) :
(n : ℝ) ≤ (1 + ε) * d := by
let δ := ε / (2 * (1 + ε))
have hden : 0 < 2 * (1 + ε) := by positivity
have hδ : δ < 1 := by
apply (div_lt_one hden).mpr
linarith
have hcoef : (1 - δ) * (1 + ε) = 1 + ε / 2 := by
dsimp [δ]
field_simp
<;> ring
have hconst : (M : ℝ) + 1 ≤ ε * (d : ℝ) / 2 := by
have hh := (div_le_iff₀ hε).mp hd
linarith
apply (mul_le_mul_iff_right₀ (sub_pos.mpr hδ)).mp
calc
(1 - δ) * (n : ℝ) ≤ (d : ℝ) + 1 + M := by
change (n : ℝ) ≤ (d : ℝ) + 1 + M + δ * n at hb
linarith
_ ≤ (1 + ε / 2) * (d : ℝ) := by nlinarith only [hconst]
_ = (1 - δ) * ((1 + ε) * (d : ℝ)) := by rw [← mul_assoc, hcoef]
theorem lower_gram_configuration (α : ℝ) (hα : α ∈ Set.Ioo 0 1)
(n d : ℕ) (M : Matrix (Fin n) (Fin n) ℝ) (hM : M.PosSemidef)
(hrank : M.rank ≤ d) (hdiag : ∀ i, M i i = 1)
(hoff : ∀ i j, i ≠ j → |M i j| = α) : n ≤ N α d := by
classical
obtain ⟨v, hv⟩ := Helpers.positive_semidefinite_gram_realization n d M hM hrank
have hinner : ∀ i j, ⟪v i, v j⟫ = M i j := by
intro i j
exact congrFun (congrFun hv i) j
have hnorm : ∀ i, ‖v i‖ = 1 := by
intro i
have h := hinner i i
rw [hdiag, inner_self_eq_norm_sq_to_K] at h
change ‖v i‖ ^ 2 = 1 at h
nlinarith [norm_nonneg (v i)]
have hinj : Function.Injective v := by
intro i j hij
by_contra hne
have h := hoff i j hne
rw [← hinner, hij, inner_self_eq_norm_sq_to_K, hnorm] at h
norm_num at h
exact (ne_of_lt hα.2) h.symm
let E : EquiangularLines α d :=
{ carrier := Set.range v
norm := by rintro x ⟨i, rfl⟩; exact hnorm i
angle := by
rintro x ⟨i, rfl⟩ y ⟨j, rfl⟩ hxy
rw [hinner]
exact hoff i j (fun hij => hxy (congrArg v hij)) }
have hc : E.carrier.ncard = n := by
exact (Set.ncard_range_of_injective hinj).trans (by simp)
rw [← hc]
exact configuration_cardinality_le_N α hα d E
theorem lower_all_ones_posSemidef {ι : Type*} [Fintype ι] :
(Matrix.of (fun _ _ : ι => (1 : ℝ))).PosSemidef := by
classical
simpa [Matrix.vecMulVec] using
Matrix.posSemidef_vecMulVec_self_star (fun _ : ι => (1 : ℝ))
theorem configuration_dimension_lower_bound (α : ℝ) (hα : α ∈ Set.Ioo 0 1)
(d : ℕ) : d ≤ N α d := by
classical
let M : Matrix (Fin d) (Fin d) ℝ :=
(1 - α) • 1 + α • Matrix.of (fun _ _ => (1 : ℝ))
apply lower_gram_configuration α hα d d M
· exact (Matrix.PosSemidef.one.smul (sub_nonneg.mpr hα.2.le)).add
(lower_all_ones_posSemidef.smul hα.1.le)
· simpa using Matrix.rank_le_card_height M
· intro i
simp [M]
· intro i j hij
simp [M, Matrix.one_apply, hij, abs_of_pos hα.1]
theorem lower_perron_abs_quadratic_bound {n : ℕ} (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (x : Fin n → ℝ) :
|dotProduct x ((G.adjMatrix ℝ).mulVec x)| ≤
dotProduct (fun i => |x i|) ((G.adjMatrix ℝ).mulVec (fun i => |x i|)) := by
classical
calc
|dotProduct x ((G.adjMatrix ℝ).mulVec x)| =
|∑ i, ∑ j, x i * (G.adjMatrix ℝ i j * x j)| := by
simp only [dotProduct, Matrix.mulVec, Finset.mul_sum]
_ ≤ ∑ i, ∑ j, |x i * (G.adjMatrix ℝ i j * x j)| := by
apply (Finset.abs_sum_le_sum_abs _ _).trans
exact Finset.sum_le_sum (fun i _ => Finset.abs_sum_le_sum_abs _ _)
_ = dotProduct (fun i => |x i|)
((G.adjMatrix ℝ).mulVec (fun i => |x i|)) := by
simp only [dotProduct, Matrix.mulVec, Finset.mul_sum]
apply Finset.sum_congr rfl
intro i _
apply Finset.sum_congr rfl
intro j _
by_cases h : G.Adj i j <;> simp [G.adjMatrix_apply, h, abs_mul]
theorem lower_perron_nonnegative_top_eigenvector {n : ℕ} (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] [Nonempty (Fin n)] :
∃ (rho : ℝ) (p : Fin n → ℝ), 0 ≤ rho ∧ (∀ i, 0 ≤ p i) ∧ p ≠ 0 ∧
(G.adjMatrix ℝ).mulVec p = rho • p ∧
(∀ x : Fin n → ℝ,
dotProduct x ((G.adjMatrix ℝ).mulVec x) ≤ rho * dotProduct x x) := by
classical
let A := G.adjMatrix ℝ
have hA : A.IsHermitian := by
ext i j
simp [A, Matrix.conjTranspose_apply, G.adj_comm]
let T := (Matrix.isSymmetric_toEuclideanLin_iff.mpr hA).toSelfAdjoint
have hT : ∀ x : EuclideanSpace ℝ (Fin n),
T.val.reApplyInnerSelf x = dotProduct x.ofLp (A.mulVec x.ofLp) := by
intro x
rw [ContinuousLinearMap.reApplyInnerSelf_apply]
have heq : T.val x = Matrix.toEuclideanLin A x := by
exact congrArg (fun f : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin n) => f x)
(Matrix.isSymmetric_toEuclideanLin_iff.mpr hA).coe_toSelfAdjoint
rw [heq, EuclideanSpace.inner_eq_star_dotProduct]
simp only [Matrix.toEuclideanLin, Matrix.toLpLin_apply, WithLp.ofLp_toLp,
star_trivial, RCLike.re_to_real]
let i : Fin n := Classical.choice inferInstance
let u : EuclideanSpace ℝ (Fin n) := EuclideanSpace.basisFun (Fin n) ℝ i
have hu : ‖u‖ = 1 := (EuclideanSpace.basisFun (Fin n) ℝ).norm_eq_one i
obtain ⟨q, hq, hmax⟩ := (isCompact_sphere (0 : EuclideanSpace ℝ (Fin n)) 1).exists_isMaxOn
⟨u, by simpa using hu⟩ T.val.reApplyInnerSelf_continuous.continuousOn
have hqn : ‖q‖ = 1 := by simpa using hq
let p : EuclideanSpace ℝ (Fin n) := WithLp.toLp 2 (fun i => |q i|)
have hpn : ‖p‖ = 1 := by
rw [EuclideanSpace.norm_eq] at hqn ⊢
simpa only [p, WithLp.ofLp_toLp, Real.norm_eq_abs, abs_abs] using hqn
have hpq : T.val.reApplyInnerSelf q ≤ T.val.reApplyInnerSelf p := by
rw [hT, hT]
exact (le_abs_self _).trans (lower_perron_abs_quadratic_bound G q.ofLp)
have hpmax : IsMaxOn T.val.reApplyInnerSelf (Metric.sphere 0 1) p := by
intro x hx
exact (hmax hx).trans hpq
let rho := T.val.reApplyInnerSelf p
have hp0 : p ≠ 0 := by
intro h
have := hpn
rw [h, norm_zero] at this
exact zero_ne_one this
have heig : A.mulVec p.ofLp = rho • p.ofLp := by
have h := T.prop.eq_smul_self_of_isLocalExtrOn
(Or.inr (show IsMaxOn T.val.reApplyInnerSelf (Metric.sphere 0 ‖p‖) p by
simpa only [hpn] using hpmax).localize)
have heq : T.val p = Matrix.toEuclideanLin A p :=
congrArg (fun f : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin n) => f p)
(Matrix.isSymmetric_toEuclideanLin_iff.mpr hA).coe_toSelfAdjoint
rw [heq] at h
have h' := congrArg (WithLp.ofLp) h
simpa only [Matrix.toEuclideanLin, Matrix.toLpLin_apply, WithLp.ofLp_toLp,
WithLp.ofLp_smul, ContinuousLinearMap.rayleighQuotient, hpn, one_pow, div_one,
RCLike.ofReal_real_eq_id, id_eq, rho] using h'
have hrho : 0 ≤ rho := by
dsimp only [rho]
rw [hT]
change 0 ≤ ∑ i, |q i| * ∑ j, A i j * |q j|
apply Finset.sum_nonneg
intro i _
apply mul_nonneg (abs_nonneg _)
apply Finset.sum_nonneg
intro j _
apply mul_nonneg _ (abs_nonneg _)
simp only [A, G.adjMatrix_apply]
split_ifs <;> positivity
refine ⟨rho, p.ofLp, hrho, fun i => abs_nonneg _, ?_, heig, ?_⟩
· exact fun h => hp0 ((WithLp.ofLp_eq_zero _).mp h)
· intro x
let z : EuclideanSpace ℝ (Fin n) := WithLp.toLp 2 x
by_cases hz : z = 0
· have hx : x = 0 := by exact congrArg WithLp.ofLp hz
simp [hx, dotProduct]
· have hn : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr hz
have hyn : ‖‖z‖⁻¹ • z‖ = 1 := by
rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg (norm_nonneg z), inv_mul_cancel₀ hn]
have hy := hpmax (show ‖z‖⁻¹ • z ∈ Metric.sphere 0 1 by simpa using hyn)
change T.val.reApplyInnerSelf (‖z‖⁻¹ • z) ≤ T.val.reApplyInnerSelf p at hy
rw [ContinuousLinearMap.reApplyInnerSelf_smul] at hy
simp only [Real.norm_eq_abs, abs_inv, abs_of_nonneg (norm_nonneg z)] at hy
have hmul := mul_le_mul_of_nonneg_left hy (sq_nonneg ‖z‖)
have hcancel : ‖z‖ ^ 2 * (‖z‖⁻¹ ^ 2 * T.val.reApplyInnerSelf z) = T.val.reApplyInnerSelf z := by
field_simp
rw [hcancel, hT] at hmul
have hnorm : ‖z‖ ^ 2 = dotProduct x x := by
rw [EuclideanSpace.real_norm_sq_eq]
simp only [z, WithLp.ofLp_toLp, dotProduct, pow_two]
simpa only [z, WithLp.ofLp_toLp, hnorm, rho, mul_comm] using hmul
theorem lower_perron_spectralRadius_eq {n : ℕ} (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (rho : ℝ) (hrho : 0 ≤ rho) (p : Fin n → ℝ)
(hp0 : p ≠ 0) (heig : (G.adjMatrix ℝ).mulVec p = rho • p)
(hbound : ∀ x : Fin n → ℝ,
dotProduct x ((G.adjMatrix ℝ).mulVec x) ≤ rho * dotProduct x x) :
spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal rho := by
classical
let A := G.adjMatrix ℝ
have hA : A.IsHermitian := by
ext i j
simp [A, Matrix.conjTranspose_apply, G.adj_comm]
have heigs : ∀ i, |hA.eigenvalues i| ≤ rho := by
intro i
let q := hA.eigenvectorBasis i
have hnorm : dotProduct (fun j => |q j|) (fun j => |q j|) = 1 := by
calc
dotProduct (fun j => |q j|) (fun j => |q j|) = ∑ j, (q j) ^ 2 := by
simp only [dotProduct, ← pow_two, sq_abs]
_ = ‖q‖ ^ 2 := (EuclideanSpace.real_norm_sq_eq q).symm
_ = 1 := by rw [hA.eigenvectorBasis.norm_eq_one]; norm_num
have hb := (lower_perron_abs_quadratic_bound G q.ofLp).trans (hbound (fun j => |q j|))
rw [hnorm, mul_one] at hb
simpa only [Matrix.IsHermitian.eigenvalues_eq, star_trivial, RCLike.re_to_real, q] using hb
have hpv : Module.End.HasEigenvector (Matrix.toEuclideanLin A) rho (WithLp.toLp 2 p) := by
constructor
· rw [Module.End.mem_eigenspace_iff]
change WithLp.toLp 2 (A.mulVec p) = rho • WithLp.toLp 2 p
rw [heig, WithLp.toLp_smul]
· intro h
exact hp0 (congrArg WithLp.ofLp h)
have hmem : rho ∈ spectrum ℝ A := by
simpa only [Matrix.toEuclideanLin, Matrix.spectrum_toLpLin] using
(Module.End.hasEigenvalue_of_hasEigenvector hpv).mem_spectrum
apply le_antisymm
· rw [spectralRadius_eq_of_unital]
refine iSup₂_le fun t ht => ?_
change t ∈ spectrum ℝ A at ht
rw [hA.spectrum_real_eq_range_eigenvalues] at ht
obtain ⟨i, rfl⟩ := ht
have hnorm : ‖hA.eigenvalues i‖ ≤ rho := by
simpa only [Real.norm_eq_abs] using heigs i
calc
(↑‖hA.eigenvalues i‖₊ : ENNReal) = ENNReal.ofReal ‖hA.eigenvalues i‖ :=
ENNReal.coe_nnreal_eq ‖hA.eigenvalues i‖₊
_ ≤ ENNReal.ofReal rho := ENNReal.ofReal_le_ofReal hnorm
· calc
ENNReal.ofReal rho = (↑‖rho‖₊ : ENNReal) := by
calc
ENNReal.ofReal rho = ENNReal.ofReal ‖rho‖ := by rw [Real.norm_of_nonneg hrho]
_ = (↑‖rho‖₊ : ENNReal) := (ENNReal.coe_nnreal_eq ‖rho‖₊).symm
_ ≤ spectralRadius ℝ A := by
rw [spectralRadius_eq_of_unital]
exact le_iSup_of_le rho (le_iSup_of_le hmem le_rfl)
theorem lower_graph_order_ge_two (lambda : ℝ) (hlambda : 0 < lambda)
(n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(hradius : spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal lambda) : 2 ≤ n := by
classical
by_contra hn
have hsmall : n ≤ 1 := by omega
letI : Subsingleton (Fin n) := Fin.subsingleton_iff_le_one.mpr hsmall
have hzero : G.adjMatrix ℝ = 0 := by
ext i j
have hij : i = j := Subsingleton.elim _ _
subst j
simp
rw [hzero, spectrum.spectralRadius_zero] at hradius
exact (ne_of_gt (ENNReal.ofReal_pos.mpr hlambda)) hradius.symm
theorem lower_graph_shift_psd_rank (lambda : ℝ) (hlambda : 0 < lambda)
(n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(hradius : spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal lambda) :
(lambda • (1 : Matrix (Fin n) (Fin n) ℝ) - G.adjMatrix ℝ).PosSemidef ∧
(lambda • (1 : Matrix (Fin n) (Fin n) ℝ) - G.adjMatrix ℝ).rank ≤ n - 1 := by
classical
have hn := lower_graph_order_ge_two lambda hlambda n G hradius
letI : Nonempty (Fin n) := ⟨⟨0, by omega⟩⟩
obtain ⟨rho, p, hrho, _, hp0, heig, hbound⟩ := lower_perron_nonnegative_top_eigenvector G
have hr := lower_perron_spectralRadius_eq G rho hrho p hp0 heig hbound
have heq : rho = lambda := by
have h := congrArg ENNReal.toReal (hr.symm.trans hradius)
simpa only [ENNReal.toReal_ofReal hrho, ENNReal.toReal_ofReal hlambda.le] using h
subst rho
let B : Matrix (Fin n) (Fin n) ℝ := lambda • 1 - G.adjMatrix ℝ
have hA : (G.adjMatrix ℝ).IsHermitian := by
ext i j
simp [Matrix.conjTranspose_apply, G.adj_comm]
have hB : B.PosSemidef := by
apply Matrix.PosSemidef.of_dotProduct_mulVec_nonneg
((Matrix.isHermitian_one.smul (show IsSelfAdjoint lambda from rfl)).sub hA)
intro x
simp only [B, star_trivial, Matrix.sub_mulVec, Matrix.smul_mulVec,
Matrix.one_mulVec, dotProduct_sub, dotProduct_smul]
exact sub_nonneg.mpr (hbound x)
refine ⟨hB, ?_⟩
have hpker : p ∈ LinearMap.ker B.mulVecLin := by
rw [LinearMap.mem_ker]
simp only [B, Matrix.mulVecLin_apply, Matrix.sub_mulVec, Matrix.smul_mulVec,
Matrix.one_mulVec, heig, sub_self]
have hk : 1 ≤ Module.finrank ℝ (LinearMap.ker B.mulVecLin) := by
apply Submodule.one_le_finrank_iff.mpr
intro hzero
rw [hzero, Submodule.mem_bot] at hpker
exact hp0 hpker
have hdim := LinearMap.finrank_range_add_finrank_ker B.mulVecLin
have hdim' : B.rank + Module.finrank ℝ (LinearMap.ker B.mulVecLin) = n := by
simpa only [Matrix.rank, Module.finrank_fintype_fun_eq_card, Fintype.card_fin] using hdim
change B.rank ≤ n - 1
omega
theorem lower_graph_factor (α : ℝ) (hα : α ∈ Set.Ioo 0 1)
(n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(hradius : spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal ((1 - α) / (2 * α))) :
∃ B : Matrix (Fin (n - 1)) (Fin n) ℝ,
B.conjTranspose * B = (1 - α) • 1 - (2 * α) • G.adjMatrix ℝ := by
classical
have hαpos : 0 < α := hα.1
have hlambda : 0 < (1 - α) / (2 * α) :=
div_pos (sub_pos.mpr hα.2) (by positivity)
obtain ⟨hpsd, hrank⟩ := lower_graph_shift_psd_rank _ hlambda n G hradius
have heq : (2 * α) • (((1 - α) / (2 * α)) • (1 : Matrix (Fin n) (Fin n) ℝ) -
G.adjMatrix ℝ) = (1 - α) • 1 - (2 * α) • G.adjMatrix ℝ := by
rw [smul_sub, smul_smul, mul_div_cancel₀ _ (show 2 * α ≠ 0 by positivity)]
obtain ⟨v, hv⟩ := Helpers.positive_semidefinite_gram_realization n (n - 1)
_ (hpsd.smul (show 0 ≤ 2 * α by positivity))
((real_matrix_rank_smul_le _ _).trans hrank)
let b := EuclideanSpace.basisFun (Fin (n - 1)) ℝ
refine ⟨Matrix.of (fun i j => b.repr (v j) i), ?_⟩
exact (Matrix.gram_eq_conjTranspose_mul b v).symm.trans (hv.trans heq)
theorem lower_gram_configuration_fintype {ι : Type*} [Fintype ι]
(α : ℝ) (hα : α ∈ Set.Ioo 0 1) (d : ℕ) (M : Matrix ι ι ℝ)
(hM : M.PosSemidef) (hrank : M.rank ≤ d) (hdiag : ∀ i, M i i = 1)
(hoff : ∀ i j, i ≠ j → |M i j| = α) : Fintype.card ι ≤ N α d := by
classical
let e : Fin (Fintype.card ι) ≃ ι := (Fintype.equivFin ι).symm
apply lower_gram_configuration α hα _ d (M.submatrix e e) (hM.submatrix e)
· simpa only [Matrix.rank_submatrix] using hrank
· intro i; exact hdiag (e i)
· intro i j hij; exact hoff (e i) (e j) (e.injective.ne hij)
theorem lower_matrix_rank_add_le {ι κ : Type*} [Fintype ι] [Fintype κ]
(A B : Matrix ι κ ℝ) : (A + B).rank ≤ A.rank + B.rank := by
classical
rw [Matrix.rank, Matrix.rank, Matrix.rank, Matrix.mulVecLin_add]
exact (Submodule.finrank_mono (LinearMap.range_add_le A.mulVecLin B.mulVecLin)).trans
(Submodule.finrank_add_le_finrank_add_finrank _ _)
theorem lower_graph_copies_configuration (α : ℝ) (hα : α ∈ Set.Ioo 0 1)
(n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(hradius : spectralRadius ℝ (G.adjMatrix ℝ) = ENNReal.ofReal ((1 - α) / (2 * α)))
(t r : ℕ) : n * t + r ≤ N α ((n - 1) * t + r + 1) := by
classical
obtain ⟨B, hB⟩ := lower_graph_factor α hα n G hradius
let S : Matrix (Fin r) (Fin r) ℝ := Real.sqrt (1 - α) • 1
have hS : S.conjTranspose * S = (1 - α) • 1 := by
simp only [S, Matrix.conjTranspose_smul, star_trivial, Matrix.conjTranspose_one,
Matrix.smul_mul, Matrix.mul_smul, Matrix.one_mul, smul_smul]
rw [Real.mul_self_sqrt (sub_nonneg.mpr hα.2.le)]
let C : Matrix ((Fin (n - 1) × Fin t) ⊕ Fin r) ((Fin n × Fin t) ⊕ Fin r) ℝ :=
Matrix.fromBlocks (Matrix.blockDiagonal (fun _ : Fin t => B)) 0 0 S
let D : Matrix ((Fin n × Fin t) ⊕ Fin r) ((Fin n × Fin t) ⊕ Fin r) ℝ :=
Matrix.fromBlocks
(Matrix.blockDiagonal (fun _ : Fin t => (1 - α) • 1 - (2 * α) • G.adjMatrix ℝ))
0 0 ((1 - α) • 1)
have hC : C.conjTranspose * C = D := by
dsimp only [C, D]
rw [Matrix.fromBlocks_conjTranspose, Matrix.fromBlocks_multiply,
Matrix.blockDiagonal_conjTranspose, ← Matrix.blockDiagonal_mul]
simp only [Matrix.conjTranspose_zero, Matrix.zero_mul, Matrix.mul_zero,
add_zero, zero_add, hB, hS]
let J : Matrix ((Fin n × Fin t) ⊕ Fin r) ((Fin n × Fin t) ⊕ Fin r) ℝ :=
Matrix.of (fun _ _ => 1)
let M := C.conjTranspose * C + α • J
have hM : M.PosSemidef :=
(Matrix.posSemidef_conjTranspose_mul_self C).add
(lower_all_ones_posSemidef.smul hα.1.le)
have hrank : M.rank ≤ (n - 1) * t + r + 1 := by
have hJ : (α • J).rank ≤ 1 := by
have heq : α • J = Matrix.vecMulVec (fun _ => α) (fun _ => (1 : ℝ)) := by
ext i j; simp [J, Matrix.vecMulVec]
rw [heq]
exact Matrix.rank_vecMulVec_le _ _
calc
M.rank ≤ (C.conjTranspose * C).rank + (α • J).rank := lower_matrix_rank_add_le _ _
_ ≤ C.rank + 1 := Nat.add_le_add (Matrix.rank_mul_le_right _ _) hJ
_ ≤ (n - 1) * t + r + 1 := by
have hc := Matrix.rank_le_card_height C
simp only [Fintype.card_sum, Fintype.card_prod, Fintype.card_fin] at hc
omega
have hdiag : ∀ i, M i i = 1 := by
intro i
rw [show M = D + α • J from congrArg (fun X => X + α • J) hC]
rcases i with ⟨i, a⟩ | i <;>
simp [D, J, Matrix.blockDiagonal_apply, Matrix.one_apply] <;> ring
have hoff : ∀ i j, i ≠ j → |M i j| = α := by
intro i j hij
rw [show M = D + α • J from congrArg (fun X => X + α • J) hC]
rcases i with ⟨i, a⟩ | i <;> rcases j with ⟨j, b⟩ | j
· by_cases hab : a = b
· have hne : i ≠ j := by intro h; subst j; subst b; exact hij rfl
by_cases hadj : G.Adj i j
· simp [D, J, Matrix.blockDiagonal_apply, hab, hne, hadj]
simpa only [show -(2 * α) + α = -α by ring, abs_neg, abs_of_pos hα.1]
· simp [D, J, Matrix.blockDiagonal_apply, hab, hne, hadj, abs_of_pos hα.1]
· simp [D, J, Matrix.blockDiagonal_apply, hab, abs_of_pos hα.1]
· simp [D, J, abs_of_pos hα.1]
· simp [D, J, abs_of_pos hα.1]
· have hne : i ≠ j := by intro h; subst j; exact hij rfl
simp [D, J, hne, abs_of_pos hα.1]
have h := lower_gram_configuration_fintype α hα _ M hM hrank hdiag hoff
simpa only [Fintype.card_sum, Fintype.card_prod, Fintype.card_fin] using h
theorem lower_floor_count (q d : ℕ) (hq : 2 ≤ q) (hd : 1 ≤ d) :
⌊(q * (d - 1) : ℝ) / (q - 1 : ℝ)⌋₊ =
q * ((d - 1) / (q - 1)) + (d - 1) % (q - 1) := by
exact Helpers.lower_floor_count_real_subtraction q d hq hd
theorem configuration_lower_bounds :
∀ (α : ℝ), α ∈ Set.Ioo 0 1 →
let k := spectralRadiusOrder ((1 - α) / (2 * α))
(∀ d : ℕ, d ≤ N α d) ∧
(k < ⊤ → ∀ᶠ (d : ℕ) in Filter.atTop,
⌊(k.toNat * (d - 1) : ℝ) / (k.toNat - 1 : ℝ)⌋₊ ≤ N α d) := by
classical
intro α hα
refine ⟨configuration_dimension_lower_bound α hα, ?_⟩
intro hfinite
obtain ⟨q, G, hq, hradius⟩ := spectral_order_attained _ hfinite
have hαpos : 0 < α := hα.1
have hlambda : 0 < (1 - α) / (2 * α) :=
div_pos (sub_pos.mpr hα.2) (by positivity)
have hqge := lower_graph_order_ge_two _ hlambda q G hradius
have hqn : (spectralRadiusOrder ((1 - α) / (2 * α))).toNat = q := by
rw [← hq, ENat.toNat_natCast]
apply Filter.eventually_atTop.mpr
refine ⟨1, ?_⟩
intro d hd
rw [hqn, lower_floor_count q d hqge hd]
have hc := lower_graph_copies_configuration α hα q G hradius
((d - 1) / (q - 1)) ((d - 1) % (q - 1))
have hdim : (q - 1) * ((d - 1) / (q - 1)) + (d - 1) % (q - 1) + 1 = d := by
rw [Nat.div_add_mod]
omega
rwa [hdim] at hc
theorem configuration_upper_bounds :
∀ (α : ℝ), α ∈ Set.Ioo 0 1 →
let k := spectralRadiusOrder ((1 - α) / (2 * α))
(k < ⊤ → ∀ᶠ (d : ℕ) in Filter.atTop,
N α d ≤ ⌊(k.toNat * (d - 1) : ℝ) / (k.toNat - 1 : ℝ)⌋₊) ∧
(k = ⊤ → ∀ ε : ℝ, 0 < ε → ∀ᶠ (d : ℕ) in Filter.atTop,
(N α d : ℝ) ≤ (1 + ε) * (d : ℝ)) := by
classical
intro α hα
have hlam : 0 < (1 - α) / (2 * α) :=
div_pos (sub_pos.mpr hα.2) (mul_pos (by norm_num) hα.1)
constructor
· intro hfinite
obtain ⟨q, H, hqorder, hradius⟩ := spectral_order_attained _ hfinite
have hqge : 2 ≤ q := lower_graph_order_ge_two _ hlam q H hradius
have hqpos : (0 : ℝ) < q := by exact_mod_cast (show 0 < q by omega)
have hqnat : (spectralRadiusOrder ((1 - α) / (2 * α))).toNat = q := by
rw [← hqorder, ENat.toNat_natCast]
obtain ⟨M, hM⟩ := upper_unit_vector_bound_cases α hα
(1 / (2 * (q : ℝ))) (by positivity)