File size: 1,909 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
import Mathlib

namespace OAI

/-!
# Deficit charges in the finite-tree separation induction

The exact deficit charges are those of `prop:finite-separation`.
-/

namespace TreeEdit.BinaryLower.FiniteTree

/-- At least half the children each charge `q` unmatched symbols. -/
theorem row_deficit_charge {m : β„•} (bad : Finset (Fin m))
    (Ξ΄ : Fin m β†’ ℝ) (q : ℝ) (hq : 0 ≀ q)
    (hnonneg : βˆ€ i, 0 ≀ Ξ΄ i) (hbad : βˆ€ i ∈ bad, q ≀ Ξ΄ i)
    (hhalf : m ≀ 2 * bad.card) :
    (m : ℝ) * q / 2 ≀ βˆ‘ i, Ξ΄ i := by
  classical
  have hpoint (i : Fin m) : (if i ∈ bad then q else 0) ≀ Ξ΄ i := by
    split_ifs with hi
    Β· exact hbad i hi
    Β· exact hnonneg i
  have hsum := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hpoint i)
  have hcalc : (βˆ‘ i : Fin m, if i ∈ bad then q else 0) = (bad.card : ℝ) * q := by
    simp
  rw [hcalc] at hsum
  have hmR : (m : ℝ) ≀ 2 * (bad.card : ℝ) := by exact_mod_cast hhalf
  nlinarith [mul_le_mul_of_nonneg_right hmR hq]

/-- The chosen row charge is no larger than the tagged transition gap. -/
theorem finite_charge_le_gap (m h : β„•) (hm : 2 ≀ m) (B : ℝ) (hB : 0 ≀ B) :
    (m : ℝ) * (B / (4 : ℝ) ^ h) / 2 ≀ ((m : ℝ) - 1) * B := by
  have hp : (1 : ℝ) ≀ (4 : ℝ) ^ h := one_le_powβ‚€ (by norm_num)
  have hp0 : 0 < (4 : ℝ) ^ h := by positivity
  have hq : B / (4 : ℝ) ^ h ≀ B := by
    apply (div_le_iffβ‚€ hp0).2
    nlinarith
  have hmR : (2 : ℝ) ≀ m := by exact_mod_cast hm
  have hm0 : (0 : ℝ) ≀ m := Nat.cast_nonneg _
  nlinarith [mul_le_mul_of_nonneg_left hq hm0]

/-- Half the total row charge is exactly the next `4⁻ʰ` separation scale. -/
theorem finite_charge_identity (m T h : β„•) (B : ℝ) :
    (T : ℝ) * ((m : ℝ) * (B / (4 : ℝ) ^ h) / 2) / 2 =
      ((m : ℝ) * T * B) / (4 : ℝ) ^ (h + 1) := by
  rw [pow_succ]
  ring

end TreeEdit.BinaryLower.FiniteTree

end OAI