This file contains tests for graph invariants on 5 specific concrete graphs: 1. HouseGraph: A graph on 5 vertices. 2. K4: The complete graph on 4 vertices. 3. PetersenGraph: The Petersen graph on 10 vertices. 4. C6: The cycle graph on 6 vertices. 5. Star5: The star graph with 5 leaves (6 vertices total).
Stored at check time. Anyone can fetch and re-check this answer.
Verdict
Lean checked the assigned statement and its axiom dependencies.
Checking program
Lean checking program 0.2.0
Lean toolchain
leanprover/lean4:v4.33.1
Library
formal-conjectures at f606af160664
Statement
Exact statement of WrittenOnTheWallII.Test.petersen_cvetkovic in FormalConjectures.WrittenOnTheWallII.Test.
Axioms used
Classical.choice, Quot.sound, propext
Axioms allowed
propext, Classical.choice, Quot.sound. Any other axiom or placeholder is turned down.
Human confirmation
Not needed; the checking program's verdict settles this problem.
Long horizon. These exercises check that formal graph invariant definitions give the right values on small graphs such as the Petersen graph and six-cycle. Verified mathematics.
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
136import FormalConjectures.WrittenOnTheWallII.Test
namespace Submission
open SimpleGraph Matrix
-- The adjacency matrix `A` satisfies `(A - 3)(A - 1)(A + 2) = 0`, so every eigenvalue lies in-- `{3, 1, -2}`. Its trace is `0` and `trace (A * A) = 30`, which fix the multiplicities-- `1, 5, 4`. The spectrum therefore has `6` positive and `4` negative eigenvalues and no zero.theorem solution : type_of% @WrittenOnTheWallII.Test.petersen_cvetkovic := by
have hZ : petersenGraph.adjMatrix ℤ * petersenGraph.adjMatrix ℤ * petersenGraph.adjMatrix ℤ
- 2 • (petersenGraph.adjMatrix ℤ * petersenGraph.adjMatrix ℤ)
- 5 • petersenGraph.adjMatrix ℤ + 6 • (1 : Matrix PetersenVertex PetersenVertex ℤ) = 0 := by
decide +kernel
set A : Matrix PetersenVertex PetersenVertex ℝ := petersenGraph.adjMatrix ℝ with hAdef
have hmapA : (Int.castRingHom ℝ).mapMatrix (petersenGraph.adjMatrix ℤ) = A := by
ext i j
simp only [RingHom.mapMatrix_apply, Matrix.map_apply, hAdef, adjMatrix_apply]
split_ifs <;> simp
have hR : A * A * A - 2 • (A * A) - 5 • A + 6 • (1 : Matrix PetersenVertex PetersenVertex ℝ) = 0 := by
have h := congrArg (Int.castRingHom ℝ).mapMatrix hZ
simpa only [map_add, map_sub, map_mul, map_nsmul, map_one, map_zero, hmapA] using h
have hsymm : A.IsHermitian := isHermitian_iff_isSymm.mpr (isSymm_adjMatrix _)
-- Every eigenvalue is a root of (x - 3)(x - 1)(x + 2).
have hval : ∀ i, (hsymm.eigenvalues i - 3) * (hsymm.eigenvalues i - 1)
* (hsymm.eigenvalues i + 2) = 0 := by
intro i
have hv : A *ᵥ (hsymm.eigenvectorBasis i : PetersenVertex → ℝ)
= hsymm.eigenvalues i • (hsymm.eigenvectorBasis i : PetersenVertex → ℝ) :=
hsymm.mulVec_eigenvectorBasis i
have key : (A * A * A - 2 • (A * A) - 5 • A + 6 • (1 : Matrix PetersenVertex PetersenVertex ℝ))
*ᵥ (hsymm.eigenvectorBasis i : PetersenVertex → ℝ) = 0 := by
rw [hR, Matrix.zero_mulVec]
simp only [Matrix.sub_mulVec, Matrix.add_mulVec, Matrix.smul_mulVec, Matrix.one_mulVec,
← Matrix.mulVec_mulVec, hv, Matrix.mulVec_smul] at key
-- Read `key` one coordinate `j` where the eigenvector is nonzero.
have hne : (hsymm.eigenvectorBasis i : PetersenVertex → ℝ) ≠ 0 := fun h0 =>
hsymm.eigenvectorBasis.orthonormal.ne_zero i ((WithLp.ofLp_eq_zero 2).mp h0)
obtain ⟨j, hj⟩ := Function.ne_iff.mp hne
have hkj := congrFun key j
simp only [Pi.add_apply, Pi.sub_apply, Pi.smul_apply, Pi.zero_apply, Pi.mul_apply,
Pi.ofNat_apply, smul_eq_mul, nsmul_eq_mul, Nat.cast_ofNat] at hkj
have hprod : ((hsymm.eigenvalues i - 3) * (hsymm.eigenvalues i - 1) * (hsymm.eigenvalues i + 2))
* (hsymm.eigenvectorBasis i : PetersenVertex → ℝ) j = 0 := by
linear_combination hkj
rcases mul_eq_zero.mp hprod with h | h
· exact h
· exact absurd h hj
have hvals : ∀ i, hsymm.eigenvalues i = 3 ∨ hsymm.eigenvalues i = 1 ∨ hsymm.eigenvalues i = -2 := by
intro i
rcases mul_eq_zero.mp (hval i) with h | h
· rcases mul_eq_zero.mp h with h | h
· left; linarith
· right; left; linarith
· right; right; linarith
-- Trace of A, and trace of A * A through the spectral decomposition.
have hsum : ∑ i, hsymm.eigenvalues i = 0 := by
have h := hsymm.trace_eq_sum_eigenvalues
simp only [RCLike.ofReal_real_eq_id, id, hAdef, trace_adjMatrix] at h
linarith
have hgen : ∀ (M : Matrix PetersenVertex PetersenVertex ℝ) (hM : M.IsHermitian),
(M * M).trace = ∑ i, hM.eigenvalues i ^ 2 := by
intro M hM
have h1 : star (hM.eigenvectorUnitary : Matrix PetersenVertex PetersenVertex ℝ)
* (hM.eigenvectorUnitary : Matrix PetersenVertex PetersenVertex ℝ) = 1 :=
Unitary.coe_star_mul_self _
have h2 : ∀ X : Matrix PetersenVertex PetersenVertex ℝ,
star (hM.eigenvectorUnitary : Matrix PetersenVertex PetersenVertex ℝ)
* ((hM.eigenvectorUnitary : Matrix PetersenVertex PetersenVertex ℝ) * X) = X := by
intro X
rw [← Matrix.mul_assoc, h1, Matrix.one_mul]
have key : M * M = (hM.eigenvectorUnitary : Matrix PetersenVertex PetersenVertex ℝ)
* (diagonal (RCLike.ofReal ∘ hM.eigenvalues) * diagonal (RCLike.ofReal ∘ hM.eigenvalues))
* star (hM.eigenvectorUnitary : Matrix PetersenVertex PetersenVertex ℝ) := by
conv_lhs => rw [hM.spectral_theorem]
simp only [Unitary.conjStarAlgAut_apply, Matrix.mul_assoc, h2]
rw [key, Matrix.trace_mul_cycle, h1, Matrix.one_mul, diagonal_mul_diagonal, trace_diagonal]
simp [sq]
have hsq : ∑ i, hsymm.eigenvalues i ^ 2 = 30 := by
rw [← hgen A hsymm]
have hdiag : ∀ i, (A * A) i i = 3 := fun i => by
rw [hAdef, adjMatrix_mul_self_apply_self, petersenGraph_degree]
norm_num
simp only [Matrix.trace, Matrix.diag, hdiag, Finset.sum_const, Finset.card_univ,
card_petersenVertex, nsmul_eq_mul]
norm_num
-- Count the eigenvalues equal to -2 from the sums of squares and of eigenvalues.
have hcount : ∑ i, (if hsymm.eigenvalues i = -2 then (1 : ℝ) else 0) = 4 := by
have h1 : ∑ i, (hsymm.eigenvalues i - 3) * (hsymm.eigenvalues i - 1) = 60 := by
have h' : ∀ i, (hsymm.eigenvalues i - 3) * (hsymm.eigenvalues i - 1)
= hsymm.eigenvalues i ^ 2 - 4 * hsymm.eigenvalues i + 3 := fun i => by ring
simp only [h', Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum, hsq, hsum,
Finset.sum_const, Finset.card_univ, card_petersenVertex, nsmul_eq_mul]
norm_num
have h2 : ∀ i, (hsymm.eigenvalues i - 3) * (hsymm.eigenvalues i - 1)
= 15 * (if hsymm.eigenvalues i = -2 then (1 : ℝ) else 0) := by
intro i
rcases hvals i with h | h | h <;> norm_num [h]
rw [Finset.sum_congr rfl (fun i _ => h2 i), ← Finset.mul_sum] at h1
linarith
have hneg : (Finset.univ.filter (fun i => hsymm.eigenvalues i = -2)).card = 4 := by
have h := hcount
rw [Finset.sum_boole] at h
exact_mod_cast h
have hneg2 : (Finset.univ.filter (fun i => 0 > hsymm.eigenvalues i)).card = 4 := by
rw [Finset.filter_congr (q := fun i => hsymm.eigenvalues i = -2)
(fun i _ => by rcases hvals i with h | h | h <;> norm_num [h])]
exact hneg
have hpos : (Finset.univ.filter (fun i => 0 < hsymm.eigenvalues i)).card = 6 := by
have hc := (Finset.univ : Finset PetersenVertex).card_filter_add_card_filter_not
(fun i => hsymm.eigenvalues i = -2)
have hfc : Finset.univ.filter (fun i => ¬ (hsymm.eigenvalues i = -2))
= Finset.univ.filter (fun i => 0 < hsymm.eigenvalues i) :=
Finset.filter_congr (fun i _ => by rcases hvals i with h | h | h <;> norm_num [h])
rw [hfc, hneg, Finset.card_univ, card_petersenVertex] at hc
omega
-- Unfold cvetkovic and read off the three counts.
unfold SimpleGraph.cvetkovic
rw [← hAdef, hsymm.roots_charpoly_eq_eigenvalues]
simp only [RCLike.ofReal_real_eq_id, Function.id_comp]
have c1 : Multiset.countP (fun x => 0 < x) (Finset.univ.val.map hsymm.eigenvalues) = 6 := by
rw [Multiset.countP_map]
exact hpos
have c2 : Multiset.countP (fun x => 0 > x) (Finset.univ.val.map hsymm.eigenvalues) = 4 := by
rw [Multiset.countP_map]
exact hneg2
have c3 : Multiset.countP (fun x => 0 = x) (Finset.univ.val.map hsymm.eigenvalues) = 0 := by
rw [Multiset.countP_eq_zero]
intro a ha
rw [Multiset.mem_map] at ha
obtain ⟨i, _, rfl⟩ := ha
rcases hvals i with h | h | h <;> norm_num [h]
rw [c1, c2, c3]
norm_num
end Submission
Check it yourself
Project
formal-conjectures
Commit
f606af160664c5a10952e9a957b100a1cd45bbeb
Lean
leanprover/lean4:v4.33.1
Mathlib
0df444a360eaa60ab8c11dca51a86af692955474
With Git and Elan installed, put the download in a fresh working directory and run this there. Use a disposable environment. Lean prints the axioms at the end. The checker allows propext, Classical.choice, and Quot.sound.
(
set -eu
proof="$PWD/2b73d82c-25af-4aa8-8c43-af810f905675.lean"
git clone https://github.com/google-deepmind/formal-conjectures.git formal-conjectures
git -C formal-conjectures checkout --detach f606af160664c5a10952e9a957b100a1cd45bbeb
cd formal-conjectures
elan toolchain install leanprover/lean4:v4.33.1
lake +leanprover/lean4:v4.33.1 exe cache get
lake +leanprover/lean4:v4.33.1 build '+FormalConjectures.WrittenOnTheWallII.Test'
check_dir="$(mktemp -d)"
trap 'rm -f "$check_dir/Check.lean"; rmdir "$check_dir"' EXIT
printf "%s\n" "import Lean" > "$check_dir/Check.lean"
cat "$proof" >> "$check_dir/Check.lean"
cat >> "$check_dir/Check.lean" <<'SOLVE_CHECK'
example : type_of% @_root_.WrittenOnTheWallII.Test.petersen_cvetkovic := @_root_.Submission.solution
#print axioms Submission.solution
SOLVE_CHECK
lake +leanprover/lean4:v4.33.1 env lean "$check_dir/Check.lean"
)
Download the receipt verifier and public key. Run python3 verify-proof.py certificate.json 2b73d82c-25af-4aa8-8c43-af810f905675.lean proof-key.pem with OpenSSL 3.