b3_adjMatrix_trace_sq
For B_3(n_0,n_1,n_2) with adjacency matrix A: tr(A^2) = tr(M^2) + (n - 3). Since tr(A^2) is the sum of the squares of all adjacency eigenvalues and -1 has multiplicity n - 3, this identifies tr(M^2) with the sum of the squares of the eigenvalues other than -1.
Statement
open Classical in theorem b3_adjMatrix_trace_sq (n : Fin 3 → ℕ) : (((b3_graph n).adjMatrix ℝ) ^ 2).trace = (b3_quotient_matrix n ^ 2).trace + ((∑ i, (n i : ℝ)) - 3)
- Source
- arXiv:2610.21388 (Stronger spectral bound for clique number), Theorems 2.3 and 2.6 (the eigenvalue -1 of multiplicity n - 3 from the cliques); links the trace form of Theorem 3.1 to the adjacency spectrum
- Verified
- 18 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- b3_graphThe graph B_3(n_0, n_1, n_2) on the disjoint union of blocks of sizes n_0, n_1, n_2: two distinct vertices are adjacent iff they lie in…
- b3_quotient_matrixThe 3x3 quotient matrix M = [[n_0 - 1, 0, n_2], [0, n_1 - 1, n_2], [n_0, n_1, n_2 - 1]] of B_3(n_0, n_1, n_2), whose three eigenvalues are…
- b3_quotient_trace_sqtr(M^2) = n_0^2 + n_1^2 - n_2^2 + 2 n n_2 + 3 - 2n for the quotient matrix M of B_3(n_0,n_1,n_2), n = n_0 + n_1 + n_2; this is the sum of…
- b3_graph_adjSanity lemma: adjacency in B_3(n_0,n_1,n_2) unfolds to: distinct, and same block or one endpoint in block 2.
The proof, explained
The proof computes $\mathrm{tr}(A^2)$ as the sum of all vertex degrees of the graph $B_3(n)$, partitioned into its three independent or clique sets. It shows that vertices in part 0 have degree $n_0 - 1 + n_2$, vertices in part 1 have degree $n_1 - 1 + n_2$, and vertices in part 2 have degree $n_0 + n_1 + n_2 - 1$. Summing these degrees across all parts and comparing the result with the precomputed formula for $\mathrm{tr}(M^2)$ from `b3_quotient_trace_sq` yields the identity by polynomial algebra in $\mathbb{R}$.
The trace of $A^2$ equals the sum of the degrees of all vertices in $B_3(n)$.
Writing $A^2 = A \cdot A$ and expanding the trace into the sum of diagonal entries, each entry $(A^2)_{xx}$ is rewritten as the degree of vertex $x$ using `SimpleGraph.adjMatrix_mul_self_apply_self`.
uses
pow_two,Matrix.trace,Finset.sum_congr,SimpleGraph.adjMatrix_mul_self_apply_selfclassical have htrace : (((b3_graph n).adjMatrix ℝ) ^ 2).trace = ∑ x : Sigma (fun i : Fin 3 => Fin (n i)), ((b3_graph n).degree x : ℝ) := by rw [pow_two, Matrix.trace] exact Finset.sum_congr rfl (fun x _ => SimpleGraph.adjMatrix_mul_self_apply_self (b3_graph n) x)
Every vertex in part 0 has degree $n_0 - 1 + n_2$.
By definition of adjacency in $B_3(n)$, a vertex $\langle 0, v \rangle$ is adjacent to the other $n_0 - 1$ vertices in part 0 and all $n_2$ vertices in part 2, but no vertices in part 1. Since parts 0 and 2 are disjoint, the neighborhood is a disjoint union of these two sets, so its cardinality is $(n_0 - 1) + n_2$.
uses
b3_graph_adj,Finset.disjoint_left,SimpleGraph.degree,Finset.card_union_of_disjoint,Finset.card_image_of_injective,Finset.card_erase_of_mem,Finset.card_univ,Fintype.card_finhave deg0 : ∀ v : Fin (n 0), (b3_graph n).degree ⟨(0 : Fin 3), v⟩ = n 0 - 1 + n 2 := by intro v have heq : (b3_graph n).neighborFinset ⟨(0 : Fin 3), v⟩ = ((Finset.univ : Finset (Fin (n 0))).erase v).image (fun w => (⟨(0:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) ∪ (Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) := by ext x simp only [Finset.mem_union, Finset.mem_image, Finset.mem_erase, Finset.mem_univ, true_and, SimpleGraph.mem_neighborFinset, b3_graph_adj] obtain ⟨i, w⟩ := x fin_cases i · simp [Sigma.mk.injEq, eq_comm] · simp [Sigma.mk.injEq] · simp [Sigma.mk.injEq] have hdisj : Disjoint (((Finset.univ : Finset (Fin (n 0))).erase v).image (fun w => (⟨(0:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) ((Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) := by rw [Finset.disjoint_left] intro x hx hy simp only [Finset.mem_image, Finset.mem_univ, true_and] at hx hy obtain ⟨a, -, rfl⟩ := hx obtain ⟨b, hb⟩ := hy simp [Sigma.mk.injEq] at hb rw [SimpleGraph.degree, heq, Finset.card_union_of_disjoint hdisj] rw [Finset.card_image_of_injective _ (fun a b h => by simpa using h), Finset.card_image_of_injective _ (fun a b h => by simpa using h)] rw [Finset.card_erase_of_mem (Finset.mem_univ v), Finset.card_univ, Finset.card_univ, Fintype.card_fin, Fintype.card_fin]
Every vertex in part 1 has degree $n_1 - 1 + n_2$.
Symmetrically, the neighborhood of a vertex $\langle 1, v \rangle$ consists of the other $n_1 - 1$ vertices in part 1 and all $n_2$ vertices in part 2. Because these two parts are disjoint, the cardinality is $(n_1 - 1) + n_2$.
uses
b3_graph_adj,Finset.disjoint_left,SimpleGraph.degree,Finset.card_union_of_disjoint,Finset.card_image_of_injective,Finset.card_erase_of_mem,Finset.card_univ,Fintype.card_finhave deg1 : ∀ v : Fin (n 1), (b3_graph n).degree ⟨(1 : Fin 3), v⟩ = n 1 - 1 + n 2 := by intro v have heq : (b3_graph n).neighborFinset ⟨(1 : Fin 3), v⟩ = ((Finset.univ : Finset (Fin (n 1))).erase v).image (fun w => (⟨(1:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) ∪ (Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) := by ext x simp only [Finset.mem_union, Finset.mem_image, Finset.mem_erase, Finset.mem_univ, true_and, SimpleGraph.mem_neighborFinset, b3_graph_adj] obtain ⟨i, w⟩ := x fin_cases i · simp [Sigma.mk.injEq, eq_comm] · simp [Sigma.mk.injEq, eq_comm] · simp [Sigma.mk.injEq, eq_comm] have hdisj : Disjoint (((Finset.univ : Finset (Fin (n 1))).erase v).image (fun w => (⟨(1:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) ((Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) := by rw [Finset.disjoint_left] intro x hx hy simp only [Finset.mem_image, Finset.mem_univ, true_and] at hx hy obtain ⟨a, -, rfl⟩ := hx obtain ⟨b, hb⟩ := hy simp [Sigma.mk.injEq] at hb rw [SimpleGraph.degree, heq, Finset.card_union_of_disjoint hdisj] rw [Finset.card_image_of_injective _ (fun a b h => by simpa using h), Finset.card_image_of_injective _ (fun a b h => by simpa using h)] rw [Finset.card_erase_of_mem (Finset.mem_univ v), Finset.card_univ, Finset.card_univ, Fintype.card_fin, Fintype.card_fin]
Every vertex in part 2 has degree $n_0 + n_1 + n_2 - 1$.
Any vertex in part 2 is adjacent to every vertex in the graph except itself. Therefore, its neighborhood is the full vertex set minus itself, which has cardinality $\sum_{i=0}^2 n_i - 1 = n_0 + n_1 + n_2 - 1$.
uses
b3_graph_adj,SimpleGraph.degree,Finset.card_erase_of_mem,Finset.card_univ,Fintype.card_sigma,Fin.sum_univ_threehave deg2 : ∀ v : Fin (n 2), (b3_graph n).degree ⟨(2 : Fin 3), v⟩ = n 0 + n 1 + n 2 - 1 := by intro v have heq : (b3_graph n).neighborFinset ⟨(2 : Fin 3), v⟩ = (Finset.univ : Finset (Sigma (fun i : Fin 3 => Fin (n i)))).erase ⟨(2:Fin 3), v⟩ := by ext x simp only [Finset.mem_erase, Finset.mem_univ, SimpleGraph.mem_neighborFinset, b3_graph_adj] tauto rw [SimpleGraph.degree, heq, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, Fintype.card_sigma] simp [Fin.sum_univ_three]
The sum of degrees over all vertices in part 0 is $n_0 (n_0 - 1 + n_2)$ in $\mathbb{R}$.
Since every vertex in part 0 has the constant degree $n_0 - 1 + n_2$, summing this value over the $n_0$ vertices in $\mathrm{Fin}(n_0)$ yields $n_0(n_0 - 1 + n_2)$, after casting natural subtraction to real subtraction using $1 \le n_0$.
uses
Nat.cast_add,Nat.cast_sub,Nat.cast_one,Finset.sum_congr,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mulhave h0 : (∑ v : Fin (n 0), ((b3_graph n).degree ⟨(0:Fin 3), v⟩ : ℝ)) = (n 0 : ℝ) * ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := by have key : ∀ v : Fin (n 0), ((b3_graph n).degree ⟨(0:Fin 3), v⟩ : ℝ) = ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := by intro v rw [deg0 v] have hv : 1 ≤ n 0 := by have := v.isLt; omega rw [Nat.cast_add, Nat.cast_sub hv, Nat.cast_one] calc (∑ v : Fin (n 0), ((b3_graph n).degree ⟨(0:Fin 3), v⟩ : ℝ)) = ∑ v : Fin (n 0), ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := Finset.sum_congr rfl (fun v _ => key v) _ = (n 0 : ℝ) * ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]
The sum of degrees over all vertices in part 1 is $n_1 (n_1 - 1 + n_2)$ in $\mathbb{R}$.
Similarly, summing the constant degree $n_1 - 1 + n_2$ over all $n_1$ vertices of part 1 gives $n_1(n_1 - 1 + n_2)$ in $\mathbb{R}$.
uses
Nat.cast_add,Nat.cast_sub,Nat.cast_one,Finset.sum_congr,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mulhave h1 : (∑ v : Fin (n 1), ((b3_graph n).degree ⟨(1:Fin 3), v⟩ : ℝ)) = (n 1 : ℝ) * ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := by have key : ∀ v : Fin (n 1), ((b3_graph n).degree ⟨(1:Fin 3), v⟩ : ℝ) = ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := by intro v rw [deg1 v] have hv : 1 ≤ n 1 := by have := v.isLt; omega rw [Nat.cast_add, Nat.cast_sub hv, Nat.cast_one] calc (∑ v : Fin (n 1), ((b3_graph n).degree ⟨(1:Fin 3), v⟩ : ℝ)) = ∑ v : Fin (n 1), ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := Finset.sum_congr rfl (fun v _ => key v) _ = (n 1 : ℝ) * ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]
The sum of degrees over all vertices in part 2 is $n_2 (n_0 + n_1 + n_2 - 1)$ in $\mathbb{R}$.
Summing the constant degree $n_0 + n_1 + n_2 - 1$ over all $n_2$ vertices of part 2 gives $n_2(n_0 + n_1 + n_2 - 1)$ in $\mathbb{R}$.
uses
Nat.cast_add,Nat.cast_sub,Nat.cast_one,Finset.sum_congr,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mulhave h2 : (∑ v : Fin (n 2), ((b3_graph n).degree ⟨(2:Fin 3), v⟩ : ℝ)) = (n 2 : ℝ) * ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := by have key : ∀ v : Fin (n 2), ((b3_graph n).degree ⟨(2:Fin 3), v⟩ : ℝ) = ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := by intro v rw [deg2 v] have hv : 1 ≤ n 0 + n 1 + n 2 := by have := v.isLt; omega rw [Nat.cast_sub hv, Nat.cast_add, Nat.cast_add, Nat.cast_one] calc (∑ v : Fin (n 2), ((b3_graph n).degree ⟨(2:Fin 3), v⟩ : ℝ)) = ∑ v : Fin (n 2), ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := Finset.sum_congr rfl (fun v _ => key v) _ = (n 2 : ℝ) * ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul]
$\mathrm{tr}(A^2) = \mathrm{tr}(M^2) + (\sum_{i=0}^2 n_i - 3)$. automation
The total degree sum is split into the three partition sums (`Fintype.sum_sigma`, `Fin.sum_univ_three`), which are replaced by the formulas from $h_0$, $h_1$, and $h_2$. The trace of $M^2$ is expanded using `b3_quotient_trace_sq`, and the outer sum $\sum_i n_i$ is expanded. Ring arithmetic (`ring`) then verifies that both sides define the same polynomial in $n_0, n_1, n_2$.
uses
Fintype.sum_sigma,Fin.sum_univ_three,b3_quotient_trace_sqrw [htrace, Fintype.sum_sigma, Fin.sum_univ_three, h0, h1, h2] rw [b3_quotient_trace_sq] rw [Fin.sum_univ_three] ring
pow_two- $a^2 = a \cdot a$ in any monoid.
Matrix.trace- The trace of a square matrix is the sum of its diagonal elements.
Finset.sum_congr- If two finite index sets are equal and the summands agree pointwise, their sums are equal.
SimpleGraph.adjMatrix_mul_self_apply_self- For the adjacency matrix $A$ of a simple graph, the diagonal entry $(A^2)_{vv}$ equals the degree of vertex $v$.
b3_graph_adj- Two distinct vertices in $B_3(n)$ are adjacent if and only if they lie in the same part or at least one lies in part 2.
Finset.disjoint_left- Two finite sets are disjoint if and only if no element in the first belongs to the second.
SimpleGraph.degree- The degree of a vertex is the cardinality of its neighborhood finset.
Finset.card_union_of_disjoint- The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Finset.card_image_of_injective- The image of a finite set under an injective function has the same cardinality as the original set.
Finset.card_erase_of_mem- Removing an element that belongs to a finite set decreases its cardinality by 1.
Finset.card_univ- The cardinality of the universal finset of a finite type equals the cardinality of the type.
Fintype.card_fin- The cardinality of $\mathrm{Fin}(n)$ is $n$.
Fintype.card_sigma- The cardinality of a disjoint sum $\Sigma_{i} \alpha_i$ over a finite index type is the sum of the cardinalities of the components.
Fin.sum_univ_three- A sum over $\mathrm{Fin}(3)$ equals the sum of the terms at indices 0, 1, and 2.
Nat.cast_add- The natural cast distributes over addition: $\uparrow(m + n) = \uparrow m + \uparrow n$.
Nat.cast_sub- When $m \le n$, the natural cast distributes over subtraction: $\uparrow(n - m) = \uparrow n - \uparrow m$.
Nat.cast_one- The natural cast of 1 is 1.
Finset.sum_const- The sum of a constant value $b$ over a finite set $s$ is $|s| \cdot b$.
nsmul_eq_mul- Natural scalar multiplication $n \cdot a$ in a semiring equals multiplication by the cast of $n$.
Fintype.sum_sigma- A sum over a sigma type $\Sigma_i \alpha_i$ can be evaluated as an iterated sum $\sum_i \sum_{x \in \alpha_i}$.
b3_quotient_trace_sq- The explicit formula for $\mathrm{tr}(M^2)$ in terms of $n_0, n_1, n_2$, where $M$ is the quotient matrix.
- The cast of natural-number degrees to real numbers requires verifying that natural subtractions (such as $n_0 - 1$) do not underflow, which is discharged by linear arithmetic (`omega`) using the fact that the vertex indexing set $\mathrm{Fin}(n_i)$ is inhabited.
- The final algebraic equivalence between the degree sum and $\mathrm{tr}(M^2) + (\sum n_i - 3)$ is closed by the `ring` decision procedure.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
open Classical intheorem b3_adjMatrix_trace_sq (n : Fin 3 → ℕ) : (((b3_graph n).adjMatrix ℝ) ^ 2).trace = (b3_quotient_matrix n ^ 2).trace + ((∑ i, (n i : ℝ)) - 3) := by classical have htrace : (((b3_graph n).adjMatrix ℝ) ^ 2).trace = ∑ x : Sigma (fun i : Fin 3 => Fin (n i)), ((b3_graph n).degree x : ℝ) := by rw [pow_two, Matrix.trace] exact Finset.sum_congr rfl (fun x _ => SimpleGraph.adjMatrix_mul_self_apply_self (b3_graph n) x) have deg0 : ∀ v : Fin (n 0), (b3_graph n).degree ⟨(0 : Fin 3), v⟩ = n 0 - 1 + n 2 := by intro v have heq : (b3_graph n).neighborFinset ⟨(0 : Fin 3), v⟩ = ((Finset.univ : Finset (Fin (n 0))).erase v).image (fun w => (⟨(0:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) ∪ (Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) := by ext x simp only [Finset.mem_union, Finset.mem_image, Finset.mem_erase, Finset.mem_univ, true_and, SimpleGraph.mem_neighborFinset, b3_graph_adj] obtain ⟨i, w⟩ := x fin_cases i · simp [Sigma.mk.injEq, eq_comm] · simp [Sigma.mk.injEq] · simp [Sigma.mk.injEq] have hdisj : Disjoint (((Finset.univ : Finset (Fin (n 0))).erase v).image (fun w => (⟨(0:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) ((Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) := by rw [Finset.disjoint_left] intro x hx hy simp only [Finset.mem_image, Finset.mem_univ, true_and] at hx hy obtain ⟨a, -, rfl⟩ := hx obtain ⟨b, hb⟩ := hy simp [Sigma.mk.injEq] at hb rw [SimpleGraph.degree, heq, Finset.card_union_of_disjoint hdisj] rw [Finset.card_image_of_injective _ (fun a b h => by simpa using h), Finset.card_image_of_injective _ (fun a b h => by simpa using h)] rw [Finset.card_erase_of_mem (Finset.mem_univ v), Finset.card_univ, Finset.card_univ, Fintype.card_fin, Fintype.card_fin] have deg1 : ∀ v : Fin (n 1), (b3_graph n).degree ⟨(1 : Fin 3), v⟩ = n 1 - 1 + n 2 := by intro v have heq : (b3_graph n).neighborFinset ⟨(1 : Fin 3), v⟩ = ((Finset.univ : Finset (Fin (n 1))).erase v).image (fun w => (⟨(1:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) ∪ (Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i)))) := by ext x simp only [Finset.mem_union, Finset.mem_image, Finset.mem_erase, Finset.mem_univ, true_and, SimpleGraph.mem_neighborFinset, b3_graph_adj] obtain ⟨i, w⟩ := x fin_cases i · simp [Sigma.mk.injEq, eq_comm] · simp [Sigma.mk.injEq, eq_comm] · simp [Sigma.mk.injEq, eq_comm] have hdisj : Disjoint (((Finset.univ : Finset (Fin (n 1))).erase v).image (fun w => (⟨(1:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) ((Finset.univ : Finset (Fin (n 2))).image (fun w => (⟨(2:Fin 3), w⟩ : Sigma (fun i => Fin (n i))))) := by rw [Finset.disjoint_left] intro x hx hy simp only [Finset.mem_image, Finset.mem_univ, true_and] at hx hy obtain ⟨a, -, rfl⟩ := hx obtain ⟨b, hb⟩ := hy simp [Sigma.mk.injEq] at hb rw [SimpleGraph.degree, heq, Finset.card_union_of_disjoint hdisj] rw [Finset.card_image_of_injective _ (fun a b h => by simpa using h), Finset.card_image_of_injective _ (fun a b h => by simpa using h)] rw [Finset.card_erase_of_mem (Finset.mem_univ v), Finset.card_univ, Finset.card_univ, Fintype.card_fin, Fintype.card_fin] have deg2 : ∀ v : Fin (n 2), (b3_graph n).degree ⟨(2 : Fin 3), v⟩ = n 0 + n 1 + n 2 - 1 := by intro v have heq : (b3_graph n).neighborFinset ⟨(2 : Fin 3), v⟩ = (Finset.univ : Finset (Sigma (fun i : Fin 3 => Fin (n i)))).erase ⟨(2:Fin 3), v⟩ := by ext x simp only [Finset.mem_erase, Finset.mem_univ, SimpleGraph.mem_neighborFinset, b3_graph_adj] tauto rw [SimpleGraph.degree, heq, Finset.card_erase_of_mem (Finset.mem_univ _), Finset.card_univ, Fintype.card_sigma] simp [Fin.sum_univ_three] have h0 : (∑ v : Fin (n 0), ((b3_graph n).degree ⟨(0:Fin 3), v⟩ : ℝ)) = (n 0 : ℝ) * ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := by have key : ∀ v : Fin (n 0), ((b3_graph n).degree ⟨(0:Fin 3), v⟩ : ℝ) = ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := by intro v rw [deg0 v] have hv : 1 ≤ n 0 := by have := v.isLt; omega rw [Nat.cast_add, Nat.cast_sub hv, Nat.cast_one] calc (∑ v : Fin (n 0), ((b3_graph n).degree ⟨(0:Fin 3), v⟩ : ℝ)) = ∑ v : Fin (n 0), ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := Finset.sum_congr rfl (fun v _ => key v) _ = (n 0 : ℝ) * ((n 0 : ℝ) - 1 + (n 2 : ℝ)) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have h1 : (∑ v : Fin (n 1), ((b3_graph n).degree ⟨(1:Fin 3), v⟩ : ℝ)) = (n 1 : ℝ) * ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := by have key : ∀ v : Fin (n 1), ((b3_graph n).degree ⟨(1:Fin 3), v⟩ : ℝ) = ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := by intro v rw [deg1 v] have hv : 1 ≤ n 1 := by have := v.isLt; omega rw [Nat.cast_add, Nat.cast_sub hv, Nat.cast_one] calc (∑ v : Fin (n 1), ((b3_graph n).degree ⟨(1:Fin 3), v⟩ : ℝ)) = ∑ v : Fin (n 1), ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := Finset.sum_congr rfl (fun v _ => key v) _ = (n 1 : ℝ) * ((n 1 : ℝ) - 1 + (n 2 : ℝ)) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] have h2 : (∑ v : Fin (n 2), ((b3_graph n).degree ⟨(2:Fin 3), v⟩ : ℝ)) = (n 2 : ℝ) * ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := by have key : ∀ v : Fin (n 2), ((b3_graph n).degree ⟨(2:Fin 3), v⟩ : ℝ) = ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := by intro v rw [deg2 v] have hv : 1 ≤ n 0 + n 1 + n 2 := by have := v.isLt; omega rw [Nat.cast_sub hv, Nat.cast_add, Nat.cast_add, Nat.cast_one] calc (∑ v : Fin (n 2), ((b3_graph n).degree ⟨(2:Fin 3), v⟩ : ℝ)) = ∑ v : Fin (n 2), ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := Finset.sum_congr rfl (fun v _ => key v) _ = (n 2 : ℝ) * ((n 0 : ℝ) + (n 1 : ℝ) + (n 2 : ℝ) - 1) := by rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] rw [htrace, Fintype.sum_sigma, Fin.sum_univ_three, h0, h1, h2] rw [b3_quotient_trace_sq] rw [Fin.sum_univ_three] ring