File size: 4,203 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | import OAI.NumberTheory.Ostmann.Tree.PartitionMatching
import OAI.NumberTheory.Ostmann.Tree.ComponentFactorial
import OAI.NumberTheory.Ostmann.Tree.PartitionProducts
namespace OAI
/-! # Uniform counting bound for paired leaf partitions -/
namespace Ostmann
open scoped BigOperators Classical
abbrev BadPartitionPair (r t : β) :=
{fg : (Fin r β Fin t) Γ (Fin r β Fin t) //
Function.Surjective fg.1 β§ Function.Surjective fg.2 β§
(β c, Fintype.card {l : Fin r // fg.1 l = c} =
Fintype.card {l : Fin r // fg.2 l = c}) β§ 4 * (r - t) β€ r}
abbrev BadPartitionWitness (r : β) := Ξ£ t : Fin (r + 1), BadPartitionPair r t
abbrev BadPartitionWitness.Matching {r : β} (w : BadPartitionWitness r) (m : β) :=
PartitionMatching (fun x : Fin r Γ Fin m => w.2.1.1 x.1)
(fun x : Fin r Γ Fin m => w.2.1.2 x.1)
theorem card_badPartitionPair_le (r t : β) :
Fintype.card (BadPartitionPair r t) β€ t ^ (2 * r) := by
calc
_ β€ Fintype.card ((Fin r β Fin t) Γ (Fin r β Fin t)) :=
Fintype.card_le_of_injective Subtype.val Subtype.val_injective
_ = _ := by simp [Fintype.card_prod, pow_mul, pow_two, mul_pow]
theorem card_badPartitionWitness_le (r : β) :
Fintype.card (BadPartitionWitness r) β€ (r + 1) * r ^ (2 * r) := by
rw [Fintype.card_sigma]
calc
_ β€ β t : Fin (r + 1), r ^ (2 * r) := by
apply Finset.sum_le_sum
intro t _
exact (card_badPartitionPair_le r t).trans
(Nat.pow_le_pow_left (Nat.le_of_lt_succ t.isLt) _)
_ = _ := by simp
noncomputable def badPartitionCost (r m : β) : β :=
(m.factorial : β) ^ r * Real.exp ((m : β) * r * (Real.log r + 1) / 4)
theorem badPartitionCost_nonneg (r m : β) : 0 β€ badPartitionCost r m := by
unfold badPartitionCost
positivity
theorem badPartition_matching_bound {r : β} (hr : 1 β€ r)
(w : BadPartitionWitness r) (m : β) :
(Fintype.card (w.Matching m) : β) β€ badPartitionCost r m := by
let a : Fin w.1 β β := fun c => Fintype.card {l : Fin r // w.2.1.1 l = c}
have ha (c : Fin w.1) : 1 β€ a c := by
obtain β¨l, hlβ© := w.2.2.1 c
exact Fintype.card_pos_iff.mpr β¨β¨l, hlβ©β©
have hs : β c, a c = r := by
simpa only [Fintype.card_fin] using sum_card_partition w.2.1.1
have hc : (Fintype.card (w.Matching m) : β) β€
β c, ((a c * m).factorial : β) := by
have hbal := fun c => w.2.2.2.2.1 c
have h := card_slotMatching_le w.2.1.1 w.2.1.2 m
(fun c => by simpa only [Fintype.card_eq_nat_card] using hbal c)
have hnat : Fintype.card (w.Matching m) β€ β c, (a c * m).factorial := by
simpa only [a, Fintype.card_eq_nat_card] using h
exact_mod_cast hnat
have ht : (w.1 : β) β€ r := Nat.le_of_lt_succ w.1.isLt
have hd : 4 * ((r : β) - (w.1 : β)) β€ r := by
have h := w.2.2.2.2.2
have h' : (4 : β) * ((r - (w.1 : β) : β) : β) β€ r := by exact_mod_cast h
simpa only [Nat.cast_sub ht] using h'
have hl : 0 β€ Real.log (r : β) + 1 := by
have := Real.log_nonneg (show (1 : β) β€ r by exact_mod_cast hr)
linarith
apply hc.trans
apply (component_factorial_product_bound a r m ha hs).trans
unfold badPartitionCost
apply mul_le_mul_of_nonneg_left _ (by positivity)
apply Real.exp_le_exp.mpr
simp only [Fintype.card_fin]
have hh := mul_le_mul_of_nonneg_left hd
(mul_nonneg (show (0 : β) β€ m by positivity) hl)
nlinarith
/-- Sum over every possible pair of component partitions. The prefactor
depends only on r, and not on the number m of slots at a leaf. -/
theorem badPartition_total_bound {r : β} (hr : 1 β€ r) (m : β) :
(Fintype.card (Ξ£ w : BadPartitionWitness r, w.Matching m) : β) β€
((r + 1) * r ^ (2 * r) : β) * badPartitionCost r m := by
rw [Fintype.card_sigma, Nat.cast_sum]
calc
_ β€ β _w : BadPartitionWitness r, badPartitionCost r m :=
Finset.sum_le_sum fun w _ => badPartition_matching_bound hr w m
_ = (Fintype.card (BadPartitionWitness r) : β) * badPartitionCost r m := by simp
_ β€ _ := mul_le_mul_of_nonneg_right
(by exact_mod_cast card_badPartitionWitness_le r) (badPartitionCost_nonneg r m)
end Ostmann
end OAI
|