File size: 4,068 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
import Mathlib
import OAI.Probability.CriticalPercolation.Entropy.BinaryInverseCost
import OAI.Probability.CriticalPercolation.Entropy.BinaryReferenceLikelihood

namespace OAI

section
section
noncomputable section
namespace CriticalPercolation.BinaryLaw
open scoped Classical
open FiniteProduct BondGraph BinaryInterpolation ExactExposure FiniteEntropy MarkedBits

variable {V E : Type*} [Fintype V] [Fintype E]
local instance outputEntropyFinDec (n : β„•) : DecidableEq (Fin n) := Classical.decEq _
variable (G : BondGraph V E) (order : List (LazyDFS.Dart V E)) (d : β„•) (x : β„• β†’ V)
variable (p : ℝ) (w : E β†’ Prop β†’ ℝ) (s n : β„•) (D : FixedDescriptor n)

noncomputable def outputMass : (E β†’ Bool) β†’ ℝ :=
  pushMass (fun z => stage n D z.1 z.2 n) (conditionedMass G order d x p w s n D)

lemma inverseLog_expectation (Q : ((E β†’ Bool) Γ— (Fin n β†’ Option E)) β†’ ℝ) :
    (βˆ‘ z, Q z * inverseLog G order d x p w n D z.1 z.2) =
      2*(βˆ‘ i ∈ activeSteps n D, βˆ‘ z, Q z * Real.log (1+selectedCost G order d x p w n D i z.1 (z.2 i))) +
      βˆ‘ z, Q z * logContactMass (scheduleWeight G order d x p w n (fun j => (D j).1)) (configuration z.1) := by
  simp only [inverseLog,mul_add,Finset.sum_add_distrib]
  congr 1
  simp_rw [mul_left_comm (Q _) 2,Finset.mul_sum]
  rw [Finset.sum_comm]

theorem conditioned_output_entropy (horder : LazyDFS.GoodDarts G order)
    (ho : LazyDFS.Exhaustive G order) (hd : 0<d) (hp : p ∈ Set.Ioo 0 1)
    (h0 : βˆ€ e, w e False = 1-p) (h1 : βˆ€ e, w e True = p)
    {c : ℝ} (hc : 0<c) (hc1 : c≀1)
    (hconn : βˆ€ j, 0<j β†’ j<d β†’ c ≀ prob w (fun Ο‰ => (G.openGraph Ο‰).Reachable (x 0) (x j)))
    (hΞ΄ : 0 < prob w (endpointEvent G (x 0) (x d) s))
    (hD : 0 < descriptorMass G order d x p w s n D) :
    divergence (outputMass G order d x p w s n D) (FiniteProduct.density (QueryTree.bitWeight p)) ≀
      (4*(16/(2*p*(1-p)))+6)*constructionCost G order d x p w c s n D +
        (2*(16/(2*p*(1-p)))+5)*n*Real.log 4 := by
  let Q := conditionedMass G order d x p w s n D
  let ΞΌ : (E β†’ Bool) β†’ ℝ := FiniteProduct.density (QueryTree.bitWeight p)
  let L := constructionCost G order d x p w c s n D
  have hQ : βˆ€ z, 0 ≀ Q z := conditionedMass_nonneg G order d x p w s n hp h0 h1 hΞ΄ D hD
  have hQ1 : βˆ‘ z, Q z = 1 := by
    have he := conditionedMass_normalized G order d x p w s n D hD
    refine Eq.trans ?_ he
    apply Finset.sum_congr
    Β· ext z; simp only [Finset.mem_univ]
    Β· intro z _; rfl
  have hm := mapped_entropy_le Q hQ (recorded n D)
    (fun z z' hz hz' he => supported_opening_injective G order d x p w s n D z z' hz hz' he)
    Prod.fst (inverseReference G order d x p w n D)
    (inverseReference_nonneg G order d x p w n D hp h0 h1) ΞΌ
    (inverseReference_marginal G order d x p w n D hp h0 h1)
    (fun z => L+inverseLog G order d x p w n D z.1 z.2)
    (conditioned_reference_density_le G order d x p w n D s hd hp h0 h1 hc hc1 hconn hΞ΄ hD)
  have he : (βˆ‘ z, Q z*(L+inverseLog G order d x p w n D z.1 z.2)) =
      L + (2*(βˆ‘ i ∈ activeSteps n D, βˆ‘ z, Q z*Real.log (1+selectedCost G order d x p w n D i z.1 (z.2 i))) +
      βˆ‘ z, Q z*logContactMass (scheduleWeight G order d x p w n (fun j => (D j).1)) (configuration z.1)) := by
    simp only [mul_add,Finset.sum_add_distrib,← Finset.sum_mul,hQ1,one_mul]
    rw [inverseLog_expectation G order d x p w n D Q]
  rw [he] at hm
  have hi := conditioned_inverse_cost G order d x p w s n D horder ho hd hp h0 h1 hc hc1 hconn hΞ΄ hD
  have hl := (conditioned_configuration_entropy G order d x p w ho hd hp h0 h1 hc hc1 hconn s n D hΞ΄ hD).2
  change divergence (outputMass G order d x p w s n D) ΞΌ ≀ _ at hm
  change _ ≀ (4*(16/(2*p*(1-p)))+6)*L+(2*(16/(2*p*(1-p)))+5)*n*Real.log 4
  calc
    _ ≀ _ := hm
    _ ≀ L + (2*(((16/(2*p*(1-p)))*(2*L+n*Real.log 4))+2*L+2*n*Real.log 4) + (L+n*Real.log 4)) :=
      add_le_add (le_refl L) (add_le_add (mul_le_mul_of_nonneg_left hi (by norm_num : (0:ℝ) ≀ 2)) hl)
    _ = _ := by ring

end CriticalPercolation.BinaryLaw
end
end
end

end OAI