l3lab/ntp-mathlib huggingface dataset:
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (huX : IsUniform X s ℙ) :
    ∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x := by
  haveI := hasPDF hms hns hnt huX
  haveI := huX.isProbabilityMeasure hns hnt
  rw [← integral_mul_eq_integral]
  rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_toReal_ae_eq hms hns hnt huX))]
  have :
    ∀ x,
      x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
        x * s.indicator ((volume s)⁻¹.toReal • (1 : ℝ → ℝ)) x := by
    refine' fun x => congr_arg (x * ·) _
    by_cases hx : x ∈ s
    · simp [Set.indicator_of_mem hx]
    · simp [Set.indicator_of_not_mem hx]
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → ℝ
s : Set ℝ
hms : MeasurableSet s
hns : ↑↑volume s ≠ 0
hnt : ↑↑volume s ≠ ⊤
huX : IsUniform X s ℙ
this✝¹ : HasPDF X ℙ
this✝ : IsProbabilityMeasure ℙ
this :
  ∀ (x : ℝ),
    x * ENNReal.toReal (Set.indicator s ((↑↑volume s)⁻¹ • 1) x) =
      x * Set.indicator s (ENNReal.toReal (↑↑volume s)⁻¹ • 1) x
⊢ ∫ (a : ℝ), a * ENNReal.toReal (Set.indicator s ((↑↑volume s)⁻¹ • 1) a) ∂volume =
    ENNReal.toReal (↑↑volume s)⁻¹ * ∫ (x : ℝ) in s, x

Next tactic:
simp_rw [this, ← s.indicator_mul_right fun x => x, integral_indicator hms]
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (huX : IsUniform X s ℙ) :
    ∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x := by
  haveI := hasPDF hms hns hnt huX
  haveI := huX.isProbabilityMeasure hns hnt
  rw [← integral_mul_eq_integral]
  rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_toReal_ae_eq hms hns hnt huX))]
  have :
    ∀ x,
      x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
        x * s.indicator ((volume s)⁻¹.toReal • (1 : ℝ → ℝ)) x := by
    refine' fun x => congr_arg (x * ·) _
    by_cases hx : x ∈ s
    · simp [Set.indicator_of_mem hx]
    · simp [Set.indicator_of_not_mem hx]
  simp_rw [this, ← s.indicator_mul_right fun x => x, integral_indicator hms]
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → ℝ
s : Set ℝ
hms : MeasurableSet s
hns : ↑↑volume s ≠ 0
hnt : ↑↑volume s ≠ ⊤
huX : IsUniform X s ℙ
this✝¹ : HasPDF X ℙ
this✝ : IsProbabilityMeasure ℙ
this :
  ∀ (x : ℝ),
    x * ENNReal.toReal (Set.indicator s ((↑↑volume s)⁻¹ • 1) x) =
      x * Set.indicator s (ENNReal.toReal (↑↑volume s)⁻¹ • 1) x
⊢ ∫ (a : ℝ) in s, a * (ENNReal.toReal (↑↑volume s)⁻¹ • 1) a ∂volume = ENNReal.toReal (↑↑volume s)⁻¹ * ∫ (x : ℝ) in s, x

