l3lab/ntp-mathlib huggingface dataset:
instance IsMarkovKernel.prodMkLeft (κ : kernel α β) [IsMarkovKernel κ] :
    IsMarkovKernel (prodMkLeft γ κ) := by rw [kernel.prodMkLeft]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.comap κ Prod.snd (_ : Measurable Prod.snd))

Next tactic:
infer_instance
instance IsFiniteKernel.prodMkLeft (κ : kernel α β) [IsFiniteKernel κ] :
    IsFiniteKernel (prodMkLeft γ κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.prodMkLeft γ κ)

Next tactic:
rw [kernel.prodMkLeft]
instance IsFiniteKernel.prodMkLeft (κ : kernel α β) [IsFiniteKernel κ] :
    IsFiniteKernel (prodMkLeft γ κ) := by rw [kernel.prodMkLeft]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.comap κ Prod.snd (_ : Measurable Prod.snd))

Next tactic:
infer_instance
instance IsSFiniteKernel.prodMkLeft (κ : kernel α β) [IsSFiniteKernel κ] :
    IsSFiniteKernel (prodMkLeft γ κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.prodMkLeft γ κ)

Next tactic:
rw [kernel.prodMkLeft]
instance IsSFiniteKernel.prodMkLeft (κ : kernel α β) [IsSFiniteKernel κ] :
    IsSFiniteKernel (prodMkLeft γ κ) := by rw [kernel.prodMkLeft]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.comap κ Prod.snd (_ : Measurable Prod.snd))

Next tactic:
infer_instance
theorem lintegral_swapLeft (κ : kernel (α × β) γ) (a : β × α) (g : γ → ℝ≥0∞) :
    ∫⁻ c, g c ∂swapLeft κ a = ∫⁻ c, g c ∂κ a.swap := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g✝ : γ → α
κ : ↥(kernel (α × β) γ)
a : β × α
g : γ → ℝ≥0∞
⊢ ∫⁻ (c : γ), g c ∂(swapLeft κ) a = ∫⁻ (c : γ), g c ∂κ (Prod.swap a)

Next tactic:
rw [swapLeft_apply]
instance IsMarkovKernel.swapLeft (κ : kernel (α × β) γ) [IsMarkovKernel κ] :
    IsMarkovKernel (swapLeft κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel (α × β) γ)
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.swapLeft κ)

Next tactic:
rw [kernel.swapLeft]
instance IsMarkovKernel.swapLeft (κ : kernel (α × β) γ) [IsMarkovKernel κ] :
    IsMarkovKernel (swapLeft κ) := by rw [kernel.swapLeft]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel (α × β) γ)
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.comap κ Prod.swap (_ : Measurable Prod.swap))

Next tactic:
infer_instance
instance IsFiniteKernel.swapLeft (κ : kernel (α × β) γ) [IsFiniteKernel κ] :
    IsFiniteKernel (swapLeft κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.swapLeft κ)

Next tactic:
rw [kernel.swapLeft]
instance IsFiniteKernel.swapLeft (κ : kernel (α × β) γ) [IsFiniteKernel κ] :
    IsFiniteKernel (swapLeft κ) := by rw [kernel.swapLeft]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel (α × β) γ)
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.comap κ Prod.swap (_ : Measurable Prod.swap))

Next tactic:
infer_instance
instance IsSFiniteKernel.swapLeft (κ : kernel (α × β) γ) [IsSFiniteKernel κ] :
    IsSFiniteKernel (swapLeft κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.swapLeft κ)

Next tactic:
rw [kernel.swapLeft]
instance IsSFiniteKernel.swapLeft (κ : kernel (α × β) γ) [IsSFiniteKernel κ] :
    IsSFiniteKernel (swapLeft κ) := by rw [kernel.swapLeft]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel (α × β) γ)
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.comap κ Prod.swap (_ : Measurable Prod.swap))

Next tactic:
infer_instance
theorem swapRight_apply' (κ : kernel α (β × γ)) (a : α) {s : Set (γ × β)} (hs : MeasurableSet s) :
    swapRight κ a s = κ a {p | p.swap ∈ s} := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
a : α
s : Set (γ × β)
hs : MeasurableSet s
⊢ ↑↑((swapRight κ) a) s = ↑↑(κ a) {p | Prod.swap p ∈ s}

