File size: 6,240 Bytes
f0f05de | 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | import OAI.Combinatorics.BalancedRyser.Incidence.AlignedGeneratorIncidence
import OAI.Combinatorics.BalancedRyser.Local.AlignedHistoryKernel
import OAI.Combinatorics.BalancedRyser.Local.InjectionExposureMixture
import OAI.Combinatorics.BalancedRyser.Local.LocalInjectionFreeLaw
import OAI.Combinatorics.BalancedRyser.Local.LocalPrescribedGeometry
namespace OAI
namespace Balanced.Local.AlignedGlobal
open RootChildPartition InjectionExposure TokenExposure UsedEventUnion
noncomputable section
open scoped Classical
variable {F : Type*} [Field F] [Fintype F] [DecidableEq F]
variable {b κ : ℕ}
omit [Fintype F] [DecidableEq F] in
theorem constituent_eq_purposeful_line (P : EqualityPattern b κ)
(a : DirectionAssignment F b κ) (ha : Eligible P a)
(bits : Bits b) (M : MergedPairs F) (i : Fin b) (j : Fin 4) (s : Bool) :
constituent M (a.2 (P.classOf i j)) s =
lineThrough (a.2 (P.classOf i j))
(prescribedPoint P a bits M (i,purposefulIndex (bits i) j s)) := by
apply line_eq_lineThrough
unfold purposefulIndex
split_ifs with hs
· simpa only [hs] using PrescribedGeometry.prescribedPoint_on_left (M := M) ha i j
· have hs' : s = !(bits i j) := by
cases s <;> cases h : bits i j <;> simp_all
have hj : j - 1 + 1 = j := by fin_cases j <;> decide
simpa only [hj, hs'] using
PrescribedGeometry.prescribedPoint_on_right (M := M) ha i (j-1)
variable [Nonempty (DirectionToken b κ ↪ Direction F)]
theorem global_later_generator_probability_le
(P : EqualityPattern b κ) (hκ : κ ≤ 2)
(R S : Finset (Fin b)) (hD : (dependentOccurrences P R).card = 2*κ)
(hS : S ⊆ R ∨ R ⊆ S) (bits : Bits b) (p : Point F) (i : Fin b)
(hphase : i ∈ R ∨ R ⊆ S)
(K : Finset (DirectionToken b κ))
(hKt : ∀ r ∈ S, Sum.inl r ∈ K)
(hKg : ∀ c ∈ S.biUnion P.classSet, Sum.inr c ∈ K)
(hi : Sum.inl i ∈ K) (j : Fin 4)
(hnew : Sum.inr (P.classOf i j) ∉ K) (s : Bool)
(r : {r : Fin b // r ∈ S}) (t : Fin 4)
(hK : K.card ≤ 5*b) (hb : 10*b ≤ Fintype.card F) :
injectionFreeProbability P R (fun e x =>
let a := (tokenInjectionEquiv F b κ e).1
let M := injectedGenerated P hκ R hD bits p e x
prescribedPoint P a bits M (i,purposefulIndex (bits i) j s) ≠
prescribedPoint P a bits M (r.1,t) ∧
OnLine (prescribedPoint P a bits M (r.1,t))
(constituent M (a.2 (P.classOf i j)) s)) ≤
2 / (Fintype.card F : ℝ) := by
let noise := currentNoise P hκ R S hD bits p i
let endpoint := fun z : (FreeIndex P R → F) ×
(PrefixData F P S × (Fin 4 → Point F)) =>
z.2.2 (purposefulIndex (bits i) j s)
let previous := fun z : (FreeIndex P R → F) ×
(PrefixData F P S × (Fin 4 → Point F)) => z.2.1.1 r t
let E : Set ((DirectionToken b κ ↪ Direction F) ×
((FreeIndex P R → F) × (PrefixData F P S × (Fin 4 → Point F)))) :=
{ez | endpoint ez.2 ≠ previous ez.2 ∧
OnLine (previous ez.2) (lineThrough (ez.1 (Sum.inr (P.classOf i j))) (endpoint ez.2))}
have hbound : (((PMF.uniformOfFintype (DirectionToken b κ ↪ Direction F)).bind
(fun e => (noise e).map (fun z => (e,z)))).toOuterMeasure E).toReal ≤
2 / (Fintype.card F : ℝ) := by
apply original_probability_le_of_auxiliary K noise E
intro base
exact (auxiliary_guarded_joining_probability_le K base
(Sum.inr (P.classOf i j)) hnew noise
(currentNoise_dependsOnExposed P hκ R S hD hS bits p i hphase K hKt hKg hi)
endpoint previous).trans
(inverse_remaining_le_two_div (Fintype.card F) K.card b Fintype.card_pos hK hb)
have hevent : (fun e x =>
let a := (tokenInjectionEquiv F b κ e).1
let M := injectedGenerated P hκ R hD bits p e x
prescribedPoint P a bits M (i,purposefulIndex (bits i) j s) ≠
prescribedPoint P a bits M (r.1,t) ∧
OnLine (prescribedPoint P a bits M (r.1,t))
(constituent M (a.2 (P.classOf i j)) s)) =
(fun e x =>
let a := (tokenInjectionEquiv F b κ e).1
let M := injectedGenerated P hκ R hD bits p e x
prescribedPoint P a bits M (i,purposefulIndex (bits i) j s) ≠
prescribedPoint P a bits M (r.1,t) ∧
OnLine (prescribedPoint P a bits M (r.1,t))
(lineThrough (e (Sum.inr (P.classOf i j)))
(prescribedPoint P a bits M (i,purposefulIndex (bits i) j s)))) := by
funext e x
dsimp only
rw [constituent_eq_purposeful_line P _
(allTokensDistinct_eligible P _ (tokenInjectionEquiv F b κ e).2)]
rfl
rw [hevent]
unfold injectionFreeProbability
rw [UniformConditionalProduct.uniform_product_eq_bind]
simpa only [noise, currentNoise, E, endpoint, previous, PMF.map_comp,
PMF.toOuterMeasure_bind_apply, PMF.toOuterMeasure_map_apply,
Set.preimage_ofPred_eq, prefixObservation, injectedGenerated, Function.comp_apply] using hbound
theorem geometricUsedTest_later_generator_le
(P : EqualityPattern b κ) (hκ : κ ≤ 2)
(R S : Finset (Fin b)) (hD : (dependentOccurrences P R).card = 2*κ)
(hS : S ⊆ R ∨ R ⊆ S) (bits : Bits b) (p : Point F) (i : Fin b)
(hphase : i ∈ R ∨ R ⊆ S)
(K : Finset (DirectionToken b κ))
(hKt : ∀ r ∈ S, Sum.inl r ∈ K)
(hKg : ∀ c ∈ S.biUnion P.classSet, Sum.inr c ∈ K)
(hi : Sum.inl i ∈ K) (j : Fin 4)
(hnew : Sum.inr (P.classOf i j) ∉ K) (s : Bool)
(r : {r : Fin b // r ∈ S}) (t : Fin 4)
(hK : K.card ≤ 5*b) (hb : 10*b ≤ Fintype.card F) :
injectionFreeProbability P R (fun e x =>
geometricUsedTest P (tokenInjectionEquiv F b κ e).1 bits p
(P.classOf i j) (r.1,t) s (injectedGenerated P hκ R hD bits p e x)) ≤
2 / (Fintype.card F : ℝ) := by
apply le_trans _ (global_later_generator_probability_le P hκ R S hD hS bits p i
hphase K hKt hKg hi j hnew s r t hK hb)
apply ENNReal.toReal_mono
· rw [PMF.toOuterMeasure_apply]
exact PMF.tsum_coe_indicator_ne_top _ _
· apply PMF.toOuterMeasure_mono
intro ex hx
refine ⟨?_, hx.1.2.2⟩
intro heq
have hip := hx.1.1.2.1 heq
have hir : i = r.1 := congrArg Prod.fst hip
exact hx.1.2.1 j (by simp only [hir])
end
end Balanced.Local.AlignedGlobal
end OAI
|