import OAI.Probability.FreeIsing.Conditioning.Pullback namespace OAI noncomputable section open MeasureTheory ProbabilityTheory namespace Problem367 theorem condIndepFun_of_comp_measurePreserving {Ω Ω' C D : Type*} [mΩ : MeasurableSpace Ω] [mΩ' : MeasurableSpace Ω'] [MeasurableSpace C] [MeasurableSpace D] [StandardBorelSpace Ω] [StandardBorelSpace Ω'] (μ : Measure Ω) (ν : Measure Ω') [IsFiniteMeasure μ] [IsFiniteMeasure ν] (e : Ω → Ω') (he : MeasurePreserving e μ ν) (m : MeasurableSpace Ω') (hm : m ≤ mΩ') {f : Ω' → C} {g : Ω' → D} (hf : @Measurable Ω' C mΩ' _ f) (hg : @Measurable Ω' D mΩ' _ g) (hfg : CondIndepFun (m.comap e) ((MeasurableSpace.comap_mono hm).trans (@Measurable.comap_le Ω Ω' mΩ mΩ' e (@MeasurePreserving.measurable Ω Ω' mΩ mΩ' e μ ν he))) (f ∘ e) (g ∘ e) μ) : CondIndepFun m hm f g ν := by let : MeasurableSpace Ω' := mΩ' classical rw [condIndepFun_iff_condExp_inter_preimage_eq_mul hf hg] intro U V hU hV have hE := hU.preimage hf have hH := hV.preimage hg have hCE := condExp_comp_measurePreserving μ ν e he m hm ((integrable_const (1 : ℝ)).indicator hE) have hCH := condExp_comp_measurePreserving μ ν e he m hm ((integrable_const (1 : ℝ)).indicator hH) have hCEH := condExp_comp_measurePreserving μ ν e he m hm ((integrable_const (1 : ℝ)).indicator (hE.inter hH)) have hmul := (condIndepFun_iff_condExp_inter_preimage_eq_mul (hf.comp he.measurable) (hg.comp he.measurable)).mp hfg U V hU hV have hmeas : MeasurableSet {ω' | (ν⟦f ⁻¹' U ∩ g ⁻¹' V | m⟧) ω' = (ν⟦f ⁻¹' U | m⟧) ω' * (ν⟦g ⁻¹' V | m⟧) ω'} := measurableSet_eq_fun (stronglyMeasurable_condExp.mono hm).measurable ((stronglyMeasurable_condExp.mono hm).measurable.mul (stronglyMeasurable_condExp.mono hm).measurable) have hdesc := ae_map_iff (μ := μ) he.measurable.aemeasurable hmeas rw [he.map_eq] at hdesc apply hdesc.mpr filter_upwards [hCE, hCH, hCEH, hmul] with ω hωE hωH hωEH hωmul exact hωEH.symm.trans (hωmul.trans (congrArg₂ (· * ·) hωE hωH)) theorem condIndepFun_comp_measurePreserving_iff {Ω Ω' C D : Type*} [mΩ : MeasurableSpace Ω] [mΩ' : MeasurableSpace Ω'] [MeasurableSpace C] [MeasurableSpace D] [StandardBorelSpace Ω] [StandardBorelSpace Ω'] (μ : Measure Ω) (ν : Measure Ω') [IsFiniteMeasure μ] [IsFiniteMeasure ν] (e : Ω → Ω') (he : MeasurePreserving e μ ν) (m : MeasurableSpace Ω') (hm : m ≤ mΩ') {f : Ω' → C} {g : Ω' → D} (hf : @Measurable Ω' C mΩ' _ f) (hg : @Measurable Ω' D mΩ' _ g) : CondIndepFun (m.comap e) ((MeasurableSpace.comap_mono hm).trans (@Measurable.comap_le Ω Ω' mΩ mΩ' e (@MeasurePreserving.measurable Ω Ω' mΩ mΩ' e μ ν he))) (f ∘ e) (g ∘ e) μ ↔ CondIndepFun m hm f g ν := by let : MeasurableSpace Ω' := mΩ' exact ⟨condIndepFun_of_comp_measurePreserving μ ν e he m hm hf hg, condIndepFun_comp_measurePreserving μ ν e he m hm hf hg⟩ end Problem367 end end OAI