Next tactic:
rw [swapRight_apply, Measure.map_apply measurable_swap hs]
theorem swapRight_apply' (κ : kernel α (β × γ)) (a : α) {s : Set (γ × β)} (hs : MeasurableSet s) :
    swapRight κ a s = κ a {p | p.swap ∈ s} := by
  rw [swapRight_apply, Measure.map_apply measurable_swap hs]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
a : α
s : Set (γ × β)
hs : MeasurableSet s
⊢ ↑↑(κ a) (Prod.swap ⁻¹' s) = ↑↑(κ a) {p | Prod.swap p ∈ s}

Next tactic:
rfl
theorem lintegral_swapRight (κ : kernel α (β × γ)) (a : α) {g : γ × β → ℝ≥0∞} (hg : Measurable g) :
    ∫⁻ c, g c ∂swapRight κ a = ∫⁻ bc : β × γ, g bc.swap ∂κ a := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g✝ : γ → α
κ : ↥(kernel α (β × γ))
a : α
g : γ × β → ℝ≥0∞
hg : Measurable g
⊢ ∫⁻ (c : γ × β), g c ∂(swapRight κ) a = ∫⁻ (bc : β × γ), g (Prod.swap bc) ∂κ a

Next tactic:
rw [swapRight, lintegral_map _ measurable_swap a hg]
instance IsMarkovKernel.swapRight (κ : kernel α (β × γ)) [IsMarkovKernel κ] :
    IsMarkovKernel (swapRight κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.swapRight κ)

Next tactic:
rw [kernel.swapRight]
instance IsMarkovKernel.swapRight (κ : kernel α (β × γ)) [IsMarkovKernel κ] :
    IsMarkovKernel (swapRight κ) := by rw [kernel.swapRight]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.map κ Prod.swap (_ : Measurable Prod.swap))

Next tactic:
infer_instance
instance IsFiniteKernel.swapRight (κ : kernel α (β × γ)) [IsFiniteKernel κ] :
    IsFiniteKernel (swapRight κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.swapRight κ)

Next tactic:
rw [kernel.swapRight]
instance IsFiniteKernel.swapRight (κ : kernel α (β × γ)) [IsFiniteKernel κ] :
    IsFiniteKernel (swapRight κ) := by rw [kernel.swapRight]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.map κ Prod.swap (_ : Measurable Prod.swap))

Next tactic:
infer_instance
instance IsSFiniteKernel.swapRight (κ : kernel α (β × γ)) [IsSFiniteKernel κ] :
    IsSFiniteKernel (swapRight κ) := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.swapRight κ)

Next tactic:
rw [kernel.swapRight]
instance IsSFiniteKernel.swapRight (κ : kernel α (β × γ)) [IsSFiniteKernel κ] :
    IsSFiniteKernel (swapRight κ) := by rw [kernel.swapRight]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.map κ Prod.swap (_ : Measurable Prod.swap))

Next tactic:
infer_instance
theorem fst_apply' (κ : kernel α (β × γ)) (a : α) {s : Set β} (hs : MeasurableSet s) :
    fst κ a s = κ a {p | p.1 ∈ s} := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
a : α
s : Set β
hs : MeasurableSet s
⊢ ↑↑((fst κ) a) s = ↑↑(κ a) {p | p.1 ∈ s}

Next tactic:
rw [fst_apply, Measure.map_apply measurable_fst hs]
theorem fst_apply' (κ : kernel α (β × γ)) (a : α) {s : Set β} (hs : MeasurableSet s) :
    fst κ a s = κ a {p | p.1 ∈ s} := by rw [fst_apply, Measure.map_apply measurable_fst hs]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
a : α
s : Set β
hs : MeasurableSet s
⊢ ↑↑(κ a) (Prod.fst ⁻¹' s) = ↑↑(κ a) {p | p.1 ∈ s}

Next tactic:
rfl
@[simp]
lemma fst_zero : fst (0 : kernel α (β × γ)) = 0 := by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
⊢ fst 0 = 0

Next tactic:
simp [fst]
theorem lintegral_fst (κ : kernel α (β × γ)) (a : α) {g : β → ℝ≥0∞} (hg : Measurable g) :
    ∫⁻ c, g c ∂fst κ a = ∫⁻ bc : β × γ, g bc.fst ∂κ a := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g✝ : γ → α
κ : ↥(kernel α (β × γ))
a : α
g : β → ℝ≥0∞
hg : Measurable g
⊢ ∫⁻ (c : β), g c ∂(fst κ) a = ∫⁻ (bc : β × γ), g bc.1 ∂κ a

Next tactic:
rw [fst, lintegral_map _ measurable_fst a hg]
instance IsMarkovKernel.fst (κ : kernel α (β × γ)) [IsMarkovKernel κ] : IsMarkovKernel (fst κ) := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.fst κ)

