classical
letW : Y→ℕ:=fun x =>Encodable.encode (Q x,R x)
havehW : MeasurableW:= (measurable_of_countable Encodable.encode).comp (hQ.prodMk hR)
let e :=Fintype.equivFin (Fin (M+1) ×Fin (L+1))
letC : Y→Fin (Fintype.card (Fin (M+1) ×Fin (L+1))+1) :=fun x => (e (B x,R x)).castSucc
havehC : MeasurableC:= (measurable_of_finite (fun p => (e p).castSucc)).comp
(hB.prodMk hR)
have hparts {x y : Y} (h : W x=W y) : Q x=Q y ∧R x=R y :=Prod.mk.inj (Encodable.encode_injective h)
havehrefC : ∀ x y, W x=W y →W (T x)=W (T y) →C x=C y :=by
intro x y hxy hTxy
have hh := hparts hxy
dsimp only [C]
rw [href x y hh.1 (hparts hTxy).1,hh.2]
letdec : ℕ→Fin (Fintype.card (Fin (M+1) ×Fin (L+1))+1) →ℕ:=fun q b =>let p :=Fin.lastCases (motive :=fun _ =>Fin (M+1) ×Fin (L+1)) (0,0) e.symm b
Encodable.encode (decode ((Encodable.decode (α :=ℕ×Fin (L+1)) q).getD (0,0)).1 p.1,p.2)
have hdec (x : Y) : dec (W (T x)) (C x)=W x :=by
simp only [dec,W,C,Fin.lastCases_castSucc,Equiv.symm_apply_apply,
Encodable.encodek,Option.getD_some,hdecode]
have hfirst := predecessor_factor_entropyRate_le μ hT W hW C hC hrefC dec hdec
(heightClip QK) (heightClip_measurable hQ K) (fun x y h =>by
apply Fin.ext
change min (Q x) K=min (Q y) K
rw [(hparts h).1])
havehpair : Measurable (fun x => (B x,R x)) := hB.prodMk hR
have hrec := conditionalSigmaEntropy_le_of_fiber_refinement μ
(entireFutureObservation TW) (entireFutureObservation_measurable hT.measurable hW)
C hC (fun x => (B x,R x)) hpair (fun x y _ h =>by
dsimp only [C]
rw [h])
have hchain := conditionalSigmaEntropy_chain_wholeFuture μ hT.measurable W hW
B (fun a => hB (measurableSet_singleton a))
R (fun a => hR (measurableSet_singleton a))
have hcond := conditionalSigmaEntropy_antitone μ R
(fun a => hR (measurableSet_singleton a))
(m :=MeasurableSpace.comap (entireFutureObservation TW) inferInstance)
(n :=MeasurableSpace.comap (entireFutureObservation TW) inferInstance ⊔ observationSigma B)
le_sup_left (sup_le (entireFutureObservation_measurable hT.measurable hW).comap_le
(observationSigma_le B (fun a => hB (measurableSet_singleton a))))
have hobs := conditionalSigmaEntropy_wholeFuture_le_observationEntropy μ hT.measurable W hW
R (fun a => hR (measurableSet_singleton a))
exact hfirst.trans (hrec.trans (hchain.le.trans (add_le_add le_rfl (hcond.trans hobs))))