Download data/lean/OAI/NumberTheory/Ostmann/Tree/ComponentFactorial.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.08 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Tree/ComponentFactorial.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Ostmann/Tree/ComponentFactorial.lean
-
curl -L -o ComponentFactorial.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/Tree/ComponentFactorial.lean
4.08 kB
| import Mathlib.Data.Nat.Choose.Multinomial | |
| import Mathlib.Analysis.SpecialFunctions.Log.Basic | |
| import Mathlib.Tactic.Linarith | |
| namespace OAI | |
| /-! # Factorial costs of components in the arrangement graph -/ | |
| namespace Ostmann | |
| open scoped BigOperators | |
| /-- Assigning a*m labeled positions to a blocks gives the factorial | |
| inequality used in the count of bad arrangements. -/ | |
| theorem component_factorial_le (a m : β) : | |
| (a * m).factorial β€ m.factorial ^ a * a ^ (a * m) := by | |
| classical | |
| let s : Finset (Fin a) := Finset.univ | |
| let f : Fin a β β := fun _ => m | |
| have hmem : f β Finset.piAntidiag s (a * m) := by | |
| simp [Finset.mem_piAntidiag, s, f] | |
| have hsum : a ^ (a * m) = | |
| β k β s.piAntidiag (a * m), Nat.multinomial s k := by | |
| simpa [s] using | |
| (Finset.sum_pow_eq_sum_piAntidiag (R := β) s (fun _ => (1 : β)) (a * m)) | |
| have hb := Finset.single_le_sum (fun k (_ : k β Finset.piAntidiag s (a * m)) => | |
| Nat.zero_le (Nat.multinomial s k)) hmem | |
| rw [β hsum] at hb | |
| have hs := Nat.multinomial_spec s f | |
| simp only [s, f, Finset.prod_const, Finset.card_univ, Fintype.card_fin, | |
| Finset.sum_const, smul_eq_mul] at hs | |
| rw [β hs] | |
| exact Nat.mul_le_mul_left _ hb | |
| theorem component_log_cost (a r : β) (ha : 1 β€ a) (har : a β€ r) : | |
| a * Real.log a β€ (a - 1) * (Real.log r + 1) := by | |
| have ha0 : 0 < a := by linarith | |
| have hlog : Real.log a β€ Real.log r := Real.log_le_log ha0 har | |
| have hlog' : Real.log a β€ a - 1 := Real.log_le_sub_one_of_pos ha0 | |
| have hm := mul_le_mul_of_nonneg_left hlog (sub_nonneg.mpr ha) | |
| nlinarith | |
| /-- The sum of a-1 is exactly the number of leaves minus the number | |
| of components, so the entropy cost is controlled by this deficit. -/ | |
| theorem component_entropy_bound {I : Type*} [Fintype I] | |
| (a : I β β) (r : β) (ha : β i, 1 β€ a i) (hsum : β i, a i = r) : | |
| (β i, (a i : β) * Real.log (a i)) β€ | |
| ((r : β) - Fintype.card I) * (Real.log r + 1) := by | |
| have hle (i : I) : a i β€ r := by | |
| rw [β hsum] | |
| exact Finset.single_le_sum (fun _ _ => Nat.zero_le _) (Finset.mem_univ i) | |
| have hcost (i : I) := component_log_cost (a i) r | |
| (by exact_mod_cast ha i) (by exact_mod_cast hle i) | |
| calc | |
| _ β€ β i, ((a i : β) - 1) * (Real.log r + 1) := Finset.sum_le_sum fun i _ => hcost i | |
| _ = ((β i, (a i : β)) - Fintype.card I) * (Real.log r + 1) := by | |
| rw [β Finset.sum_mul, Finset.sum_sub_distrib] | |
| simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] | |
| _ = _ := by rw [β Nat.cast_sum, hsum] | |
| /-- Product of the component assignment counts, with the cost expressed | |
| through the deficit in the number of components. -/ | |
| theorem component_factorial_product_bound {I : Type*} [Fintype I] | |
| (a : I β β) (r m : β) (ha : β i, 1 β€ a i) (hsum : β i, a i = r) : | |
| (β i, ((a i * m).factorial : β)) β€ | |
| (m.factorial : β) ^ r * | |
| Real.exp ((m : β) * ((r : β) - Fintype.card I) * (Real.log r + 1)) := by | |
| classical | |
| have hp (i : I) : (a i : β) ^ (a i * m) = | |
| Real.exp ((m : β) * ((a i : β) * Real.log (a i))) := by | |
| have hi : 0 < (a i : β) := by exact_mod_cast lt_of_lt_of_le Nat.zero_lt_one (ha i) | |
| rw [show (m : β) * ((a i : β) * Real.log (a i)) = | |
| ((a i * m : β) : β) * Real.log (a i) by push_cast; ring, | |
| Real.exp_nat_mul, Real.exp_log hi] | |
| calc | |
| _ β€ β i, (m.factorial : β) ^ a i * (a i : β) ^ (a i * m) := by | |
| exact_mod_cast (Finset.prod_le_prod (fun i (_ : i β (Finset.univ : Finset I)) => | |
| component_factorial_le (a i) m)) | |
| _ = (m.factorial : β) ^ r * Real.exp ((m : β) * β i, (a i : β) * Real.log (a i)) := by | |
| simp_rw [hp] | |
| rw [Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum, hsum, | |
| β Real.exp_sum, β Finset.mul_sum] | |
| _ β€ _ := by | |
| apply mul_le_mul_of_nonneg_left _ (by positivity) | |
| apply Real.exp_le_exp.mpr | |
| simpa only [mul_assoc] using mul_le_mul_of_nonneg_left | |
| (component_entropy_bound a r ha hsum) (show 0 β€ (m : β) by positivity) | |
| end Ostmann | |
| end OAI | |