Download data/lean/OAI/Combinatorics/CliqueFree/EdgeState.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.31 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CliqueFree/EdgeState.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Combinatorics/CliqueFree/EdgeState.lean
-
curl -L -o EdgeState.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Combinatorics/CliqueFree/EdgeState.lean
5.31 kB
| import OAI.Combinatorics.CliqueFree.FiniteEntropy | |
| import OAI.Combinatorics.CliqueFree.WeightedGraph | |
| 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] | |
| /-- Oriented edges, the disjoint union of the neighborhood state spaces. -/ | |
| abbrev EdgeState (G : SimpleGraph V) := {e : V Γ V // G.Adj e.1 e.2} | |
| noncomputable instance edgeStateFintype (G : SimpleGraph V) : Fintype (EdgeState G) := | |
| Subtype.fintype _ | |
| local instance (priority := 10000) edgeStateDecEq (G : SimpleGraph V) : DecidableEq (EdgeState G) := | |
| Classical.decEq _ | |
| namespace EdgeState | |
| variable {G : SimpleGraph V} | |
| def src (e : EdgeState G) : V := e.val.1 | |
| def dst (e : EdgeState G) : V := e.val.2 | |
| omit [Fintype V] in | |
| @[simp] lemma adj (e : EdgeState G) : G.Adj e.src e.dst := e.property | |
| def rev (e : EdgeState G) : EdgeState G := β¨(e.dst, e.src), e.adj.symmβ© | |
| omit [Fintype V] in | |
| @[simp] lemma src_rev (e : EdgeState G) : e.rev.src = e.dst := rfl | |
| omit [Fintype V] in | |
| @[simp] lemma dst_rev (e : EdgeState G) : e.rev.dst = e.src := rfl | |
| omit [Fintype V] in | |
| @[simp] lemma rev_rev (e : EdgeState G) : e.rev.rev = e := by cases e; rfl | |
| def revEquiv : EdgeState G β EdgeState G where | |
| toFun := rev | |
| invFun := rev | |
| left_inv := rev_rev | |
| right_inv := rev_rev | |
| lemma sum_eq (f : V β V β β) : | |
| (β e : EdgeState G, f e.src e.dst) = β u, β v β neighbors G u, f u v := by | |
| classical | |
| change (β e : {e : V Γ V // G.Adj e.1 e.2}, f e.val.1 e.val.2) = _ | |
| rw [β Finset.sum_subtype (univ.filter fun e : V Γ V β¦ G.Adj e.1 e.2) | |
| (by simp) (fun e : V Γ V β¦ f e.1 e.2)] | |
| simp only [sum_filter, Fintype.sum_prod_type, neighbors] | |
| lemma sum_fiber (u : V) (f : V β β) : | |
| (β e : EdgeState G, if e.src = u then f e.dst else 0) = β v β neighbors G u, f v := by | |
| classical | |
| rw [sum_eq (fun a b β¦ if a = u then f b else 0)] | |
| simp | |
| lemma sum_fiber' (u : V) (f : V β β) : | |
| (β e : EdgeState G, if u = e.src then f e.dst else 0) = β v β neighbors G u, f v := by | |
| classical | |
| simpa only [eq_comm] using sum_fiber u f | |
| end EdgeState | |
| lemma growth_nonneg {x s : β} (hx : 0 β€ x) (hs : 0 β€ s) : 0 β€ growth x s := | |
| mul_nonneg hs (add_nonneg hx (le_max_left _ _)) | |
| @[simp] lemma growth_zero (x : β) : growth x 0 = 0 := by simp [growth] | |
| lemma growth_small {x s : β} (hs : 0 < s) (hs1 : s β€ 1) : | |
| growth x s = s * (x - Real.log s) := by | |
| have hl : Real.log s β€ 0 := Real.log_nonpos hs.le hs1 | |
| simp [growth, Real.log_inv, max_eq_right (neg_nonneg.2 hl), sub_eq_add_neg] | |
| lemma growth_large {x s : β} (hs : 1 β€ s) : growth x s = s * x := by | |
| have hl : 0 β€ Real.log s := Real.log_nonneg hs | |
| simp [growth, Real.log_inv, max_eq_left (neg_nonpos.2 hl)] | |
| lemma growth_mono {x : β} (hx : 1 β€ x) : MonotoneOn (growth x) (Set.Ici 0) := by | |
| intro a ha b hb hab | |
| change 0 β€ a at ha | |
| change 0 β€ b at hb | |
| rcases ha.eq_or_lt with ha | ha | |
| Β· rw [β ha, growth_zero] | |
| exact growth_nonneg (by linarith) hb | |
| have hb0 : 0 < b := ha.trans_le hab | |
| by_cases hb1 : b β€ 1 | |
| Β· rw [growth_small ha (hab.trans hb1), growth_small hb0 hb1] | |
| have hrel := FiniteEntropy.relTerm_nonneg ha.le hb0.le (fun _ β¦ hb0) | |
| rw [Real.log_div ha.ne' hb0.ne'] at hrel | |
| have hlog : Real.log b β€ 0 := Real.log_nonpos hb0.le hb1 | |
| have hmul := mul_nonneg (sub_nonneg.2 hab) (show 0 β€ x - 1 - Real.log b by linarith) | |
| nlinarith | |
| by_cases ha1 : 1 β€ a | |
| Β· rw [growth_large ha1, growth_large (le_of_not_ge hb1)] | |
| exact mul_le_mul_of_nonneg_right hab (by linarith) | |
| Β· rw [growth_small ha (le_of_not_ge ha1), growth_large (le_of_not_ge hb1)] | |
| have hrel := FiniteEntropy.relTerm_nonneg ha.le (by norm_num : (0:β) β€ 1) | |
| (fun _ β¦ by norm_num) | |
| simp only [div_one] at hrel | |
| have hamul := mul_nonneg (sub_nonneg.2 (le_of_not_ge ha1)) (show 0 β€ x - 1 by linarith) | |
| have hbmul := mul_nonneg (sub_nonneg.2 (le_of_not_ge hb1)) (show 0 β€ x by linarith) | |
| nlinarith | |
| lemma growth_le_twice {x s : β} (hx : 1 β€ x) (hs : 0 β€ s) : | |
| growth x s β€ 2 * x * (s + Real.exp (-x)) := by | |
| have hx0 : 0 β€ x := by linarith | |
| have hexp := Real.exp_pos (-x) | |
| have hi (b : β) (hb : Real.exp (-x) β€ b) : growth x b β€ 2 * x * b := by | |
| have hb0 := hexp.trans_le hb | |
| have hl : -Real.log b β€ x := by | |
| have := Real.log_le_log hexp hb | |
| rw [Real.log_exp] at this | |
| linarith | |
| have hmax : max 0 (-Real.log b) β€ x := max_le hx0 hl | |
| simp only [growth, one_div, Real.log_inv] | |
| nlinarith [mul_le_mul_of_nonneg_left hmax hb0.le] | |
| by_cases h : Real.exp (-x) β€ s | |
| Β· have h' := hi s h | |
| nlinarith [mul_nonneg hx0 hexp.le] | |
| Β· have h' := (growth_mono hx hs hexp.le (le_of_not_ge h)).trans (hi _ le_rfl) | |
| nlinarith [mul_nonneg hx0 hs] | |
| omit [Fintype V] in | |
| lemma mass_union_le {w : V β β} (hw : β v, 0 β€ w v) (A B : Finset V) : | |
| mass w (A βͺ B) β€ mass w A + mass w B := by | |
| have h := sum_union_inter (sβ := A) (sβ := B) (f := w) | |
| have hn := mass_nonneg hw (A β© B) | |
| change 0 β€ β u β A β© B, w u at hn | |
| change (β u β A βͺ B, w u) β€ (β u β A, w u) + β u β B, w u | |
| linarith | |
| end CliqueFreeIndependence.WeightedGraph | |
| end | |
| end OAI | |