File size: 4,850 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | import OAI.Probability.SATComputability.TrialDescriptions
namespace OAI
namespace FixedClauseThreshold.Computability
open DilutedSpinGlass _root_.MeasureTheory _root_.OAI.MeasureTheory ProbabilityTheory Nat.Partrec FiniteArithmetic
open PeriodicLattice.CertifiedReal RapidForcing.EffectiveArithmetic
open scoped NNReal
local instance effectiveTrialValuesRatPrimcodable : Primcodable β :=
PeriodicLattice.RecursiveArithmetic.ratPrimcodable
abbrev TrialData := β Γ β Γ Code Γ List β
noncomputable def guardedSiteExpression (t : TrialData) (k : β) : Code :=
if positiveExponents t.2.2.2 then
averagedSiteExpression (t.2.1 : β) t.2.2.1 t.2.2.2 k else .zero
attribute [local irreducible] averagedSiteExpression averagedEdgeExpression positiveExponents
@[fun_prop] theorem guardedSiteExpression_computable :
Computable (fun p : TrialData Γ β => guardedSiteExpression p.1 p.2) := by
have he : Computable (fun p : TrialData Γ β =>
averagedSiteExpression (p.1.2.1 : β) p.1.2.2.1 p.1.2.2.2 p.2) :=
averagedSiteExpression_computable.comp
(g := fun p : TrialData Γ β => (((p.1.2.1 : β),p.1.2.2.1,p.1.2.2.2),p.2))
(by fun_prop)
unfold guardedSiteExpression
fun_prop
noncomputable def guardedSiteValue (t : TrialData) (k : β) : β :=
expressionValue (guardedSiteExpression t k)
theorem guardedSiteValue_effective : Effective (fun p : TrialData Γ β => guardedSiteValue p.1 p.2) :=
expressionValue_effective.comp guardedSiteExpression_computable
theorem guardedSiteValue_bound (t : TrialData) (k : β) :
|guardedSiteValue t k| β€ (t.2.1 : β)*((k : β)+1) := by
unfold guardedSiteValue guardedSiteExpression
split_ifs with h
Β· have hp := (positiveExponents_iff t.2.2.2).mp h
apply (packetSiteValue_bound (Ξ² := (t.2.1 : β)) (by positivity)
t.2.2.1 t.2.2.2 hp k).trans
push_cast
nlinarith [show (0 : β) β€ t.2.1 from Nat.cast_nonneg _]
Β· simp only [expressionValue, abs_zero]
positivity
noncomputable def trialRate (t : TrialData) : β := 3 * max 0 t.1
@[fun_prop] theorem trialRate_computable : Computable trialRate := by
unfold trialRate
fun_prop
theorem trialRate_nonneg (t : TrialData) : 0 β€ trialRate t := by
unfold trialRate
positivity
noncomputable def trialDensityNN (t : TrialData) : ββ₯0 :=
β¨(max 0 t.1 : β), by exact_mod_cast le_max_left (0 : β) t.1β©
noncomputable def trialValue (t : TrialData) : β :=
Real.log 2 +
(β« k, guardedSiteValue t k βpoissonMeasure (trialDensityNN t * 3)) -
2*(max 0 t.1 : β)*packetEdgeValue (t.2.1 : β) t.2.2.1 t.2.2.2
attribute [local irreducible] guardedSiteValue packetEdgeValue
private theorem siteExpectation_effective : Effective (fun t : TrialData =>
β« k, guardedSiteValue t k βpoissonMeasure (trialDensityNN t * 3)) := by
have hs := effective_poisson_expectation trialRate trialRate_computable trialRate_nonneg
(fun t : TrialData => t.2.1) (by fun_prop) guardedSiteValue
guardedSiteValue_effective guardedSiteValue_bound
convert hs using 1
funext t
congr 1
congr 1
apply Subtype.ext
change ((max 0 t.1 : β) : β)*3 = ((3*max 0 t.1 : β) : β)
push_cast
ring
private theorem edgePacket_effective :
Effective (fun t : TrialData => packetEdgeValue (t.2.1 : β) t.2.2.1 t.2.2.2) := by
simpa only [packetEdgeValue] using expressionValue_effective.comp
(averagedEdgeExpression_computable.comp
(g := fun t : TrialData => ((t.2.1 : β),t.2.2.1,t.2.2.2)) (by fun_prop))
theorem trialValue_effective : Effective trialValue := by
have hlog : Effective (fun _t : TrialData => Real.log 2) :=
(rational (Computable.const (2 : β))).log (fun _ => by norm_num)
have ha : Effective (fun t : TrialData => ((2*(max 0 t.1) : β) : β)) :=
rational (by fun_prop)
apply ((hlog.add siteExpectation_effective).sub (ha.mul edgePacket_effective)).congr
intro t
simp only [trialValue, Rat.cast_mul, Rat.cast_ofNat]
theorem trialValue_eq_functional (t : TrialData)
(hm : exponentCheck t.2.2.2 = true) :
trialValue t = functional (satModel (trialDensityNN t) (t.2.1 : β)) t.2.2.2.length
(rationalTreeValue (t.2.2.2.length+1) (decodeTree (t.2.2.2.length+1) t.2.2.1))
(fun i => (t.2.2.2.get i : β)) := by
have hp := exponentCheck_positive hm
have he (k : β) : guardedSiteValue t k = packetSiteValue (t.2.1 : β) t.2.2.1 t.2.2.2 k := by
simp only [guardedSiteValue, guardedSiteExpression, hp, ite_true, packetSiteValue]
have hf := packet_functional (trialDensityNN t) (t.2.1 : β) t.2.2.1 t.2.2.2
((positiveExponents_iff _).mp hp)
simp only [Rat.cast_natCast] at hf
rw [hf]
have hc : (trialDensityNN t : β) = (max 0 t.1 : β) := rfl
simp only [trialValue, he, hc]
push_cast
ring
end FixedClauseThreshold.Computability
end OAI
|