/-
Copyright 2026 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
import FormalConjecturesUtilSidorenko's conjecture (1993)
References:
[Si93] Sidorenko, A. (1993). "A correlation inequality for bipartite graphs." Graphs Combin. 9, pp. 201--204.
[CoFo10] Conlon, D. and Fox, J. (2010). "Bounds for graph regularity and removal lemmas." Geom. Funct. Anal. 22, pp. 1191--1256.
[KLL18] Kim, J.H., Lee, C., Lee, J. (2018). "Two approaches to Sidorenko's conjecture." Trans. Amer. Math. Soc. 370, pp. 8515--8552.
[ArXiv2605] arXiv:2605.14138
[BR65] Blakley, G. R. and Roy, P. (1965). "A Hölder type inequality for symmetric matrices with nonnegative entries." Proc. Amer. Math. Soc. 16, pp. 1244--1245.
open Finset SimpleGraphnamespace SidorenkoConjectureopen LimitObjects/- ## Homomorphism density
We use `SimpleGraph.homCount` / `SimpleGraph.homDensity` from
`FormalConjecturesForMathlib.Combinatorics.SimpleGraph.HomDensity` for finite host graphs,
and `graphonHomDensity` / `graphonEdgeDensity` from
`FormalConjecturesForMathlib.Combinatorics.LimitObjects.Graphon` for graphons on measure spaces. -/
variable {V W : Type*}Sidorenko's conjecture (1993).
For every finite bipartite simple graph $H$ and every finite simple graph $G$:
$t(H, G) \ge t(K_2, G)^{e(H)}$, where $K_2$ denotes the single-edge graph on 2 vertices
(i.e. completeGraph (Fin 2)).
@[category research open, AMS 5]
theorem sidorenko_conjecture : answer(sorry) ↔
∀ {V W : Type} [Fintype V] [Fintype W] [DecidableEq V] [DecidableEq W] [Nonempty W]
(H : SimpleGraph V) (G : SimpleGraph W)
[DecidableRel H.Adj] [DecidableRel G.Adj],
H.IsBipartite →
homDensity (completeGraph (Fin 2)) G ^ H.edgeFinset.card ≤ homDensity H G := ⊢ True ↔
∀ {V W : Type} [inst : Fintype V] [inst_1 : Fintype W] [inst_2 : DecidableEq V] [inst_3 : DecidableEq W] [Nonempty W]
(H : SimpleGraph V) (G : SimpleGraph W) [inst_5 : DecidableRel H.Adj] [inst_6 : DecidableRel G.Adj],
H.IsBipartite → (completeGraph (Fin 2)).homDensity G ^ #H.edgeFinset ≤ H.homDensity G
All goals completed! 🐙Sidorenko's conjecture for graphons (1993).
For every finite bipartite simple graph $H$ and every graphon $W$ on $[0, 1]$ with Lebesgue measure: $t(H, W) \ge t(K_2, W)^{e(H)}$, where $t(K_2, W) = p(W)$ is the edge density of $W$, and $t(H, W)$ is the graphon homomorphism density of $H$ in $W$.
@[category research open, AMS 5]
theorem sidorenko_conjecture_graphon : answer(sorry) ↔
∀ {V : Type*} [Fintype V] [DecidableEq V] (H : SimpleGraph V) [DecidableRel H.Adj],
H.IsBipartite →
∀ (W : Graphon),
(graphonEdgeDensity W) ^ H.edgeFinset.card ≤ graphonHomDensity H W := ⊢ True ↔
∀ {V : Type u_3} [inst : Fintype V] [DecidableEq V] (H : SimpleGraph V) [inst_2 : DecidableRel H.Adj],
H.IsBipartite → ∀ (W : Graphon), graphonEdgeDensity W ^ #H.edgeFinset ≤ graphonHomDensity H W
All goals completed! 🐙
Case: H is a tree (Sidorenko 1993, graphon version).
If H is a finite tree then Sidorenko's inequality holds for all graphons on $[0, 1]$.
@[category research solved, AMS 5]
theorem sidorenko_tree_graphon {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hTree : H.IsTree)
(W : LimitObjects.Graphon) :
(graphonEdgeDensity W) ^ H.edgeFinset.card ≤ graphonHomDensity H W := V:Type u_3inst✝²:Fintype Vinst✝¹:DecidableEq VH:SimpleGraph Vinst✝:DecidableRel H.AdjhTree:H.IsTreeW:Graphon⊢ graphonEdgeDensity W ^ #H.edgeFinset ≤ graphonHomDensity H W
All goals completed! 🐙
Case: H = C_{2k} is an even cycle (Sidorenko 1993, graphon version).
Every even cycle $C_{2k}$ satisfies Sidorenko's inequality for all graphons on $[0, 1]$.
@[category research solved, AMS 5]
theorem sidorenko_even_cycle_graphon (k : ℕ) (hk : 1 ≤ k)
(W : LimitObjects.Graphon) :
(graphonEdgeDensity W) ^ (cycleGraph (2 * k)).edgeFinset.card ≤
graphonHomDensity (cycleGraph (2 * k)) W := k:ℕhk:1 ≤ kW:Graphon⊢ graphonEdgeDensity W ^ #(cycleGraph (2 * k)).edgeFinset ≤ graphonHomDensity (cycleGraph (2 * k)) W
All goals completed! 🐙open scoped Classical in
Case: H = K_{a,b} is a complete bipartite graph (Sidorenko 1993, graphon version).
Every complete bipartite graph $K_{a,b}$ satisfies Sidorenko's inequality for all graphons on $[0, 1]$.
@[category research solved, AMS 5]
theorem sidorenko_completeBipartiteGraph_graphon {A B : Type*} [Fintype A] [Fintype B]
[DecidableEq A] [DecidableEq B] (W : LimitObjects.Graphon) :
(graphonEdgeDensity W) ^ (completeBipartiteGraph A B).edgeFinset.card ≤
graphonHomDensity (completeBipartiteGraph A B) W := A:Type u_3B:Type u_4inst✝³:Fintype Ainst✝²:Fintype Binst✝¹:DecidableEq Ainst✝:DecidableEq BW:Graphon⊢ graphonEdgeDensity W ^ #(completeBipartiteGraph A B).edgeFinset ≤ graphonHomDensity (completeBipartiteGraph A B) W
All goals completed! 🐙/- ## Tournament Anti-Sidorenko (TAS) Trees Conjecture -/
open scoped Classical inTournament Anti-Sidorenko (TAS) Trees Conjecture.
For every finite undirected tree $T$, there exists an orientation $\vec{T}$ of its edges such that for any finite tournament $G$, the homomorphism density satisfies: $$ t_{\vec{T}}(G) \le 2^{-e(T)} $$ where $e(T)$ is the total number of edges in $T$.
@[category research open, AMS 5]
theorem tournament_anti_sidorenko_trees_conjecture : answer(sorry) ↔
∀ {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj],
T.IsTree →
∃ (D : Digraph V),
D.IsOrientation T ∧
∀ {W : Type*} [Fintype W] [DecidableEq W] [Nonempty W]
(G : Digraph W) [DecidableRel G.Adj],
G.IsTournament →
Digraph.homDensity D G ≤ (1 / 2 : ℝ) ^ T.edgeFinset.card := ⊢ True ↔
∀ {V : Type u_3} [inst : Fintype V] [inst_1 : DecidableEq V] (T : SimpleGraph V) [inst_2 : DecidableRel T.Adj],
T.IsTree →
∃ D,
D.IsOrientation T ∧
∀ {W : Type u_4} [inst_3 : Fintype W] [DecidableEq W] [Nonempty W] (G : Digraph W)
[inst_6 : DecidableRel G.Adj], G.IsTournament → D.homDensity G ≤ (1 / 2) ^ #T.edgeFinset
All goals completed! 🐙open scoped Classical inTournament Anti-Sidorenko (TAS) Trees Conjecture (Tournamenton limit version).
For every finite undirected tree $T$, there exists an orientation $\vec{T}$ of its edges such that for every tournamenton $W : [0, 1]^2 \to [0, 1]$, the homomorphism density satisfies: $$ t_{\vec{T}}(W) \le 2^{-e(T)} $$ where $e(T)$ is the total number of edges in $T$.
@[category research open, AMS 5]
theorem tournament_anti_sidorenko_trees_conjecture_tournamenton : answer(sorry) ↔
∀ {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj],
T.IsTree →
∃ (D : Digraph V),
D.IsOrientation T ∧
∀ (W : LimitObjects.Tournamenton),
tournamentonHomDensity D W ≤ (1 / 2 : ℝ) ^ T.edgeFinset.card := ⊢ True ↔
∀ {V : Type u_3} [inst : Fintype V] [DecidableEq V] (T : SimpleGraph V) [inst_2 : DecidableRel T.Adj],
T.IsTree → ∃ D, D.IsOrientation T ∧ ∀ (W : Tournamenton), tournamentonHomDensity D W ≤ (1 / 2) ^ #T.edgeFinset
All goals completed! 🐙open scoped Classical inTAS Trees Conjecture: Trees with a single even-degree vertex.
Proven case of TAS Trees Conjecture: any tree containing exactly one vertex of even degree possesses an orientation satisfying the Tournament Anti-Sidorenko inequality $t_{\vec{T}}(G) \le 2^{-e(T)}$.
@[category research solved, AMS 5]
theorem tournament_anti_sidorenko_single_even_degree_tree {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hTree : T.IsTree)
(hEven : (Finset.univ.filter (fun v => Even (T.degree v))).card = 1) :
∃ (D : Digraph V),
D.IsOrientation T ∧
∀ {W : Type*} [Fintype W] [DecidableEq W] [Nonempty W]
(G : Digraph W) [DecidableRel G.Adj],
G.IsTournament →
Digraph.homDensity D G ≤ (1 / 2 : ℝ) ^ T.edgeFinset.card := V:Type u_3inst✝²:Fintype Vinst✝¹:DecidableEq VT:SimpleGraph Vinst✝:DecidableRel T.AdjhTree:T.IsTreehEven:#{v | Even (T.degree v)} = 1⊢ ∃ D,
D.IsOrientation T ∧
∀ {W : Type u_4} [inst : Fintype W] [DecidableEq W] [Nonempty W] (G : Digraph W) [inst_3 : DecidableRel G.Adj],
G.IsTournament → D.homDensity G ≤ (1 / 2) ^ #T.edgeFinset
All goals completed! 🐙open scoped Classical inThe $(2,3,4)$-spider tree. A tree composed of three paths of lengths 2, 3, and 4 joined at a single central vertex.
def IsSpider234 {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] : Prop :=
T.IsTree ∧ Fintype.card V = 10 ∧
∃ (center l₁ l₂ l₃ : V),
T.degree center = 3 ∧
l₁ ≠ l₂ ∧ l₁ ≠ l₃ ∧ l₂ ≠ l₃ ∧
T.degree l₁ = 1 ∧ T.degree l₂ = 1 ∧ T.degree l₃ = 1 ∧
({T.dist center l₁, T.dist center l₂, T.dist center l₃} : Multiset ℕ) = {2, 3, 4}open scoped Classical inTAS Trees Conjecture: The $(2,3,4)$-spider tree (Solved case).
The $(2,3,4)$-spider tree satisfies the Tournament Anti-Sidorenko Trees Conjecture.
Reference:
@[category research solved, AMS 5]
theorem tournament_anti_sidorenko_spider234 {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hSpider : IsSpider234 T) :
∃ (D : Digraph V),
D.IsOrientation T ∧
∀ {W : Type*} [Fintype W] [DecidableEq W] [Nonempty W]
(G : Digraph W) [DecidableRel G.Adj],
G.IsTournament →
Digraph.homDensity D G ≤ (1 / 2 : ℝ) ^ T.edgeFinset.card := V:Type u_3inst✝²:Fintype Vinst✝¹:DecidableEq VT:SimpleGraph Vinst✝:DecidableRel T.AdjhSpider:IsSpider234 T⊢ ∃ D,
D.IsOrientation T ∧
∀ {W : Type u_4} [inst : Fintype W] [DecidableEq W] [Nonempty W] (G : Digraph W) [inst_3 : DecidableRel G.Adj],
G.IsTournament → D.homDensity G ≤ (1 / 2) ^ #T.edgeFinset
All goals completed! 🐙
Case H = K_2 (single edge): Sidorenko's inequality holds trivially with equality.
When H is K_2 (the single-edge graph on 2 vertices), e(H) = 1, so the RHS of Sidorenko's
inequality is just t(K_2, G)^1 = t(K_2, G) = t(H, G), which equals the LHS. Hence the
inequality holds as equality.
The proof records that (completeGraph (Fin 2)).edgeFinset.card = 1 and then reduces the claim
to t(K_2, G) ≤ t(K_2, G), which is le_refl.
All goals completed! 🐙/- ## Sidorenko for `K_{2,2}`: auxiliary lemmas -/
open scoped Classical in
edgeCount of K_{2,2} (complete bipartite graph on Fin 2 + Fin 2) is 4.
The four edges are {inl 0, inr 0}, {inl 0, inr 1}, {inl 1, inr 0}, {inl 1, inr 1}.
@[category API, AMS 5]
lemma edgeCount_completeBipartiteGraph_fin_two :
(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset.card = 4 := by ⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
-- Every vertex of `K_{2,2}` has degree 2, and there are 4 vertices; so by the
-- handshake formula `2 * #E = ∑ deg = 4 * 2 = 8`, hence `#E = 4`.
have hdeg : ∀ v : Fin 2 ⊕ Fin 2, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2 := by
intro v v:Fin 2 ⊕ Fin 2⊢ (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
rw [show (completeBipartiteGraph (Fin 2) (Fin 2)).degree v =
((completeBipartiteGraph (Fin 2) (Fin 2)).neighborFinset v).card from rfl v:Fin 2 ⊕ Fin 2⊢ #((completeBipartiteGraph (Fin 2) (Fin 2)).neighborFinset v) = 2 v:Fin 2 ⊕ Fin 2⊢ #((completeBipartiteGraph (Fin 2) (Fin 2)).neighborFinset v) = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4] v:Fin 2 ⊕ Fin 2⊢ #((completeBipartiteGraph (Fin 2) (Fin 2)).neighborFinset v) = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
cases v with
| inl i => inl i:Fin 2⊢ #((completeBipartiteGraph (Fin 2) (Fin 2)).neighborFinset (Sum.inl i)) = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
-- Neighbours of `inl i`: exactly `{inr 0, inr 1}`.
rw [neighborFinset_eq_filter inl i:Fin 2⊢ #{w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = 2 inl i:Fin 2⊢ #{w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4]inl i:Fin 2⊢ #{w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
rw [show (Finset.univ : Finset (Fin 2 ⊕ Fin 2)).filter
(fun w => (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w)
= {Sum.inr (0 : Fin 2), Sum.inr (1 : Fin 2)} from ?_ inl i:Fin 2⊢ #{Sum.inr 0, Sum.inr 1} = 2i:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = {Sum.inr 0, Sum.inr 1} inl i:Fin 2⊢ #{Sum.inr 0, Sum.inr 1} = 2i:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = {Sum.inr 0, Sum.inr 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4]inl i:Fin 2⊢ #{Sum.inr 0, Sum.inr 1} = 2i:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = {Sum.inr 0, Sum.inr 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
· inl i:Fin 2⊢ #{Sum.inr 0, Sum.inr 1} = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 decide All goals completed! 🐙 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
· i:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} = {Sum.inr 0, Sum.inr 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 ext w i:Fin 2w:Fin 2 ⊕ Fin 2⊢ w ∈ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} ↔ w ∈ {Sum.inr 0, Sum.inr 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
cases w with
| inl k => inl i:Fin 2k:Fin 2⊢ Sum.inl k ∈ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} ↔ Sum.inl k ∈ {Sum.inr 0, Sum.inr 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
simp [completeBipartiteGraph_adj] All goals completed! 🐙 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
| inr k => inr i:Fin 2k:Fin 2⊢ Sum.inr k ∈ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inl i) w} ↔ Sum.inr k ∈ {Sum.inr 0, Sum.inr 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
simp [completeBipartiteGraph_adj] inr i:Fin 2k:Fin 2⊢ k = 0 ∨ k = 1 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
fin_cases k inr.«0» i:Fin 2⊢ (fun i ↦ i) ⟨0, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨0, ⋯⟩ = 1inr.«1» i:Fin 2⊢ (fun i ↦ i) ⟨1, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨1, ⋯⟩ = 1 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 <;> inr.«0» i:Fin 2⊢ (fun i ↦ i) ⟨0, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨0, ⋯⟩ = 1inr.«1» i:Fin 2⊢ (fun i ↦ i) ⟨1, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨1, ⋯⟩ = 1 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 decide All goals completed! 🐙 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
| inr j => inr j:Fin 2⊢ #((completeBipartiteGraph (Fin 2) (Fin 2)).neighborFinset (Sum.inr j)) = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
rw [neighborFinset_eq_filter inr j:Fin 2⊢ #{w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = 2 inr j:Fin 2⊢ #{w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4]inr j:Fin 2⊢ #{w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
rw [show (Finset.univ : Finset (Fin 2 ⊕ Fin 2)).filter
(fun w => (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w)
= {Sum.inl (0 : Fin 2), Sum.inl (1 : Fin 2)} from ?_ inr j:Fin 2⊢ #{Sum.inl 0, Sum.inl 1} = 2j:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = {Sum.inl 0, Sum.inl 1} inr j:Fin 2⊢ #{Sum.inl 0, Sum.inl 1} = 2j:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = {Sum.inl 0, Sum.inl 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4]inr j:Fin 2⊢ #{Sum.inl 0, Sum.inl 1} = 2j:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = {Sum.inl 0, Sum.inl 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
· inr j:Fin 2⊢ #{Sum.inl 0, Sum.inl 1} = 2 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 decide All goals completed! 🐙 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
· j:Fin 2⊢ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} = {Sum.inl 0, Sum.inl 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 ext w j:Fin 2w:Fin 2 ⊕ Fin 2⊢ w ∈ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} ↔ w ∈ {Sum.inl 0, Sum.inl 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
cases w with
| inl k => inl j:Fin 2k:Fin 2⊢ Sum.inl k ∈ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} ↔ Sum.inl k ∈ {Sum.inl 0, Sum.inl 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
simp [completeBipartiteGraph_adj] inl j:Fin 2k:Fin 2⊢ k = 0 ∨ k = 1 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
fin_cases k inl.«0» j:Fin 2⊢ (fun i ↦ i) ⟨0, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨0, ⋯⟩ = 1inl.«1» j:Fin 2⊢ (fun i ↦ i) ⟨1, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨1, ⋯⟩ = 1 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 <;> inl.«0» j:Fin 2⊢ (fun i ↦ i) ⟨0, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨0, ⋯⟩ = 1inl.«1» j:Fin 2⊢ (fun i ↦ i) ⟨1, ⋯⟩ = 0 ∨ (fun i ↦ i) ⟨1, ⋯⟩ = 1 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 decide All goals completed! 🐙 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
| inr k => inr j:Fin 2k:Fin 2⊢ Sum.inr k ∈ {w | (completeBipartiteGraph (Fin 2) (Fin 2)).Adj (Sum.inr j) w} ↔ Sum.inr k ∈ {Sum.inl 0, Sum.inl 1} hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
simp [completeBipartiteGraph_adj] hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
have h : 2 * ((completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset).card =
∑ v : Fin 2 ⊕ Fin 2, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v := by
rw [← (completeBipartiteGraph (Fin 2) (Fin 2)).sum_degrees_eq_twice_card_edges hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2⊢ ∑ v, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = ∑ v, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = ∑ v, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4] hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = ∑ v, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = ∑ v, (completeBipartiteGraph (Fin 2) (Fin 2)).degree v⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
rw [Finset.sum_congr rfl (fun v _ => hdeg v) hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = ∑ v, 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4 hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = ∑ v, 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4] at h hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = ∑ v, 2⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
simp at h hdeg:∀ (v : Fin 2 ⊕ Fin 2), (completeBipartiteGraph (Fin 2) (Fin 2)).degree v = 2h:2 * #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 8⊢ #(completeBipartiteGraph (Fin 2) (Fin 2)).edgeFinset = 4
omega All goals completed! 🐙
Homomorphism count of K_2 into G equals 2 · #edgeFinset.
A homomorphism K_2 →g G is the same data as an ordered pair (f 0, f 1) of distinct
vertices with G.Adj (f 0) (f 1). These are in bijection with the Darts of G, and
#Darts(G) = 2 · #E(G) by dart_card_eq_twice_card_edges.
@[category API, AMS 5]
lemma homCount_completeGraph_fin_two_eq_two_mul_card_edgeFinset
{W : Type*} [Fintype W] [DecidableEq W]
(G : SimpleGraph W) [DecidableRel G.Adj] :
homCount (completeGraph (Fin 2)) G = 2 * #G.edgeFinset := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ (completeGraph (Fin 2)).homCount G = 2 * #G.edgeFinset
-- Build a bijection `(completeGraph (Fin 2) →g G) ≃ G.Dart`.
unfold homCount W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ Fintype.card (completeGraph (Fin 2) →g G) = 2 * #G.edgeFinset
rw [← G.dart_card_eq_twice_card_edges W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ Fintype.card (completeGraph (Fin 2) →g G) = Fintype.card G.Dart W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ Fintype.card (completeGraph (Fin 2) →g G) = Fintype.card G.Dart] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ Fintype.card (completeGraph (Fin 2) →g G) = Fintype.card G.Dart
-- Now: `Fintype.card (completeGraph (Fin 2) →g G) = Fintype.card G.Dart`.
refine Fintype.card_congr ?_ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ completeGraph (Fin 2) →g G ≃ G.Dart
refine
{ toFun := fun f =>
⟨(f 0, f 1), f.map_adj (by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g G⊢ (completeGraph (Fin 2)).Adj 0 1 decide All goals completed! 🐙 : (completeGraph (Fin 2)).Adj 0 1)⟩
invFun := fun d =>
{ toFun := fun i => if i = 0 then d.fst else d.snd
map_rel' := fun {a b} hab => by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darta:Fin 2b:Fin 2hab:(completeGraph (Fin 2)).Adj a b⊢ G.Adj (if a = 0 then d.toProd.1 else d.toProd.2) (if b = 0 then d.toProd.1 else d.toProd.2)
-- `completeGraph (Fin 2)` adjacency means `a ≠ b`.
simp only [completeGraph, top_adj] at hab W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darta:Fin 2b:Fin 2hab:a ≠ b⊢ G.Adj (if a = 0 then d.toProd.1 else d.toProd.2) (if b = 0 then d.toProd.1 else d.toProd.2)
-- `a, b ∈ Fin 2` with `a ≠ b` means `{a, b} = {0, 1}`.
fin_cases a «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Dartb:Fin 2hab:(fun i ↦ i) ⟨0, ⋯⟩ ≠ b⊢ G.Adj (if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) (if b = 0 then d.toProd.1 else d.toProd.2)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Dartb:Fin 2hab:(fun i ↦ i) ⟨1, ⋯⟩ ≠ b⊢ G.Adj (if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) (if b = 0 then d.toProd.1 else d.toProd.2) <;> «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Dartb:Fin 2hab:(fun i ↦ i) ⟨0, ⋯⟩ ≠ b⊢ G.Adj (if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) (if b = 0 then d.toProd.1 else d.toProd.2)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Dartb:Fin 2hab:(fun i ↦ i) ⟨1, ⋯⟩ ≠ b⊢ G.Adj (if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) (if b = 0 then d.toProd.1 else d.toProd.2) fin_cases b «1».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darthab:(fun i ↦ i) ⟨1, ⋯⟩ ≠ (fun i ↦ i) ⟨0, ⋯⟩⊢ G.Adj (if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
(if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)«1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darthab:(fun i ↦ i) ⟨1, ⋯⟩ ≠ (fun i ↦ i) ⟨1, ⋯⟩⊢ G.Adj (if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
(if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
· «0».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darthab:(fun i ↦ i) ⟨0, ⋯⟩ ≠ (fun i ↦ i) ⟨0, ⋯⟩⊢ G.Adj (if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
(if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) simp at hab All goals completed! 🐙
· «0».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darthab:(fun i ↦ i) ⟨0, ⋯⟩ ≠ (fun i ↦ i) ⟨1, ⋯⟩⊢ G.Adj (if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
(if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) exact d.adj All goals completed! 🐙
· «1».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darthab:(fun i ↦ i) ⟨1, ⋯⟩ ≠ (fun i ↦ i) ⟨0, ⋯⟩⊢ G.Adj (if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
(if (fun i ↦ i) ⟨0, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) exact d.adj.symm All goals completed! 🐙
· «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Darthab:(fun i ↦ i) ⟨1, ⋯⟩ ≠ (fun i ↦ i) ⟨1, ⋯⟩⊢ G.Adj (if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2)
(if (fun i ↦ i) ⟨1, ⋯⟩ = 0 then d.toProd.1 else d.toProd.2) simp at hab All goals completed! 🐙 }
left_inv := fun f => by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g G⊢ (fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
((fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ }) f) =
f
ext i W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g Gi:Fin 2⊢ ((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
((fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ }) f))
i =
f i
fin_cases i «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g G⊢ ((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
((fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ }) f))
((fun i ↦ i) ⟨0, ⋯⟩) =
f ((fun i ↦ i) ⟨0, ⋯⟩)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g G⊢ ((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
((fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ }) f))
((fun i ↦ i) ⟨1, ⋯⟩) =
f ((fun i ↦ i) ⟨1, ⋯⟩) <;> «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g G⊢ ((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
((fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ }) f))
((fun i ↦ i) ⟨0, ⋯⟩) =
f ((fun i ↦ i) ⟨0, ⋯⟩)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjf:completeGraph (Fin 2) →g G⊢ ((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
((fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ }) f))
((fun i ↦ i) ⟨1, ⋯⟩) =
f ((fun i ↦ i) ⟨1, ⋯⟩) simp All goals completed! 🐙
right_inv := fun d => by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjd:G.Dart⊢ (fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ })
((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ }) d) =
d
cases d mk W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjtoProd✝:W × Wadj✝:G.Adj toProd✝.1 toProd✝.2⊢ (fun f ↦ { fst := f 0, snd := f 1, adj := ⋯ })
((fun d ↦ { toFun := fun i ↦ if i = 0 then d.toProd.1 else d.toProd.2, map_rel' := ⋯ })
{ toProd := toProd✝, adj := adj✝ }) =
{ toProd := toProd✝, adj := adj✝ }
rfl All goals completed! 🐙 }open scoped Classical in
The Hom(K_{2,2}, G) decomposition. The number of homomorphisms from
K_{2,2} to G equals ∑_{(a, b) ∈ W × W} |N(a) ∩ N(b)|^2, where N(v) is the
neighbourhood of v in G. Equivalently, summing over ordered pairs
(b₀, b₁) ∈ W × W and counting common neighbours squared.
Math. A homomorphism K_{2,2} →g G is an assignment f : Fin 2 ⊕ Fin 2 → W
with G.Adj (f (inl i)) (f (inr j)) for all i, j ∈ Fin 2. Equivalently, choose
(a₀, a₁) := (f (inl 0), f (inl 1)) arbitrarily in W × W and require
(f (inr 0), f (inr 1)) to both lie in N(a₀) ∩ N(a₁). The count is thus
∑_{(a₀, a₁)} |N(a₀) ∩ N(a₁)|².
Proof. Construct an explicit bijection
(K_{2,2} →g G) ≃ Σ (p : W × W), (N(p.1) ∩ N(p.2)) × (N(p.1) ∩ N(p.2))
by sending a homomorphism f to ⟨(f (inl 0), f (inl 1)), ⟨f (inr 0), f (inr 1)⟩⟩.
The total cardinality of the sigma-product is then
∑_p (Fintype.card (N(p.1) ∩ N(p.2)))² = ∑_p |N(p.1) ∩ N(p.2)|².
@[category API, AMS 5]
lemma homCount_completeBipartiteGraph_fin_two_eq_sum_inter_sq
{W : Type*} [Fintype W] [DecidableEq W]
(G : SimpleGraph W) [DecidableRel G.Adj] :
(homCount (completeBipartiteGraph (Fin 2) (Fin 2)) G : ℝ) =
∑ p : W × W,
(((G.neighborFinset p.1) ∩ (G.neighborFinset p.2)).card : ℝ) ^ 2 := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- Reduce to a ℕ identity then cast.
have hNat : homCount (completeBipartiteGraph (Fin 2) (Fin 2)) G =
∑ p : W × W,
((G.neighborFinset p.1) ∩ (G.neighborFinset p.2)).card ^ 2 := by
unfold homCount W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- Build a `Fintype`-card equivalence between `K_{2,2} →g G` and
-- the sigma type `Σ (p : W × W), (N(p.1) ∩ N(p.2)) × (N(p.1) ∩ N(p.2))`.
-- A homomorphism `f : K_{2,2} →g G` is determined by the four values
-- `(f (inl 0), f (inl 1), f (inr 0), f (inr 1))` with `(inr j)`
-- adjacent to `(inl i)` for all `i, j`. So parameterise by
-- `a₀ := f (inl 0)`, `a₁ := f (inl 1)`, then `(b₀, b₁) := (f (inr 0), f (inr 1))`
-- must both lie in `N(a₀) ∩ N(a₁)`.
let KBip := completeBipartiteGraph (Fin 2) (Fin 2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- Define the target type parameterised in `p = (a₀, a₁)`.
-- Step 1: `card (K_{2,2} →g G) = card (Σ p, (N(p.1) ∩ N(p.2)) × (N(p.1) ∩ N(p.2)))`.
have hEquiv : (KBip →g G) ≃
Σ p : W × W,
({a : W // a ∈ G.neighborFinset p.1 ∩ G.neighborFinset p.2} ×
{a : W // a ∈ G.neighborFinset p.1 ∩ G.neighborFinset p.2}) := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
refine
{ toFun := fun f =>
⟨(f (Sum.inl 0), f (Sum.inl 1)),
⟨⟨f (Sum.inr 0), ?_⟩, ⟨f (Sum.inr 1), ?_⟩⟩⟩
invFun := fun x =>
{ toFun := fun v => match v with
| Sum.inl 0 => x.1.1
| Sum.inl 1 => x.1.2
| Sum.inr 0 => x.2.1.val
| Sum.inr 1 => x.2.2.val
map_rel' := ?_ }
left_inv := ?_
right_inv := ?_ } refine_1 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g G⊢ f (Sum.inr 0) ∈ G.neighborFinset (f (Sum.inl 0), f (Sum.inl 1)).1 ∩ G.neighborFinset (f (Sum.inl 0), f (Sum.inl 1)).2refine_2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g G⊢ f (Sum.inr 1) ∈ G.neighborFinset (f (Sum.inl 0), f (Sum.inl 1)).1 ∩ G.neighborFinset (f (Sum.inl 0), f (Sum.inl 1)).2refine_3 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)x:(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ ∀ {a b : Fin 2 ⊕ Fin 2},
KBip.Adj a b →
G.Adj
(match a with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2)
(match b with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2)refine_4 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Function.LeftInverse
(fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩refine_5 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Function.RightInverse
(fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
all_goals (try (
-- `f (Sum.inr j) ∈ N(f (Sum.inl 0)) ∩ N(f (Sum.inl 1))` for j = 0, 1.
simp only [Finset.mem_inter, mem_neighborFinset] refine_5 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Function.RightInverse
(fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
refine ⟨f.map_adj ?_, f.map_adj ?_⟩ refine_5 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Function.RightInverse
(fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> refine_2.refine_1 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g G⊢ KBip.Adj (Sum.inl 0) (Sum.inr 1)refine_2.refine_2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g G⊢ KBip.Adj (Sum.inl 1) (Sum.inr 1) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
simp [KBip, completeBipartiteGraph_adj] All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2))
· refine_3 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)x:(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ ∀ {a b : Fin 2 ⊕ Fin 2},
KBip.Adj a b →
G.Adj
(match a with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2)
(match b with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 -- Adjacency preservation for the inverse function.
rintro a b hab refine_3 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)x:(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2hab:KBip.Adj a b⊢ G.Adj
(match a with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2)
(match b with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
rcases x with ⟨⟨a₀, a₁⟩, ⟨⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩⟩⟩ refine_3 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2hab:KBip.Adj a ba₀:Wa₁:Wb₀:Whb₀:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2⊢ G.Adj
(match a with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.2)
(match b with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
simp only [KBip, completeBipartiteGraph_adj] at hab refine_3 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = true⊢ G.Adj
(match a with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.2)
(match b with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
simp only [Finset.mem_inter, mem_neighborFinset] at hb₀ hb₁ refine_3 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁⊢ G.Adj
(match a with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.2)
(match b with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
match a, b, hab with
| Sum.inl i, Sum.inr j, hab => W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁i:Fin 2j:Fin 2hab:(Sum.inl i).isLeft = true ∧ (Sum.inr j).isRight = true ∨ (Sum.inl i).isRight = true ∧ (Sum.inr j).isLeft = true⊢ G.Adj
(match Sum.inl i with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
fin_cases i «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inr j).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inr j).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr j).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr j).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inr j).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inr j).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr j).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr j).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 fin_cases j «1».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> «0».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«0».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
first | exact hb₀.1 «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 | exact hb₀.2 «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 | exact hb₁.1 «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 | exact hb₁.2 All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
| Sum.inr j, Sum.inl i, hab => W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2i:Fin 2hab:(Sum.inr j).isLeft = true ∧ (Sum.inl i).isRight = true ∨ (Sum.inr j).isRight = true ∧ (Sum.inl i).isLeft = true⊢ G.Adj
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl i with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
fin_cases i «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inr j).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inr j).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inr j).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr j).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inr j).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inr j).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁j:Fin 2hab:(Sum.inr j).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr j).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr j with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 fin_cases j «1».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> «0».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«0».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1».«0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)«1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
first | exact (hb₀.1).symm «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 | exact (hb₀.2).symm «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 |
exact (hb₁.1).symm «1».«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a:Fin 2 ⊕ Fin 2b:Fin 2 ⊕ Fin 2a₀:Wa₁:Wb₀:Whb₀✝:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁✝:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2hab✝:a.isLeft = true ∧ b.isRight = true ∨ a.isRight = true ∧ b.isLeft = truehb₀:G.Adj a₀ b₀ ∧ G.Adj a₁ b₀hb₁:G.Adj a₀ b₁ ∧ G.Adj a₁ b₁hab:(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∨
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)).isRight = true ∧ (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)).isLeft = true⊢ G.Adj
(match Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2)
(match Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩) with
| Sum.inl 0 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.1
| Sum.inl 1 => ⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.fst.2
| Sum.inr 0 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.1
| Sum.inr 1 => ↑⟨(a₀, a₁), (⟨b₀, hb₀✝⟩, ⟨b₁, hb₁✝⟩)⟩.snd.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 | exact (hb₁.2).symm All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
· refine_4 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Function.LeftInverse
(fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 -- left_inv
intro f refine_4 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g G⊢ (fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f) =
f W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
ext v refine_4 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
v =
f v W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- v : Fin 2 ⊕ Fin 2, enumerate cases.
match v with
| Sum.inl i => W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2i:Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inl i) =
f (Sum.inl i) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 fin_cases i «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)) =
f (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩))«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)) =
f (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩)) =
f (Sum.inl ((fun i ↦ i) ⟨0, ⋯⟩))«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)) =
f (Sum.inl ((fun i ↦ i) ⟨1, ⋯⟩)) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 rfl All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
| Sum.inr j => W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2j:Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inr j) =
f (Sum.inr j) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 fin_cases j «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)) =
f (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩))«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)) =
f (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 <;> «0» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩)) =
f (Sum.inr ((fun i ↦ i) ⟨0, ⋯⟩))«1» W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)f:KBip →g Gv:Fin 2 ⊕ Fin 2⊢ ((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
((fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩) f))
(Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)) =
f (Sum.inr ((fun i ↦ i) ⟨1, ⋯⟩)) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 rfl All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
· refine_5 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)⊢ Function.RightInverse
(fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 -- right_inv
rintro ⟨⟨a₀, a₁⟩, ⟨⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩⟩⟩ refine_5 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)a₀:Wa₁:Wb₀:Whb₀:b₀ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2b₁:Whb₁:b₁ ∈ G.neighborFinset (a₀, a₁).1 ∩ G.neighborFinset (a₀, a₁).2⊢ (fun f ↦ ⟨(f (Sum.inl 0), f (Sum.inl 1)), (⟨f (Sum.inr 0), ⋯⟩, ⟨f (Sum.inr 1), ⋯⟩)⟩)
((fun x ↦
{
toFun := fun v ↦
match v with
| Sum.inl 0 => x.fst.1
| Sum.inl 1 => x.fst.2
| Sum.inr 0 => ↑x.snd.1
| Sum.inr 1 => ↑x.snd.2,
map_rel' := ⋯ })
⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩) =
⟨(a₀, a₁), (⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩)⟩ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card (completeBipartiteGraph (Fin 2) (Fin 2) →g G) = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- Step 2: use `Fintype.card_congr` and simplify the cardinality of the sigma-product.
rw [Fintype.card_congr hEquiv W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card
((p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) =
∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card
((p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) =
∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card
((p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) =
∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
rw [Fintype.card_sigma W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ ∑ i, Fintype.card (↥(G.neighborFinset i.1 ∩ G.neighborFinset i.2) × ↥(G.neighborFinset i.1 ∩ G.neighborFinset i.2)) =
∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ ∑ i, Fintype.card (↥(G.neighborFinset i.1 ∩ G.neighborFinset i.2) × ↥(G.neighborFinset i.1 ∩ G.neighborFinset i.2)) =
∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ ∑ i, Fintype.card (↥(G.neighborFinset i.1 ∩ G.neighborFinset i.2) × ↥(G.neighborFinset i.1 ∩ G.neighborFinset i.2)) =
∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ ∀ x ∈ univ,
Fintype.card (↥(G.neighborFinset x.1 ∩ G.neighborFinset x.2) × ↥(G.neighborFinset x.1 ∩ G.neighborFinset x.2)) =
#(G.neighborFinset x.1 ∩ G.neighborFinset x.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
intro p _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univ⊢ Fintype.card (↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
rw [Fintype.card_prod, W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univ⊢ Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) *
Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univ⊢ Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) *
Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 sq W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univ⊢ Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) *
Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univ⊢ Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) *
Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univ⊢ Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) *
Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- Rewrite each subtype cardinality to a finset cardinality.
have hcard : Fintype.card
{a : W // a ∈ G.neighborFinset p.1 ∩ G.neighborFinset p.2}
= (G.neighborFinset p.1 ∩ G.neighborFinset p.2).card := Fintype.card_coe _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univhcard:Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = #(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) *
Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
rw [hcard W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjKBip:SimpleGraph (Fin 2 ⊕ Fin 2) := completeBipartiteGraph (Fin 2) (Fin 2)hEquiv:KBip →g G ≃
(p : W × W) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) × ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2)p:W × Wa✝:p ∈ univhcard:Fintype.card ↥(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = #(G.neighborFinset p.1 ∩ G.neighborFinset p.2)⊢ #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) =
#(G.neighborFinset p.1 ∩ G.neighborFinset p.2) * #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
-- Cast ℕ identity to ℝ.
have := congrArg (Nat.cast (R := ℝ)) hNat W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2this:↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ↑(∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2)⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
push_cast at this W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:(completeBipartiteGraph (Fin 2) (Fin 2)).homCount G = ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) ^ 2this:↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ x, ↑(#(G.neighborFinset x.1 ∩ G.neighborFinset x.2)) ^ 2⊢ ↑((completeBipartiteGraph (Fin 2) (Fin 2)).homCount G) = ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) ^ 2
exact this All goals completed! 🐙
K_{2,2} count via a re-indexed sum. Swapping the order of summation, the
Hom(K_{2,2}, G) count equals ∑_{a ∈ W} (G.degree a)² summed over... wait, more
precisely: the sum ∑_{(b₀, b₁)} |N(b₀) ∩ N(b₁)| (without the square) equals
∑_a (G.degree a)², by swapping (∑_{b₀, b₁} ∑_a [a ~ b₀][a ~ b₁]) = ∑_a (∑_b [a ~ b])².
This version of the identity is what appears in the Cauchy-Schwarz step.
@[category API, AMS 5]
lemma sum_inter_card_eq_sum_degree_sq
{W : Type*} [Fintype W] [DecidableEq W]
(G : SimpleGraph W) [DecidableRel G.Adj] :
∑ p : W × W,
(((G.neighborFinset p.1) ∩ (G.neighborFinset p.2)).card : ℝ) =
∑ a : W, ((G.degree a : ℝ)) ^ 2 := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
-- Work in ℕ for the combinatorial part, then cast.
have hNat : ∑ p : W × W, ((G.neighborFinset p.1) ∩ (G.neighborFinset p.2)).card =
∑ a : W, (G.degree a) ^ 2 := by
-- `|N(b₀) ∩ N(b₁)| = ∑_a [a ∈ N(b₀)][a ∈ N(b₁)]`, so summing gives
-- `∑_{b₀, b₁} |N(b₀) ∩ N(b₁)| = ∑_a (∑_{b₀} [b₀ ∈ N(a)])² = ∑_a deg(a)²`,
-- using `b ∈ N(a) ↔ a ∈ N(b)` (`adj_comm`).
calc ∑ p : W × W, ((G.neighborFinset p.1) ∩ (G.neighborFinset p.2)).card
= ∑ p : W × W,
((Finset.univ : Finset W).filter
(fun a => a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2)).card := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ p, #{a | a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2} W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∀ x ∈ univ, #(G.neighborFinset x.1 ∩ G.neighborFinset x.2) = #{a | a ∈ G.neighborFinset x.1 ∧ a ∈ G.neighborFinset x.2} W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
intro p _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjp:W × Wa✝:p ∈ univ⊢ #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = #{a | a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2} W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
congr 1 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjp:W × Wa✝:p ∈ univ⊢ G.neighborFinset p.1 ∩ G.neighborFinset p.2 = {a | a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2} W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
ext a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjp:W × Wa✝:p ∈ univa:W⊢ a ∈ G.neighborFinset p.1 ∩ G.neighborFinset p.2 ↔ a ∈ {a | a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2} W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
simp [Finset.mem_inter] All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
_ = ∑ p : W × W, ∑ a : W,
(if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∑ p, #{a | a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2} =
∑ p, ∑ a, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∀ x ∈ univ,
#{a | a ∈ G.neighborFinset x.1 ∧ a ∈ G.neighborFinset x.2} =
∑ a, if a ∈ G.neighborFinset x.1 ∧ a ∈ G.neighborFinset x.2 then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
intro p _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjp:W × Wa✝:p ∈ univ⊢ #{a | a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2} =
∑ a, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
rw [Finset.card_filter W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adjp:W × Wa✝:p ∈ univ⊢ (∑ i, if i ∈ G.neighborFinset p.1 ∧ i ∈ G.neighborFinset p.2 then 1 else 0) =
∑ a, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0 All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2] All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
_ = ∑ a : W, ∑ p : W × W,
(if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) :=
Finset.sum_comm
_ = ∑ a : W, (∑ b : W, (if a ∈ G.neighborFinset b then 1 else 0)) ^ 2 := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ (∑ a, ∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ a, (∑ b, if a ∈ G.neighborFinset b then 1 else 0) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∀ x ∈ univ,
(∑ p, if x ∈ G.neighborFinset p.1 ∧ x ∈ G.neighborFinset p.2 then 1 else 0) =
(∑ b, if x ∈ G.neighborFinset b then 1 else 0) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
intro a _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
(∑ b, if a ∈ G.neighborFinset b then 1 else 0) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
rw [sq, W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
(∑ b, if a ∈ G.neighborFinset b then 1 else 0) * ∑ b, if a ∈ G.neighborFinset b then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 Finset.sum_mul_sum W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
-- Goal: `∑ p : W × W, ite (a ∈ N p.1 ∧ a ∈ N p.2) 1 0 = ∑ p ∈ univ ×ˢ univ, ...`
rw [show (Finset.univ : Finset (W × W)) = Finset.univ ×ˢ Finset.univ from
(Finset.univ_product_univ).symm W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p ∈ univ ×ˢ univ, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p ∈ univ ×ˢ univ, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ p ∈ univ ×ˢ univ, if a ∈ G.neighborFinset p.1 ∧ a ∈ G.neighborFinset p.2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
rw [Finset.sum_product W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ x, ∑ y, if a ∈ G.neighborFinset (x, y).1 ∧ a ∈ G.neighborFinset (x, y).2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ x, ∑ y, if a ∈ G.neighborFinset (x, y).1 ∧ a ∈ G.neighborFinset (x, y).2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ x, ∑ y, if a ∈ G.neighborFinset (x, y).1 ∧ a ∈ G.neighborFinset (x, y).2 then 1 else 0) =
∑ i, ∑ j, (if a ∈ G.neighborFinset i then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ ∀ x ∈ univ,
(∑ y, if a ∈ G.neighborFinset (x, y).1 ∧ a ∈ G.neighborFinset (x, y).2 then 1 else 0) =
∑ j, (if a ∈ G.neighborFinset x then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
intro b₀ _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝¹:a ∈ univb₀:Wa✝:b₀ ∈ univ⊢ (∑ y, if a ∈ G.neighborFinset (b₀, y).1 ∧ a ∈ G.neighborFinset (b₀, y).2 then 1 else 0) =
∑ j, (if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset j then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝¹:a ∈ univb₀:Wa✝:b₀ ∈ univ⊢ ∀ x ∈ univ,
(if a ∈ G.neighborFinset (b₀, x).1 ∧ a ∈ G.neighborFinset (b₀, x).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset x then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
intro b₁ _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univ⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
by_cases h0 : a ∈ G.neighborFinset b₀ pos W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∈ G.neighborFinset b₀⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0neg W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∉ G.neighborFinset b₀⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 <;> pos W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∈ G.neighborFinset b₀⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0neg W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∉ G.neighborFinset b₀⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 by_cases h1 : a ∈ G.neighborFinset b₁ pos W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∉ G.neighborFinset b₀h1:a ∈ G.neighborFinset b₁⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0neg W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∉ G.neighborFinset b₀h1:a ∉ G.neighborFinset b₁⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 <;> pos W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∈ G.neighborFinset b₀h1:a ∈ G.neighborFinset b₁⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0neg W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∈ G.neighborFinset b₀h1:a ∉ G.neighborFinset b₁⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0pos W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∉ G.neighborFinset b₀h1:a ∈ G.neighborFinset b₁⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0neg W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝²:a ∈ univb₀:Wa✝¹:b₀ ∈ univb₁:Wa✝:b₁ ∈ univh0:a ∉ G.neighborFinset b₀h1:a ∉ G.neighborFinset b₁⊢ (if a ∈ G.neighborFinset (b₀, b₁).1 ∧ a ∈ G.neighborFinset (b₀, b₁).2 then 1 else 0) =
(if a ∈ G.neighborFinset b₀ then 1 else 0) * if a ∈ G.neighborFinset b₁ then 1 else 0 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
simp [h0, h1] All goals completed! 🐙 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
_ = ∑ a : W, (G.degree a) ^ 2 := by W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∑ a, (∑ b, if a ∈ G.neighborFinset b then 1 else 0) ^ 2 = ∑ a, G.degree a ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
apply Finset.sum_congr rfl W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adj⊢ ∀ x ∈ univ, (∑ b, if x ∈ G.neighborFinset b then 1 else 0) ^ 2 = G.degree x ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
intro a _ W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ b, if a ∈ G.neighborFinset b then 1 else 0) ^ 2 = G.degree a ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
congr 1 e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ (∑ b, if a ∈ G.neighborFinset b then 1 else 0) = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
-- Want: `∑ b, ite (a ∈ N(b)) 1 0 = G.degree a`.
rw [Finset.sum_ite, e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ ∑ x with a ∈ G.neighborFinset x, 1 + ∑ x with a ∉ G.neighborFinset x, 0 = G.degree a e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 Finset.sum_const, e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} • 1 + ∑ x with a ∉ G.neighborFinset x, 0 = G.degree ae_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 Finset.sum_const_zero, e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} • 1 + 0 = G.degree ae_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 add_zero, e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} • 1 = G.degree ae_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
smul_eq_mul, e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} * 1 = G.degree ae_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 mul_one e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree ae_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2]e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = G.degree a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
rw [← card_neighborFinset_eq_degree e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = #(G.neighborFinset a) e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = #(G.neighborFinset a) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2]e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ #{x | a ∈ G.neighborFinset x} = #(G.neighborFinset a) W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
congr 1 e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univ⊢ {x | a ∈ G.neighborFinset x} = G.neighborFinset a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
ext b e_a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.Adja:Wa✝:a ∈ univb:W⊢ b ∈ {x | a ∈ G.neighborFinset x} ↔ b ∈ G.neighborFinset a W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
simp [mem_neighborFinset, adj_comm] W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2 W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
-- Cast to ℝ.
have := congrArg (Nat.cast (R := ℝ)) hNat W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2this:↑(∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ↑(∑ a, G.degree a ^ 2)⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
simp only [Nat.cast_sum, Nat.cast_pow] at this W:Type u_3inst✝²:Fintype Winst✝¹:DecidableEq WG:SimpleGraph Winst✝:DecidableRel G.AdjhNat:∑ p, #(G.neighborFinset p.1 ∩ G.neighborFinset p.2) = ∑ a, G.degree a ^ 2this:∑ x, ↑(#(G.neighborFinset x.1 ∩ G.neighborFinset x.2)) = ∑ x, ↑(G.degree x) ^ 2⊢ ∑ p, ↑(#(G.neighborFinset p.1 ∩ G.neighborFinset p.2)) = ∑ a, ↑(G.degree a) ^ 2
exact this All goals completed! 🐙open scoped Classical in
Case H = K_{2,2} (four-cycle, also called C_4): Sidorenko's conjecture holds, by
Cauchy–Schwarz.
The textbook statement at H = K_{2,2} is
t(K_2, G)^{e(K_{2,2})} = t(K_2, G)^4 ≤ t(K_{2,2}, G).
Proof sketch. Write d(a) := G.degree a. Then
homCount(K_2, G) = ∑_a d(a) = 2·|E(G)| (handshaking).
homCount(K_{2,2}, G) = ∑_{b₀, b₁} |N(b₀) ∩ N(b₁)|² (product structure of bipartite
homomorphism).
∑_{b₀, b₁} |N(b₀) ∩ N(b₁)| = ∑_a d(a)² (swap sums).
Cauchy–Schwarz #1: (∑_{b₀, b₁} |N(b₀) ∩ N(b₁)|)² ≤ |W|² · ∑_{b₀, b₁} |N(b₀) ∩ N(b₁)|².
Cauchy–Schwarz #2: (∑_a d(a))² ≤ |W| · ∑_a d(a)².
Chain: (∑_a d(a))⁴ ≤ |W|⁴ · homCount(K_{2,2}, G).
Divide by |W|^8 to get t(K_2, G)^4 ≤ t(K_{2,2}, G).
The proof uses Finset.sum_mul_sq_le_sq_mul_sq (discrete Cauchy–Schwarz) from
Mathlib.Algebra.Order.BigOperators.Ring.Finset.
Status (2026-04-22): main theorem closed sorry-free. See [Si93].