Download data/lean/OAI/Combinatorics/CliqueFree/WeightedGraph.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 7.88 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CliqueFree/WeightedGraph.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/CliqueFree/WeightedGraph.lean
-
curl -L -o WeightedGraph.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CliqueFree/WeightedGraph.lean
7.88 kB
| import OAI.Combinatorics.CliqueFree.Numerical | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators | |
| open Finset | |
| attribute [local instance] Classical.propDecidable | |
| namespace CliqueFreeIndependence.WeightedGraph | |
| universe u v | |
| variable {V : Type u} [Fintype V] | |
| def mass (w : V β β) (A : Finset V) : β := β v β A, w v | |
| noncomputable def neighbors (G : SimpleGraph V) (v : V) : Finset V := by | |
| classical | |
| exact univ.filter (G.Adj v) | |
| @[simp] lemma mem_neighbors (G : SimpleGraph V) (u v : V) : | |
| v β neighbors G u β G.Adj u v := by | |
| classical | |
| simp [neighbors] | |
| noncomputable def crossMass (G : SimpleGraph V) (w : V β β) (A B : Finset V) : β := by | |
| classical | |
| exact β u β A, β v β B, if G.Adj u v then w u * w v else 0 | |
| /-- Unordered edge mass, written as half the directed edge mass. -/ | |
| noncomputable def edgeMass (G : SimpleGraph V) (w : V β β) : β := | |
| crossMass G w univ univ / 2 | |
| noncomputable def neighborMass (G : SimpleGraph V) (w : V β β) (u : V) : β := | |
| mass w (neighbors G u) | |
| noncomputable def commonMass (G : SimpleGraph V) (w : V β β) (u v : V) : β := by | |
| classical | |
| exact mass w (neighbors G u β© neighbors G v) | |
| /-- Twice the triangle mass in the weighted neighborhood of u. -/ | |
| noncomputable def triangleAt (G : SimpleGraph V) (w : V β β) (u : V) : β := | |
| β v β neighbors G u, w v * commonMass G w u v | |
| /-- Unordered triangle mass, written as one sixth of the ordered triangle mass. -/ | |
| noncomputable def triangleMass (G : SimpleGraph V) (w : V β β) : β := | |
| (β u, w u * triangleAt G w u) / 6 | |
| /-- The growth function `g_x`, including its zero convention. Only nonnegative `s` are used. -/ | |
| noncomputable def growth (x s : β) : β := s * (x + max 0 (Real.log (1 / s))) | |
| /-- The full cross-mass property; sets may overlap. -/ | |
| def CrossBound (G : SimpleGraph V) (w : V β β) (C : β) : Prop := | |
| β (x : β), 1 β€ x β β (A B : Finset V), | |
| mass w A β€ Real.exp x β mass w B β€ Real.exp x β | |
| crossMass G w A B β€ C * growth x (mass w A) | |
| omit [Fintype V] in | |
| lemma mass_nonneg {w : V β β} (hw : β v, 0 β€ w v) (A : Finset V) : | |
| 0 β€ mass w A := sum_nonneg fun v _ β¦ hw v | |
| omit [Fintype V] in | |
| lemma mass_mono {w : V β β} (hw : β v, 0 β€ w v) {A B : Finset V} (hAB : A β B) : | |
| mass w A β€ mass w B := sum_le_sum_of_subset_of_nonneg hAB (fun v _ _ β¦ hw v) | |
| omit [Fintype V] in | |
| lemma crossMass_symm (G : SimpleGraph V) (w : V β β) (A B : Finset V) : | |
| crossMass G w A B = crossMass G w B A := by | |
| classical | |
| unfold crossMass | |
| rw [sum_comm] | |
| simp_rw [G.adj_comm, mul_comm] | |
| omit [Fintype V] in | |
| lemma crossMass_nonneg (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) | |
| (A B : Finset V) : 0 β€ crossMass G w A B := by | |
| classical | |
| exact sum_nonneg fun u _ β¦ sum_nonneg fun v _ β¦ by | |
| split_ifs | |
| Β· exact mul_nonneg (hw u) (hw v) | |
| Β· exact le_rfl | |
| omit [Fintype V] in | |
| lemma crossMass_le_product (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) | |
| (A B : Finset V) : crossMass G w A B β€ mass w A * mass w B := by | |
| classical | |
| unfold crossMass mass | |
| rw [sum_mul_sum] | |
| exact sum_le_sum fun u _ β¦ sum_le_sum fun v _ β¦ by | |
| split_ifs | |
| Β· exact le_rfl | |
| Β· exact mul_nonneg (hw u) (hw v) | |
| lemma crossMass_factor (G : SimpleGraph V) (w : V β β) (A B : Finset V) : | |
| crossMass G w A B = β u β A, w u * mass w (B β© neighbors G u) := by | |
| classical | |
| unfold crossMass mass | |
| apply sum_congr rfl | |
| intro u _ | |
| rw [β filter_mem_eq_inter] | |
| simp only [sum_filter, mem_neighbors, mul_sum, mul_ite, mul_zero] | |
| lemma commonMass_comm (G : SimpleGraph V) (w : V β β) (u v : V) : | |
| commonMass G w u v = commonMass G w v u := by | |
| classical | |
| simp [commonMass, inter_comm] | |
| lemma commonMass_nonneg (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) (u v : V) : | |
| 0 β€ commonMass G w u v := mass_nonneg hw _ | |
| lemma neighborMass_nonneg (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) (u : V) : | |
| 0 β€ neighborMass G w u := mass_nonneg hw _ | |
| lemma commonMass_le_neighborMass (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) | |
| (u v : V) : commonMass G w u v β€ neighborMass G w u := by | |
| classical | |
| exact mass_mono hw inter_subset_left | |
| lemma edgeMass_nonneg (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) : | |
| 0 β€ edgeMass G w := div_nonneg (crossMass_nonneg G hw _ _) (by norm_num) | |
| lemma triangleAt_nonneg (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) (u : V) : | |
| 0 β€ triangleAt G w u := | |
| sum_nonneg fun v _ β¦ mul_nonneg (hw v) (commonMass_nonneg G hw u v) | |
| lemma triangleMass_nonneg (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) : | |
| 0 β€ triangleMass G w := div_nonneg | |
| (sum_nonneg fun u _ β¦ mul_nonneg (hw u) (triangleAt_nonneg G hw u)) (by norm_num) | |
| lemma edgeMass_eq_sum (G : SimpleGraph V) (w : V β β) : | |
| 2 * edgeMass G w = β u, w u * neighborMass G w u := by | |
| classical | |
| rw [edgeMass, crossMass_factor] | |
| simp only [univ_inter, neighborMass] | |
| ring | |
| lemma triangleMass_eq_sum (G : SimpleGraph V) (w : V β β) : | |
| 6 * triangleMass G w = β u, w u * triangleAt G w u := by | |
| unfold triangleMass | |
| ring | |
| lemma triangleAt_le (G : SimpleGraph V) {w : V β β} (hw : β v, 0 β€ w v) | |
| {L : β} (hL : β u, neighborMass G w u β€ L) (u : V) : | |
| triangleAt G w u β€ L * neighborMass G w u := by | |
| calc | |
| _ β€ β v β neighbors G u, w v * L := sum_le_sum fun v _ β¦ | |
| mul_le_mul_of_nonneg_left ((commonMass_le_neighborMass G hw u v).trans (hL u)) (hw v) | |
| _ = _ := by rw [β sum_mul]; exact mul_comm _ _ | |
| lemma triangleMass_le_of_neighborMass (G : SimpleGraph V) {w : V β β} | |
| (hw : β v, 0 β€ w v) {L : β} (hL : β u, neighborMass G w u β€ L) : | |
| triangleMass G w β€ L / 3 * edgeMass G w := by | |
| have h : 6 * triangleMass G w β€ L * (2 * edgeMass G w) := by | |
| rw [triangleMass_eq_sum, edgeMass_eq_sum, mul_sum] | |
| exact sum_le_sum fun u _ β¦ by | |
| have := mul_le_mul_of_nonneg_left (triangleAt_le G hw hL u) (hw u) | |
| nlinarith | |
| linarith | |
| lemma neighborMass_ge_of_commonMass (G : SimpleGraph V) {w : V β β} | |
| (hw : β v, 0 β€ w v) {Ο : β} (hc : β u v, G.Adj u v β Ο β€ commonMass G w u v) | |
| {u : V} (hu : (neighbors G u).Nonempty) : Ο β€ neighborMass G w u := by | |
| rcases hu with β¨v, hvβ© | |
| exact (hc u v (mem_neighbors G u v |>.1 hv)).trans (commonMass_le_neighborMass G hw u v) | |
| lemma triangleAt_ge_of_commonMass (G : SimpleGraph V) {w : V β β} | |
| (hw : β v, 0 β€ w v) {Ο : β} (hc : β u v, G.Adj u v β Ο β€ commonMass G w u v) | |
| (u : V) : Ο * neighborMass G w u β€ triangleAt G w u := by | |
| calc | |
| _ = β v β neighbors G u, w v * Ο := by rw [β sum_mul]; exact mul_comm _ _ | |
| _ β€ _ := sum_le_sum fun v hv β¦ mul_le_mul_of_nonneg_left | |
| (hc u v (mem_neighbors G u v |>.1 hv)) (hw v) | |
| lemma commonMass_eq_sum (G : SimpleGraph V) (w : V β β) (u v : V) : | |
| commonMass G w u v = β z β neighbors G u, if G.Adj v z then w z else 0 := by | |
| classical | |
| unfold commonMass mass | |
| rw [β filter_mem_eq_inter, sum_filter] | |
| simp only [mem_neighbors] | |
| lemma crossMass_all_right (G : SimpleGraph V) (w : V β β) (A : Finset V) : | |
| crossMass G w A univ = β u β A, w u * neighborMass G w u := by | |
| classical | |
| rw [crossMass_factor] | |
| simp [neighborMass] | |
| lemma crossMass_all_left (G : SimpleGraph V) (w : V β β) (A : Finset V) : | |
| crossMass G w univ A = β u β A, w u * neighborMass G w u := by | |
| rw [crossMass_symm, crossMass_all_right] | |
| lemma crossMass_neighbors (G : SimpleGraph V) (w : V β β) | |
| (A : Finset V) (v : V) : | |
| crossMass G w A (neighbors G v) = β u β A, w u * commonMass G w u v := by | |
| rw [crossMass_factor] | |
| simp only [commonMass, inter_comm] | |
| end CliqueFreeIndependence.WeightedGraph | |
| end | |
| end OAI | |