math / data /lean /OAI /Algebra /GroupRing /BallCount.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
7.5 kB
import Mathlib
namespace OAI
section
/-!
The uniform maximum-degree exclusion bound for finite graph balls.
This treats labelled port graphs too: `neighbors` forgets multiplicities;
loops and multiple edges only decrease the number of distinct vertices.
-/
namespace TorsionFreeZeroDivisors.BallCount
open scoped BigOperators
noncomputable section
variable {V : Type*} [DecidableEq V]
/-- Endpoints of walks of exactly k steps. -/
def ends (neighbors : V β†’ Finset V) (x : V) : β„• β†’ Finset V
| 0 => {x}
| k + 1 => (ends neighbors x k).biUnion neighbors
/-- Finite closed combinatorial ball. -/
def ball (neighbors : V β†’ Finset V) (x : V) (r : β„•) : Finset V :=
(Finset.range (r + 1)).biUnion (ends neighbors x)
theorem card_ends_le (neighbors : V β†’ Finset V) (d : β„•)
(hd : βˆ€ v, (neighbors v).card ≀ d) (x : V) (k : β„•) :
(ends neighbors x k).card ≀ d ^ k := by
induction k with
| zero => simp [ends]
| succ k ih =>
calc
(ends neighbors x (k+1)).card ≀
βˆ‘ v ∈ ends neighbors x k, (neighbors v).card := Finset.card_biUnion_le
_ ≀ βˆ‘ _v ∈ ends neighbors x k, d := Finset.sum_le_sum fun v _ => hd v
_ = (ends neighbors x k).card * d := by simp
_ ≀ d^k * d := Nat.mul_le_mul_right d ih
_ = d^(k+1) := (pow_succ d k).symm
/-- A non-asymptotic geometric-sum bound. -/
theorem sum_powers_le (d r : β„•) (hd : 2 ≀ d) :
βˆ‘ k ∈ Finset.range (r+1), d^k ≀ 2 * d^r - 1 := by
induction r with
| zero => simp
| succ r ih =>
rw [Finset.sum_range_succ, pow_succ]
have hp : 0 < d^r := pow_pos (by omega) _
have hm : 2 * d^r ≀ d^r*d := by nlinarith
omega
theorem card_ball_le (neighbors : V β†’ Finset V) (d : β„•) (h2 : 2 ≀ d)
(hd : βˆ€ v, (neighbors v).card ≀ d) (x : V) (r : β„•) :
(ball neighbors x r).card ≀ d^(r+1) := by
calc
(ball neighbors x r).card ≀ βˆ‘ k ∈ Finset.range (r+1), (ends neighbors x k).card :=
Finset.card_biUnion_le
_ ≀ βˆ‘ k ∈ Finset.range (r+1), d^k :=
Finset.sum_le_sum fun k _ => card_ends_le neighbors d hd x k
_ ≀ 2 * d^r - 1 := sum_powers_le d r h2
_ ≀ d^(r+1) := by
rw [pow_succ]
have hm : 2*d^r ≀ d^r*d := by simpa [Nat.mul_comm] using Nat.mul_le_mul_left (d^r) h2
omega
@[simp] theorem mem_ball_iff (neighbors : V β†’ Finset V) (x y : V) (r : β„•) :
y ∈ ball neighbors x r ↔ βˆƒ k ≀ r, y ∈ ends neighbors x k := by
simp [ball]
theorem self_mem_ball (neighbors : V β†’ Finset V) (x : V) (r : β„•) :
x ∈ ball neighbors x r := by
rw [mem_ball_iff]
exact ⟨0,Nat.zero_le _,by simp [ends]⟩
/-- Forgetting parallel edges is sound for the endpoint bound. -/
theorem port_degree_bound {T : Type*} (outgoing : V β†’ Finset T) (next : V β†’ T β†’ V)
(d : β„•) (hd : βˆ€ v, (outgoing v).card ≀ d) (v : V) :
((outgoing v).image (next v)).card ≀ d :=
(Finset.card_image_le).trans (hd v)
/-- The ordinary finite neighbor set, with its classical finiteness data fixed. -/
def graphNeighbors [Fintype V] (G : SimpleGraph V) (v : V) : Finset V := by
classical
exact G.neighborFinset v
omit [DecidableEq V] in
@[simp] theorem mem_graphNeighbors [Fintype V] (G : SimpleGraph V) (a b : V) :
b ∈ graphNeighbors G a ↔ G.Adj a b := by
classical
simp [graphNeighbors]
omit [DecidableEq V] in
theorem card_graphNeighbors [Fintype V] (G : SimpleGraph V) (v : V) :
(graphNeighbors G v).card = Nat.card (G.neighborSet v) := by
classical
rw [Nat.card_eq_fintype_card, SimpleGraph.card_neighborSet_eq_degree]
exact SimpleGraph.card_neighborFinset_eq_degree G v
/-- The finite combinatorial balls contain all walk endpoints, not just paths. -/
theorem mem_ends_of_walk [Fintype V] (G : SimpleGraph V) {a b : V} (p : G.Walk a b) :
b ∈ ends (graphNeighbors G) a p.length := by
classical
induction p using SimpleGraph.Walk.concatRec with
| Hnil => simp [ends]
| @Hconcat a b c p h ih =>
simp only [SimpleGraph.Walk.length_concat,ends,Finset.mem_biUnion]
exact ⟨b,ih,by simpa using h⟩
theorem mem_ball_of_walk [Fintype V] (G : SimpleGraph V) {a b : V}
(p : G.Walk a b) (r : β„•) (hr : p.length ≀ r) : b ∈ ball (graphNeighbors G) a r := by
exact mem_ball_iff _ _ _ _ |>.mpr ⟨p.length,hr,mem_ends_of_walk G p⟩
theorem far_of_not_mem_ball [Fintype V] (G : SimpleGraph V) {a b : V} (r : β„•)
(h : b βˆ‰ ball (graphNeighbors G) a r) (p : G.Walk a b) : r < p.length := by
by_contra hn
exact h (mem_ball_of_walk G p r (by omega))
section Matchings
variable {X Y : Type*} [Fintype X] [DecidableEq X]
/-- Removing source and target ports in a bad vertex set discards at most twice
its cardinality, since each labelled carrier embeds in the vertex set. -/
theorem matching_bad_card (f : X ≃ Y) (locX : X β†’ V) (locY : Y β†’ V)
(hX : Function.Injective locX) (hY : Function.Injective locY) (B : Finset V) :
(Finset.univ.filter (fun u => locX u ∈ B ∨ locY (f u) ∈ B)).card ≀ 2 * B.card := by
classical
have hx : (Finset.univ.filter (fun u => locX u ∈ B)).card ≀ B.card := by
apply Finset.card_le_card_of_injOn locX
Β· intro u hu; exact (Finset.mem_filter.mp hu).2
Β· exact hX.injOn
have hy : (Finset.univ.filter (fun u => locY (f u) ∈ B)).card ≀ B.card := by
apply Finset.card_le_card_of_injOn (fun u => locY (f u))
Β· intro u hu; exact (Finset.mem_filter.mp hu).2
Β· exact (hY.comp f.injective).injOn
rw [Finset.filter_or]
exact (Finset.card_union_le _ _).trans (by omega)
/-- A labelled matching has uniformly many choices outside both endpoint balls
and outside a prescribed set. This is the quantitative geometric input to the
conditioned transposition injection. -/
theorem admissible_card (f : X ≃ Y) (locX : X β†’ V) (locY : Y β†’ V)
(hX : Function.Injective locX) (hY : Function.Injective locY)
(neighbors : V β†’ Finset V) (d : β„•) (h2 : 2 ≀ d)
(hd : βˆ€ v, (neighbors v).card ≀ d) (x y : V) (r : β„•) (P : Finset X) :
Fintype.card X - P.card - 4*d^(r+1) ≀
(Finset.univ.filter (fun u => u βˆ‰ P ∧
locX u βˆ‰ ball neighbors x r βˆͺ ball neighbors y r ∧
locY (f u) βˆ‰ ball neighbors x r βˆͺ ball neighbors y r)).card := by
classical
let B := ball neighbors x r βˆͺ ball neighbors y r
let bad := Finset.univ.filter (fun u => locX u ∈ B ∨ locY (f u) ∈ B)
have hb : bad.card ≀ 4*d^(r+1) := by
have hb' := matching_bad_card f locX locY hX hY B
have hB : B.card ≀ 2*d^(r+1) :=
(Finset.card_union_le _ _).trans (by
have hx := card_ball_le neighbors d h2 hd x r
have hy := card_ball_le neighbors d h2 hd y r
omega)
exact hb'.trans (by omega)
have he : Finset.univ.filter (fun u => u βˆ‰ P ∧ locX u βˆ‰ B ∧ locY (f u) βˆ‰ B) =
Finset.univ \ (P βˆͺ bad) := by
ext u
simp [bad, not_or]
change _ ≀ (Finset.univ.filter (fun u => u βˆ‰ P ∧ locX u βˆ‰ B ∧ locY (f u) βˆ‰ B)).card
rw [he,Finset.card_sdiff_of_subset (Finset.subset_univ _),Finset.card_univ]
have hu := Finset.card_union_le P bad
omega
end Matchings
end
end TorsionFreeZeroDivisors.BallCount
/-!
A faithful simple-graph encoding of the manuscript's labelled multigraphs.
An original edge has two opposite ports, and its threefold subdivision is
original vertex -- port -- opposite port -- original vertex. Loops become
triangles and parallel edges remain distinct, so neither is silently discarded.
-/
end
end OAI