Next tactic:
rw [kernel.fst]
instance IsMarkovKernel.fst (κ : kernel α (β × γ)) [IsMarkovKernel κ] : IsMarkovKernel (fst κ) := by
  rw [kernel.fst]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsMarkovKernel κ
⊢ IsMarkovKernel (kernel.map κ Prod.fst (_ : Measurable Prod.fst))

Next tactic:
infer_instance
instance IsFiniteKernel.fst (κ : kernel α (β × γ)) [IsFiniteKernel κ] : IsFiniteKernel (fst κ) := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.fst κ)

Next tactic:
rw [kernel.fst]
instance IsFiniteKernel.fst (κ : kernel α (β × γ)) [IsFiniteKernel κ] : IsFiniteKernel (fst κ) := by
  rw [kernel.fst]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsFiniteKernel κ
⊢ IsFiniteKernel (kernel.map κ Prod.fst (_ : Measurable Prod.fst))

Next tactic:
infer_instance
instance IsSFiniteKernel.fst (κ : kernel α (β × γ)) [IsSFiniteKernel κ] : IsSFiniteKernel (fst κ) :=
  by 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.fst κ)

Next tactic:
rw [kernel.fst]
instance IsSFiniteKernel.fst (κ : kernel α (β × γ)) [IsSFiniteKernel κ] : IsSFiniteKernel (fst κ) :=
  by rw [kernel.fst]; 

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α (β × γ))
inst✝ : IsSFiniteKernel κ
⊢ IsSFiniteKernel (kernel.map κ Prod.fst (_ : Measurable Prod.fst))

Next tactic:
infer_instance
lemma fst_map_prod (κ : kernel α β) {f : β → γ} {g : β → δ}
    (hf : Measurable f) (hg : Measurable g) :
    fst (map κ (fun x ↦ (f x, g x)) (hf.prod_mk hg)) = map κ f hf := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f✝ : β → γ
g✝ : γ → α
κ : ↥(kernel α β)
f : β → γ
g : β → δ
hf : Measurable f
hg : Measurable g
⊢ fst (map κ (fun x => (f x, g x)) (_ : Measurable fun a => (f a, g a))) = map κ f hf

Next tactic:
ext x s hs
lemma fst_map_prod (κ : kernel α β) {f : β → γ} {g : β → δ}
    (hf : Measurable f) (hg : Measurable g) :
    fst (map κ (fun x ↦ (f x, g x)) (hf.prod_mk hg)) = map κ f hf := by
  ext x s hs
  

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f✝ : β → γ
g✝ : γ → α
κ : ↥(kernel α β)
f : β → γ
g : β → δ
hf : Measurable f
hg : Measurable g
x : α
s : Set γ
hs : MeasurableSet s
⊢ ↑↑((fst (map κ (fun x => (f x, g x)) (_ : Measurable fun a => (f a, g a)))) x) s = ↑↑((map κ f hf) x) s

