Download data/lean/OAI/Algebra/GroupRing/BallCount.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.5 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algebra/GroupRing/BallCount.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Algebra/GroupRing/BallCount.lean
-
curl -L -o BallCount.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Algebra/GroupRing/BallCount.lean
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 | |