Next tactic:
change ∫ x in s, x * (volume s)⁻¹.toReal • (1 : ℝ) = _
/-- A real uniform random variable `X` with support `s` has expectation
`(λ s)⁻¹ * ∫ x in s, x ∂λ` where `λ` is the Lebesgue measure. -/
theorem integral_eq (huX : IsUniform X s ℙ) :
    ∫ x, X x ∂ℙ = (volume s)⁻¹.toReal * ∫ x in s, x := by
  haveI := hasPDF hms hns hnt huX
  haveI := huX.isProbabilityMeasure hns hnt
  rw [← integral_mul_eq_integral]
  rw [integral_congr_ae (Filter.EventuallyEq.mul (ae_eq_refl _) (pdf_toReal_ae_eq hms hns hnt huX))]
  have :
    ∀ x,
      x * (s.indicator ((volume s)⁻¹ • (1 : ℝ → ℝ≥0∞)) x).toReal =
        x * s.indicator ((volume s)⁻¹.toReal • (1 : ℝ → ℝ)) x := by
    refine' fun x => congr_arg (x * ·) _
    by_cases hx : x ∈ s
    · simp [Set.indicator_of_mem hx]
    · simp [Set.indicator_of_not_mem hx]
  simp_rw [this, ← s.indicator_mul_right fun x => x, integral_indicator hms]
  change ∫ x in s, x * (volume s)⁻¹.toReal • (1 : ℝ) = _
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
X : Ω → ℝ
s : Set ℝ
hms : MeasurableSet s
hns : ↑↑volume s ≠ 0
hnt : ↑↑volume s ≠ ⊤
huX : IsUniform X s ℙ
this✝¹ : HasPDF X ℙ
this✝ : IsProbabilityMeasure ℙ
this :
  ∀ (x : ℝ),
    x * ENNReal.toReal (Set.indicator s ((↑↑volume s)⁻¹ • 1) x) =
      x * Set.indicator s (ENNReal.toReal (↑↑volume s)⁻¹ • 1) x
⊢ ∫ (x : ℝ) in s, x * ENNReal.toReal (↑↑volume s)⁻¹ • 1 = ENNReal.toReal (↑↑volume s)⁻¹ * ∫ (x : ℝ) in s, x