Next tactic:
rw [fst_apply' _ _ hs, map_apply', map_apply' _ _ _ hs]
lemma fst_map_prod (κ : kernel α β) {f : β → γ} {g : β → δ}
    (hf : Measurable f) (hg : Measurable g) :
    fst (map κ (fun x ↦ (f x, g x)) (hf.prod_mk hg)) = map κ f hf := by
  ext x s hs
  rw [fst_apply' _ _ hs, map_apply', map_apply' _ _ _ hs]
  · 

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f✝ : β → γ
g✝ : γ → α
κ : ↥(kernel α β)
f : β → γ
g : β → δ
hf : Measurable f
hg : Measurable g
x : α
s : Set γ
hs : MeasurableSet s
⊢ ↑↑(κ x) ((fun x => (f x, g x)) ⁻¹' {p | p.1 ∈ s}) = ↑↑(κ x) (f ⁻¹' s)

Next tactic:
rfl
lemma fst_map_prod (κ : kernel α β) {f : β → γ} {g : β → δ}
    (hf : Measurable f) (hg : Measurable g) :
    fst (map κ (fun x ↦ (f x, g x)) (hf.prod_mk hg)) = map κ f hf := by
  ext x s hs
  rw [fst_apply' _ _ hs, map_apply', map_apply' _ _ _ hs]
  · rfl
  · 

Proof state:
case h.h.hs
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f✝ : β → γ
g✝ : γ → α
κ : ↥(kernel α β)
f : β → γ
g : β → δ
hf : Measurable f
hg : Measurable g
x : α
s : Set γ
hs : MeasurableSet s
⊢ MeasurableSet {p | p.1 ∈ s}

Next tactic:
exact measurable_fst hs
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
⊢ fst (κ ⊗ₖ η) = κ

Next tactic:
ext x s hs
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ ↑↑((fst (κ ⊗ₖ η)) x) s = ↑↑(κ x) s

Next tactic:
rw [fst_apply' _ _ hs, compProd_apply]
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ ∫⁻ (b : β), ↑↑(η (x, b)) {c | (b, c) ∈ {p | p.1 ∈ s}} ∂κ x = ↑↑(κ x) s
case h.h.hs
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ MeasurableSet {p | p.1 ∈ s}

Next tactic:
swap
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · 

Proof state:
case h.h.hs
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ MeasurableSet {p | p.1 ∈ s}

Next tactic:
exact measurable_fst hs
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · exact measurable_fst hs
  

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ ∫⁻ (b : β), ↑↑(η (x, b)) {c | (b, c) ∈ {p | p.1 ∈ s}} ∂κ x = ↑↑(κ x) s

Next tactic:
simp only [Set.mem_setOf_eq]
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · exact measurable_fst hs
  simp only [Set.mem_setOf_eq]
  

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ ∫⁻ (b : β), ↑↑(η (x, b)) {c | b ∈ s} ∂κ x = ↑↑(κ x) s

Next tactic:
classical
  have : ∀ b : β, η (x, b) {_c | b ∈ s} = s.indicator (fun _ ↦ 1) b := by
    intro b
    by_cases hb : b ∈ s <;> simp [hb]
  simp_rw [this]
  rw [lintegral_indicator_const hs, one_mul]
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · exact measurable_fst hs
  simp only [Set.mem_setOf_eq]
  classical
  

Proof state:
case h.h
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ ∫⁻ (b : β), ↑↑(η (x, b)) {c | b ∈ s} ∂κ x = ↑↑(κ x) s

Next tactic:
have : ∀ b : β, η (x, b) {_c | b ∈ s} = s.indicator (fun _ ↦ 1) b := by
    intro b
    by_cases hb : b ∈ s <;> simp [hb]
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · exact measurable_fst hs
  simp only [Set.mem_setOf_eq]
  classical
  have : ∀ b : β, η (x, b) {_c | b ∈ s} = s.indicator (fun _ ↦ 1) b := by
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
⊢ ∀ (b : β), ↑↑(η (x, b)) {_c | b ∈ s} = Set.indicator s (fun x => 1) b

Next tactic:
intro b
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · exact measurable_fst hs
  simp only [Set.mem_setOf_eq]
  classical
  have : ∀ b : β, η (x, b) {_c | b ∈ s} = s.indicator (fun _ ↦ 1) b := by
    intro b
    

Proof state:
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
b : β
⊢ ↑↑(η (x, b)) {_c | b ∈ s} = Set.indicator s (fun x => 1) b

Next tactic:
by_cases hb : b ∈ s
@[simp]
lemma fst_compProd (κ : kernel α β) (η : kernel (α × β) γ) [IsSFiniteKernel κ] [IsMarkovKernel η] :
    fst (κ ⊗ₖ η) = κ := by
  ext x s hs
  rw [fst_apply' _ _ hs, compProd_apply]
  swap; · exact measurable_fst hs
  simp only [Set.mem_setOf_eq]
  classical
  have : ∀ b : β, η (x, b) {_c | b ∈ s} = s.indicator (fun _ ↦ 1) b := by
    intro b
    by_cases hb : b ∈ s <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
mα : MeasurableSpace α
mβ : MeasurableSpace β
δ : Type u_4
mδ : MeasurableSpace δ
γ : Type u_5
mγ : MeasurableSpace γ
f : β → γ
g : γ → α
κ : ↥(kernel α β)
η : ↥(kernel (α × β) γ)
inst✝¹ : IsSFiniteKernel κ
inst✝ : IsMarkovKernel η
x : α
s : Set β
hs : MeasurableSet s
b : β
hb : b ∈ s
⊢ ↑↑(η (x, b)) {_c | b ∈ s} = Set.indicator s (fun x => 1) b

Next tactic:
simp [hb]