Next tactic:
rw [integral_mul_right, mul_comm, smul_eq_mul, mul_one]
/-- Random variables are independent iff their joint density is a product of marginal densities. -/
theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
    [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
    IndepFun X Y ℙ ↔
      pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝⁵ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
F : Type u_3
inst✝⁴ : MeasurableSpace F
ν : Measure F
X : Ω → E
Y : Ω → F
inst✝³ : IsFiniteMeasure ℙ
inst✝² : SigmaFinite μ
inst✝¹ : SigmaFinite ν
inst✝ : HasPDF (fun ω => (X ω, Y ω)) ℙ
⊢ IndepFun X Y ↔ pdf (fun ω => (X ω, Y ω)) ℙ =ᶠ[ae (Measure.prod μ ν)] fun z => pdf X ℙ z.1 * pdf Y ℙ z.2

Next tactic:
have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
/-- Random variables are independent iff their joint density is a product of marginal densities. -/
theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
    [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
    IndepFun X Y ℙ ↔
      pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
  have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝⁵ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
F : Type u_3
inst✝⁴ : MeasurableSpace F
ν : Measure F
X : Ω → E
Y : Ω → F
inst✝³ : IsFiniteMeasure ℙ
inst✝² : SigmaFinite μ
inst✝¹ : SigmaFinite ν
inst✝ : HasPDF (fun ω => (X ω, Y ω)) ℙ
this : HasPDF X ℙ
⊢ IndepFun X Y ↔ pdf (fun ω => (X ω, Y ω)) ℙ =ᶠ[ae (Measure.prod μ ν)] fun z => pdf X ℙ z.1 * pdf Y ℙ z.2

Next tactic:
have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_snd
/-- Random variables are independent iff their joint density is a product of marginal densities. -/
theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
    [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
    IndepFun X Y ℙ ↔
      pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
  have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
  have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_snd
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝⁵ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
F : Type u_3
inst✝⁴ : MeasurableSpace F
ν : Measure F
X : Ω → E
Y : Ω → F
inst✝³ : IsFiniteMeasure ℙ
inst✝² : SigmaFinite μ
inst✝¹ : SigmaFinite ν
inst✝ : HasPDF (fun ω => (X ω, Y ω)) ℙ
this✝ : HasPDF X ℙ
this : HasPDF Y ℙ
⊢ IndepFun X Y ↔ pdf (fun ω => (X ω, Y ω)) ℙ =ᶠ[ae (Measure.prod μ ν)] fun z => pdf X ℙ z.1 * pdf Y ℙ z.2

Next tactic:
have h₀ : (ℙ.map X).prod (ℙ.map Y) =
      (μ.prod ν).withDensity fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 :=
    prod_eq fun s t hs ht ↦ by rw [withDensity_apply _ (hs.prod ht), ← prod_restrict,
      lintegral_prod_mul (measurable_pdf X ℙ μ).aemeasurable (measurable_pdf Y ℙ ν).aemeasurable,
      map_eq_set_lintegral_pdf X ℙ μ hs, map_eq_set_lintegral_pdf Y ℙ ν ht]
/-- Random variables are independent iff their joint density is a product of marginal densities. -/
theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
    [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
    IndepFun X Y ℙ ↔
      pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
  have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
  have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_snd
  have h₀ : (ℙ.map X).prod (ℙ.map Y) =
      (μ.prod ν).withDensity fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 :=
    prod_eq fun s t hs ht ↦ by 

Proof state:
Ω : Type u_1
E : Type u_2
inst✝⁵ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
F : Type u_3
inst✝⁴ : MeasurableSpace F
ν : Measure F
X : Ω → E
Y : Ω → F
inst✝³ : IsFiniteMeasure ℙ
inst✝² : SigmaFinite μ
inst✝¹ : SigmaFinite ν
inst✝ : HasPDF (fun ω => (X ω, Y ω)) ℙ
this✝ : HasPDF X ℙ
this : HasPDF Y ℙ
s : Set E
t : Set F
hs : MeasurableSet s
ht : MeasurableSet t
⊢ ↑↑(withDensity (Measure.prod μ ν) fun z => pdf X ℙ z.1 * pdf Y ℙ z.2) (s ×ˢ t) = ↑↑(map X ℙ) s * ↑↑(map Y ℙ) t

Next tactic:
rw [withDensity_apply _ (hs.prod ht), ← prod_restrict,
      lintegral_prod_mul (measurable_pdf X ℙ μ).aemeasurable (measurable_pdf Y ℙ ν).aemeasurable,
      map_eq_set_lintegral_pdf X ℙ μ hs, map_eq_set_lintegral_pdf Y ℙ ν ht]
/-- Random variables are independent iff their joint density is a product of marginal densities. -/
theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
    [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
    IndepFun X Y ℙ ↔
      pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
  have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
  have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_snd
  have h₀ : (ℙ.map X).prod (ℙ.map Y) =
      (μ.prod ν).withDensity fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 :=
    prod_eq fun s t hs ht ↦ by rw [withDensity_apply _ (hs.prod ht), ← prod_restrict,
      lintegral_prod_mul (measurable_pdf X ℙ μ).aemeasurable (measurable_pdf Y ℙ ν).aemeasurable,
      map_eq_set_lintegral_pdf X ℙ μ hs, map_eq_set_lintegral_pdf Y ℙ ν ht]
  

Proof state:
Ω : Type u_1
E : Type u_2
inst✝⁵ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
F : Type u_3
inst✝⁴ : MeasurableSpace F
ν : Measure F
X : Ω → E
Y : Ω → F
inst✝³ : IsFiniteMeasure ℙ
inst✝² : SigmaFinite μ
inst✝¹ : SigmaFinite ν
inst✝ : HasPDF (fun ω => (X ω, Y ω)) ℙ
this✝ : HasPDF X ℙ
this : HasPDF Y ℙ
h₀ : Measure.prod (map X ℙ) (map Y ℙ) = withDensity (Measure.prod μ ν) fun z => pdf X ℙ z.1 * pdf Y ℙ z.2
⊢ IndepFun X Y ↔ pdf (fun ω => (X ω, Y ω)) ℙ =ᶠ[ae (Measure.prod μ ν)] fun z => pdf X ℙ z.1 * pdf Y ℙ z.2

Next tactic:
rw [indepFun_iff_map_prod_eq_prod_map_map (HasPDF.aemeasurable X ℙ μ) (HasPDF.aemeasurable Y ℙ ν),
    ← eq_of_map_eq_withDensity, h₀]
/-- Random variables are independent iff their joint density is a product of marginal densities. -/
theorem indepFun_iff_pdf_prod_eq_pdf_mul_pdf
    [IsFiniteMeasure ℙ] [SigmaFinite μ] [SigmaFinite ν] [HasPDF (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)] :
    IndepFun X Y ℙ ↔
      pdf (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν) =ᵐ[μ.prod ν] fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 := by
  have : HasPDF X ℙ μ := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_fst
  have : HasPDF Y ℙ ν := quasiMeasurePreserving_hasPDF' (μ := μ.prod ν)
    (HasPDF.aemeasurable (fun ω ↦ (X ω, Y ω)) ℙ (μ.prod ν)) quasiMeasurePreserving_snd
  have h₀ : (ℙ.map X).prod (ℙ.map Y) =
      (μ.prod ν).withDensity fun z ↦ pdf X ℙ μ z.1 * pdf Y ℙ ν z.2 :=
    prod_eq fun s t hs ht ↦ by rw [withDensity_apply _ (hs.prod ht), ← prod_restrict,
      lintegral_prod_mul (measurable_pdf X ℙ μ).aemeasurable (measurable_pdf Y ℙ ν).aemeasurable,
      map_eq_set_lintegral_pdf X ℙ μ hs, map_eq_set_lintegral_pdf Y ℙ ν ht]
  rw [indepFun_iff_map_prod_eq_prod_map_map (HasPDF.aemeasurable X ℙ μ) (HasPDF.aemeasurable Y ℙ ν),
    ← eq_of_map_eq_withDensity, h₀]
  

Proof state:
case hmf
Ω : Type u_1
E : Type u_2
inst✝⁵ : MeasurableSpace E
m : MeasurableSpace Ω
ℙ : Measure Ω
μ : Measure E
F : Type u_3
inst✝⁴ : MeasurableSpace F
ν : Measure F
X : Ω → E
Y : Ω → F
inst✝³ : IsFiniteMeasure ℙ
inst✝² : SigmaFinite μ
inst✝¹ : SigmaFinite ν
inst✝ : HasPDF (fun ω => (X ω, Y ω)) ℙ
this✝ : HasPDF X ℙ
this : HasPDF Y ℙ
h₀ : Measure.prod (map X ℙ) (map Y ℙ) = withDensity (Measure.prod μ ν) fun z => pdf X ℙ z.1 * pdf Y ℙ z.2
⊢ AEMeasurable fun z => pdf X ℙ z.1 * pdf Y ℙ z.2

Next tactic:
exact (((measurable_pdf X ℙ μ).comp measurable_fst).mul
    ((measurable_pdf Y ℙ ν).comp measurable_snd)).aemeasurable
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  

Proof state:
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
⊢ ContravariantClass (WithZero α) (WithZero α) (fun x x_1 => x * x_1) fun x x_1 => x < x_1

Next tactic:
refine ⟨fun a b c h => ?_⟩
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  

Proof state:
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
a b c : WithZero α
h : a * b < a * c
⊢ b < c

Next tactic:
have := ((zero_le _).trans_lt h).ne'
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  

Proof state:
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
a b c : WithZero α
h : a * b < a * c
this : a * c ≠ 0
⊢ b < c

Next tactic:
induction a using WithZero.recZeroCoe
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · 

Proof state:
case h₁
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
b c : WithZero α
h : 0 * b < 0 * c
this : 0 * c ≠ 0
⊢ b < c

Next tactic:
exfalso
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · exfalso; 

Proof state:
case h₁.h
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
b c : WithZero α
h : 0 * b < 0 * c
this : 0 * c ≠ 0
⊢ False

Next tactic:
exact left_ne_zero_of_mul this rfl
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · exfalso; exact left_ne_zero_of_mul this rfl
  

Proof state:
case h₂
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
b c : WithZero α
a✝ : α
h : ↑a✝ * b < ↑a✝ * c
this : ↑a✝ * c ≠ 0
⊢ b < c

Next tactic:
induction c using WithZero.recZeroCoe
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · exfalso; exact left_ne_zero_of_mul this rfl
  induction c using WithZero.recZeroCoe
  · 

Proof state:
case h₂.h₁
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
b : WithZero α
a✝ : α
h : ↑a✝ * b < ↑a✝ * 0
this : ↑a✝ * 0 ≠ 0
⊢ b < 0

Next tactic:
exfalso
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · exfalso; exact left_ne_zero_of_mul this rfl
  induction c using WithZero.recZeroCoe
  · exfalso; 

Proof state:
case h₂.h₁.h
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
b : WithZero α
a✝ : α
h : ↑a✝ * b < ↑a✝ * 0
this : ↑a✝ * 0 ≠ 0
⊢ False

Next tactic:
exact right_ne_zero_of_mul this rfl
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · exfalso; exact left_ne_zero_of_mul this rfl
  induction c using WithZero.recZeroCoe
  · exfalso; exact right_ne_zero_of_mul this rfl
  

Proof state:
case h₂.h₂
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
b : WithZero α
a✝¹ a✝ : α
h : ↑a✝¹ * b < ↑a✝¹ * ↑a✝
this : ↑a✝¹ * ↑a✝ ≠ 0
⊢ b < ↑a✝

Next tactic:
induction b using WithZero.recZeroCoe
instance contravariantClass_mul_lt [Mul α] [PartialOrder α]
    [ContravariantClass α α (· * ·) (· < ·)] :
    ContravariantClass (WithZero α) (WithZero α) (· * ·) (· < ·) := by
  refine ⟨fun a b c h => ?_⟩
  have := ((zero_le _).trans_lt h).ne'
  induction a using WithZero.recZeroCoe
  · exfalso; exact left_ne_zero_of_mul this rfl
  induction c using WithZero.recZeroCoe
  · exfalso; exact right_ne_zero_of_mul this rfl
  induction b using WithZero.recZeroCoe
  

Proof state:
case h₂.h₂.h₁
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
a✝¹ a✝ : α
this : ↑a✝¹ * ↑a✝ ≠ 0
h : ↑a✝¹ * 0 < ↑a✝¹ * ↑a✝
⊢ 0 < ↑a✝
case h₂.h₂.h₂
α : Type u
inst✝² : Mul α
inst✝¹ : PartialOrder α
inst✝ : ContravariantClass α α (fun x x_1 => x * x_1) fun x x_1 => x < x_1
a✝² a✝¹ : α
this : ↑a✝² * ↑a✝¹ ≠ 0
a✝ : α
h : ↑a✝² * ↑a✝ < ↑a✝² * ↑a✝¹
⊢ ↑a✝ < ↑a✝¹

Next tactic:
exacts [zero_lt_coe _, coe_lt_coe.mpr (lt_of_mul_lt_mul_left' <| coe_lt_coe.mp h)]
theorem IsIntegralClosure.isLocalization (hKL : Algebra.IsAlgebraic K L) :
    IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
  

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing A
inst✝¹² : Field K
inst✝¹¹ : IsDomain A
inst✝¹⁰ : Algebra A K
inst✝⁹ : IsFractionRing A K
L : Type u_4
inst✝⁸ : Field L
C : Type u_5
inst✝⁷ : CommRing C
inst✝⁶ : Algebra K L
inst✝⁵ : Algebra A L
inst✝⁴ : IsScalarTower A K L
inst✝³ : Algebra C L
inst✝² : IsIntegralClosure C A L
inst✝¹ : Algebra A C
inst✝ : IsScalarTower A C L
hKL : Algebra.IsAlgebraic K L
⊢ IsLocalization (algebraMapSubmonoid C A⁰) L

Next tactic:
haveI : IsDomain C :=
    (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
theorem IsIntegralClosure.isLocalization (hKL : Algebra.IsAlgebraic K L) :
    IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
  haveI : IsDomain C :=
    (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
  

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing A
inst✝¹² : Field K
inst✝¹¹ : IsDomain A
inst✝¹⁰ : Algebra A K
inst✝⁹ : IsFractionRing A K
L : Type u_4
inst✝⁸ : Field L
C : Type u_5
inst✝⁷ : CommRing C
inst✝⁶ : Algebra K L
inst✝⁵ : Algebra A L
inst✝⁴ : IsScalarTower A K L
inst✝³ : Algebra C L
inst✝² : IsIntegralClosure C A L
inst✝¹ : Algebra A C
inst✝ : IsScalarTower A C L
hKL : Algebra.IsAlgebraic K L
this : IsDomain C
⊢ IsLocalization (algebraMapSubmonoid C A⁰) L

Next tactic:
haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L
theorem IsIntegralClosure.isLocalization (hKL : Algebra.IsAlgebraic K L) :
    IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
  haveI : IsDomain C :=
    (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
  haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L
  

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing A
inst✝¹² : Field K
inst✝¹¹ : IsDomain A
inst✝¹⁰ : Algebra A K
inst✝⁹ : IsFractionRing A K
L : Type u_4
inst✝⁸ : Field L
C : Type u_5
inst✝⁷ : CommRing C
inst✝⁶ : Algebra K L
inst✝⁵ : Algebra A L
inst✝⁴ : IsScalarTower A K L
inst✝³ : Algebra C L
inst✝² : IsIntegralClosure C A L
inst✝¹ : Algebra A C
inst✝ : IsScalarTower A C L
hKL : Algebra.IsAlgebraic K L
this✝ : IsDomain C
this : NoZeroSMulDivisors A L
⊢ IsLocalization (algebraMapSubmonoid C A⁰) L

Next tactic:
haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L
theorem IsIntegralClosure.isLocalization (hKL : Algebra.IsAlgebraic K L) :
    IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
  haveI : IsDomain C :=
    (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
  haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L
  haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L
  

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing A
inst✝¹² : Field K
inst✝¹¹ : IsDomain A
inst✝¹⁰ : Algebra A K
inst✝⁹ : IsFractionRing A K
L : Type u_4
inst✝⁸ : Field L
C : Type u_5
inst✝⁷ : CommRing C
inst✝⁶ : Algebra K L
inst✝⁵ : Algebra A L
inst✝⁴ : IsScalarTower A K L
inst✝³ : Algebra C L
inst✝² : IsIntegralClosure C A L
inst✝¹ : Algebra A C
inst✝ : IsScalarTower A C L
hKL : Algebra.IsAlgebraic K L
this✝¹ : IsDomain C
this✝ : NoZeroSMulDivisors A L
this : NoZeroSMulDivisors A C
⊢ IsLocalization (algebraMapSubmonoid C A⁰) L

Next tactic:
refine' ⟨_, fun z => _, fun {x y} h => ⟨1, _⟩⟩
theorem IsIntegralClosure.isLocalization (hKL : Algebra.IsAlgebraic K L) :
    IsLocalization (Algebra.algebraMapSubmonoid C A⁰) L := by
  haveI : IsDomain C :=
    (IsIntegralClosure.equiv A C L (integralClosure A L)).toMulEquiv.isDomain (integralClosure A L)
  haveI : NoZeroSMulDivisors A L := NoZeroSMulDivisors.trans A K L
  haveI : NoZeroSMulDivisors A C := IsIntegralClosure.noZeroSMulDivisors A L
  refine' ⟨_, fun z => _, fun {x y} h => ⟨1, _⟩⟩
  · 

Proof state:
case refine'_1
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁴ : CommRing R
inst✝¹³ : CommRing A
inst✝¹² : Field K
inst✝¹¹ : IsDomain A
inst✝¹⁰ : Algebra A K
inst✝⁹ : IsFractionRing A K
L : Type u_4
inst✝⁸ : Field L
C : Type u_5
inst✝⁷ : CommRing C
inst✝⁶ : Algebra K L
inst✝⁵ : Algebra A L
inst✝⁴ : IsScalarTower A K L
inst✝³ : Algebra C L
inst✝² : IsIntegralClosure C A L
inst✝¹ : Algebra A C
inst✝ : IsScalarTower A C L
hKL : Algebra.IsAlgebraic K L
this✝¹ : IsDomain C
this✝ : NoZeroSMulDivisors A L
this : NoZeroSMulDivisors A C
⊢ ∀ (y : ↥(algebraMapSubmonoid C A⁰)), IsUnit ((algebraMap C L) ↑y)

Next tactic:
rintro ⟨_, x, hx, rfl⟩