l3lab/ntp-mathlib huggingface dataset:
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · 

Proof state:
case refine_1.refine_2
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ ∀ (y : Fin (rank K) → ℤ),
    (fun e => x = ↑{ val := ζ, property := h_tors } * ∏ i : Fin (rank K), fundSystem K i ^ e i) y →
      y = ⇑((basisModTorsion K).repr (Additive.ofMul ↑x))

Next tactic:
exact fun _ hf => fun_eq_repr K h_tors hf
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · exact fun _ hf => fun_eq_repr K h_tors hf
  · 

Proof state:
case refine_2
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
⊢ ∀ (y : ↥(torsion K)),
    (fun ζ => ∃! e, x = ↑ζ * ∏ i : Fin (rank K), fundSystem K i ^ e i) y → y = { val := ζ, property := h_tors }

Next tactic:
rintro η ⟨_, hf, _⟩
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · exact fun _ hf => fun_eq_repr K h_tors hf
  · rintro η ⟨_, hf, _⟩
    

Proof state:
case refine_2.intro.intro
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : ↥(torsion K)
w✝ : Fin (rank K) → ℤ
hf : x = ↑η * ∏ i : Fin (rank K), fundSystem K i ^ w✝ i
right✝ : ∀ (y : Fin (rank K) → ℤ), (fun e => x = ↑η * ∏ i : Fin (rank K), fundSystem K i ^ e i) y → y = w✝
⊢ η = { val := ζ, property := h_tors }

Next tactic:
simp_rw [fun_eq_repr K η.prop hf] at hf
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · exact fun _ hf => fun_eq_repr K h_tors hf
  · rintro η ⟨_, hf, _⟩
    simp_rw [fun_eq_repr K η.prop hf] at hf
    

Proof state:
case refine_2.intro.intro
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : ↥(torsion K)
w✝ : Fin (rank K) → ℤ
right✝ : ∀ (y : Fin (rank K) → ℤ), (fun e => x = ↑η * ∏ i : Fin (rank K), fundSystem K i ^ e i) y → y = w✝
hf : x = ↑η * ∏ x_1 : Fin (rank K), fundSystem K x_1 ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1
⊢ η = { val := ζ, property := h_tors }

Next tactic:
ext1
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · exact fun _ hf => fun_eq_repr K h_tors hf
  · rintro η ⟨_, hf, _⟩
    simp_rw [fun_eq_repr K η.prop hf] at hf
    ext1; 

Proof state:
case refine_2.intro.intro.a
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : ↥(torsion K)
w✝ : Fin (rank K) → ℤ
right✝ : ∀ (y : Fin (rank K) → ℤ), (fun e => x = ↑η * ∏ i : Fin (rank K), fundSystem K i ^ e i) y → y = w✝
hf : x = ↑η * ∏ x_1 : Fin (rank K), fundSystem K x_1 ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1
⊢ ↑η = ↑{ val := ζ, property := h_tors }

Next tactic:
dsimp only
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · exact fun _ hf => fun_eq_repr K h_tors hf
  · rintro η ⟨_, hf, _⟩
    simp_rw [fun_eq_repr K η.prop hf] at hf
    ext1; dsimp only
    

Proof state:
case refine_2.intro.intro.a
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : ↥(torsion K)
w✝ : Fin (rank K) → ℤ
right✝ : ∀ (y : Fin (rank K) → ℤ), (fun e => x = ↑η * ∏ i : Fin (rank K), fundSystem K i ^ e i) y → y = w✝
hf : x = ↑η * ∏ x_1 : Fin (rank K), fundSystem K x_1 ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1
⊢ ↑η = x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹

Next tactic:
nth_rewrite 1 [hf]
/-- **Dirichlet Unit Theorem**. Any unit `x` of `𝓞 K` can be written uniquely as the product of
a root of unity and powers of the units of the fundamental system `fundSystem`. -/
theorem exist_unique_eq_mul_prod (x : (𝓞 K)ˣ) : ∃! (ζ : torsion K) (e : Fin (rank K) → ℤ),
    x = ζ * ∏ i, (fundSystem K i) ^ (e i) := by
  let ζ := x * (∏ i, (fundSystem K i) ^ ((basisModTorsion K).repr (Additive.ofMul ↑x) i))⁻¹
  have h_tors : ζ ∈ torsion K := by
    rw [← QuotientGroup.eq_one_iff, QuotientGroup.mk_mul, QuotientGroup.mk_inv, ← ofMul_eq_zero,
      ofMul_mul, ofMul_inv, QuotientGroup.mk_prod, ofMul_prod]
    simp_rw [QuotientGroup.mk_zpow, ofMul_zpow, fundSystem, QuotientGroup.out_eq']
    rw [add_eq_zero_iff_eq_neg, neg_neg]
    exact ((basisModTorsion K).sum_repr (Additive.ofMul ↑x)).symm
  refine ⟨⟨ζ, h_tors⟩, ?_, ?_⟩
  · refine ⟨((basisModTorsion K).repr (Additive.ofMul ↑x) : Fin (rank K) → ℤ), ?_, ?_⟩
    · simp only [_root_.inv_mul_cancel_right]
    · exact fun _ hf => fun_eq_repr K h_tors hf
  · rintro η ⟨_, hf, _⟩
    simp_rw [fun_eq_repr K η.prop hf] at hf
    ext1; dsimp only
    nth_rewrite 1 [hf]
    

Proof state:
case refine_2.intro.intro.a
K : Type u_1
inst✝¹ : Field K
inst✝ : NumberField K
x : (↥(𝓞 K))ˣ
ζ : (↥(𝓞 K))ˣ := x * (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹
h_tors : ζ ∈ torsion K
η : ↥(torsion K)
w✝ : Fin (rank K) → ℤ
right✝ : ∀ (y : Fin (rank K) → ℤ), (fun e => x = ↑η * ∏ i : Fin (rank K), fundSystem K i ^ e i) y → y = w✝
hf : x = ↑η * ∏ x_1 : Fin (rank K), fundSystem K x_1 ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1
⊢ ↑η =
    (↑η * ∏ x_1 : Fin (rank K), fundSystem K x_1 ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) x_1) *
      (∏ i : Fin (rank K), fundSystem K i ^ ((basisModTorsion K).repr (Additive.ofMul ↑x)) i)⁻¹

Next tactic:
rw [_root_.mul_inv_cancel_right]
/-- The equivalence of categories expressing associativity of products of categories.
-/
def associativity : (C × D) × E ≌ C × D × E :=
  Equivalence.mk (associator C D E) (inverseAssociator C D E)
    (NatIso.ofComponents fun X => eqToIso (by 

Proof state:
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
X : (C × D) × E
⊢ (𝟭 ((C × D) × E)).obj X = (associator C D E ⋙ inverseAssociator C D E).obj X

Next tactic:
simp
/-- The equivalence of categories expressing associativity of products of categories.
-/
def associativity : (C × D) × E ≌ C × D × E :=
  Equivalence.mk (associator C D E) (inverseAssociator C D E)
    (NatIso.ofComponents fun X => eqToIso (by simp))
    (NatIso.ofComponents fun X => eqToIso (by 

Proof state:
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
X : C × D × E
⊢ (inverseAssociator C D E ⋙ associator C D E).obj X = (𝟭 (C × D × E)).obj X

Next tactic:
simp
instance associatorIsEquivalence : IsEquivalence (associator C D E) :=
  (by 

Proof state:
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
⊢ IsEquivalence (associativity C D E).functor

Next tactic:
infer_instance
instance inverseAssociatorIsEquivalence : IsEquivalence (inverseAssociator C D E) :=
  (by 

Proof state:
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
⊢ IsEquivalence (associativity C D E).inverse

Next tactic:
infer_instance
theorem approx_of_mem_C (c : CU P) (n : ℕ) {x : X} (hx : x ∈ c.C) : c.approx n x = 0 := by
  

Proof state:
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c : CU P
n : ℕ
x : X
hx : x ∈ c.C
⊢ approx n c x = 0

Next tactic:
induction' n with n ihn generalizing c
theorem approx_of_mem_C (c : CU P) (n : ℕ) {x : X} (hx : x ∈ c.C) : c.approx n x = 0 := by
  induction' n with n ihn generalizing c
  · 

Proof state:
case zero
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
c : CU P
hx : x ∈ c.C
⊢ approx Nat.zero c x = 0

Next tactic:
exact indicator_of_not_mem (fun (hU : x ∈ c.Uᶜ) => hU <| c.subset hx) _
theorem approx_of_mem_C (c : CU P) (n : ℕ) {x : X} (hx : x ∈ c.C) : c.approx n x = 0 := by
  induction' n with n ihn generalizing c
  · exact indicator_of_not_mem (fun (hU : x ∈ c.Uᶜ) => hU <| c.subset hx) _
  · 

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∈ c.C → approx n c x = 0
c : CU P
hx : x ∈ c.C
⊢ approx (Nat.succ n) c x = 0

Next tactic:
simp only [approx]
theorem approx_of_mem_C (c : CU P) (n : ℕ) {x : X} (hx : x ∈ c.C) : c.approx n x = 0 := by
  induction' n with n ihn generalizing c
  · exact indicator_of_not_mem (fun (hU : x ∈ c.Uᶜ) => hU <| c.subset hx) _
  · simp only [approx]
    

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∈ c.C → approx n c x = 0
c : CU P
hx : x ∈ c.C
⊢ midpoint ℝ (approx n (left c) x) (approx n (right c) x) = 0

Next tactic:
rw [ihn, ihn, midpoint_self]
theorem approx_of_mem_C (c : CU P) (n : ℕ) {x : X} (hx : x ∈ c.C) : c.approx n x = 0 := by
  induction' n with n ihn generalizing c
  · exact indicator_of_not_mem (fun (hU : x ∈ c.Uᶜ) => hU <| c.subset hx) _
  · simp only [approx]
    rw [ihn, ihn, midpoint_self]
    

Proof state:
case succ.hx
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∈ c.C → approx n c x = 0
c : CU P
hx : x ∈ c.C
⊢ x ∈ (right c).C
case succ.hx
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∈ c.C → approx n c x = 0
c : CU P
hx : x ∈ c.C
⊢ x ∈ (left c).C

Next tactic:
exacts [c.subset_right_C hx, hx]
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
  

Proof state:
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c : CU P
n : ℕ
x : X
hx : x ∉ c.U
⊢ approx n c x = 1

Next tactic:
induction' n with n ihn generalizing c
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
  induction' n with n ihn generalizing c
  · 

Proof state:
case zero
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
c : CU P
hx : x ∉ c.U
⊢ approx Nat.zero c x = 1

Next tactic:
rw [← mem_compl_iff] at hx
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
  induction' n with n ihn generalizing c
  · rw [← mem_compl_iff] at hx
    

Proof state:
case zero
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
c : CU P
hx : x ∈ c.Uᶜ
⊢ approx Nat.zero c x = 1

Next tactic:
exact indicator_of_mem hx _
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
  induction' n with n ihn generalizing c
  · rw [← mem_compl_iff] at hx
    exact indicator_of_mem hx _
  · 

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∉ c.U → approx n c x = 1
c : CU P
hx : x ∉ c.U
⊢ approx (Nat.succ n) c x = 1

Next tactic:
simp only [approx]
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
  induction' n with n ihn generalizing c
  · rw [← mem_compl_iff] at hx
    exact indicator_of_mem hx _
  · simp only [approx]
    

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∉ c.U → approx n c x = 1
c : CU P
hx : x ∉ c.U
⊢ midpoint ℝ (approx n (left c) x) (approx n (right c) x) = 1

Next tactic:
rw [ihn, ihn, midpoint_self]
theorem approx_of_nmem_U (c : CU P) (n : ℕ) {x : X} (hx : x ∉ c.U) : c.approx n x = 1 := by
  induction' n with n ihn generalizing c
  · rw [← mem_compl_iff] at hx
    exact indicator_of_mem hx _
  · simp only [approx]
    rw [ihn, ihn, midpoint_self]
    

Proof state:
case succ.hx
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∉ c.U → approx n c x = 1
c : CU P
hx : x ∉ c.U
⊢ x ∉ (right c).U
case succ.hx
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), x ∉ c.U → approx n c x = 1
c : CU P
hx : x ∉ c.U
⊢ x ∉ (left c).U

Next tactic:
exacts [hx, fun hU => hx <| c.left_U_subset hU]
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
  

Proof state:
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c : CU P
n : ℕ
x : X
⊢ 0 ≤ approx n c x

Next tactic:
induction' n with n ihn generalizing c
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
  induction' n with n ihn generalizing c
  · 

Proof state:
case zero
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
c : CU P
⊢ 0 ≤ approx Nat.zero c x

Next tactic:
exact indicator_nonneg (fun _ _ => zero_le_one) _
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
  induction' n with n ihn generalizing c
  · exact indicator_nonneg (fun _ _ => zero_le_one) _
  · 

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), 0 ≤ approx n c x
c : CU P
⊢ 0 ≤ approx (Nat.succ n) c x

Next tactic:
simp only [approx, midpoint_eq_smul_add, invOf_eq_inv]
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
  induction' n with n ihn generalizing c
  · exact indicator_nonneg (fun _ _ => zero_le_one) _
  · simp only [approx, midpoint_eq_smul_add, invOf_eq_inv]
    

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), 0 ≤ approx n c x
c : CU P
⊢ 0 ≤ 2⁻¹ • (approx n (left c) x + approx n (right c) x)

Next tactic:
refine' mul_nonneg (inv_nonneg.2 zero_le_two) (add_nonneg _ _)
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
  induction' n with n ihn generalizing c
  · exact indicator_nonneg (fun _ _ => zero_le_one) _
  · simp only [approx, midpoint_eq_smul_add, invOf_eq_inv]
    refine' mul_nonneg (inv_nonneg.2 zero_le_two) (add_nonneg _ _) <;> 

Proof state:
case succ.refine'_1
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), 0 ≤ approx n c x
c : CU P
⊢ 0 ≤ approx n (left c) x

Next tactic:
apply ihn
theorem approx_nonneg (c : CU P) (n : ℕ) (x : X) : 0 ≤ c.approx n x := by
  induction' n with n ihn generalizing c
  · exact indicator_nonneg (fun _ _ => zero_le_one) _
  · simp only [approx, midpoint_eq_smul_add, invOf_eq_inv]
    refine' mul_nonneg (inv_nonneg.2 zero_le_two) (add_nonneg _ _) <;> 

Proof state:
case succ.refine'_2
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), 0 ≤ approx n c x
c : CU P
⊢ 0 ≤ approx n (right c) x

Next tactic:
apply ihn
theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by
  

Proof state:
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c : CU P
n : ℕ
x : X
⊢ approx n c x ≤ 1

Next tactic:
induction' n with n ihn generalizing c
theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by
  induction' n with n ihn generalizing c
  · 

Proof state:
case zero
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
c : CU P
⊢ approx Nat.zero c x ≤ 1

Next tactic:
exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by
  induction' n with n ihn generalizing c
  · exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
  · 

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), approx n c x ≤ 1
c : CU P
⊢ approx (Nat.succ n) c x ≤ 1

Next tactic:
simp only [approx, midpoint_eq_smul_add, invOf_eq_inv, smul_eq_mul, ← div_eq_inv_mul]
theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by
  induction' n with n ihn generalizing c
  · exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
  · simp only [approx, midpoint_eq_smul_add, invOf_eq_inv, smul_eq_mul, ← div_eq_inv_mul]
    

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), approx n c x ≤ 1
c : CU P
⊢ (approx n (left c) x + approx n (right c) x) / 2 ≤ 1

Next tactic:
have := add_le_add (ihn (left c)) (ihn (right c))
theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by
  induction' n with n ihn generalizing c
  · exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
  · simp only [approx, midpoint_eq_smul_add, invOf_eq_inv, smul_eq_mul, ← div_eq_inv_mul]
    have := add_le_add (ihn (left c)) (ihn (right c))
    

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), approx n c x ≤ 1
c : CU P
this : approx n (left c) x + approx n (right c) x ≤ 1 + 1
⊢ (approx n (left c) x + approx n (right c) x) / 2 ≤ 1

Next tactic:
norm_num at this
theorem approx_le_one (c : CU P) (n : ℕ) (x : X) : c.approx n x ≤ 1 := by
  induction' n with n ihn generalizing c
  · exact indicator_apply_le' (fun _ => le_rfl) fun _ => zero_le_one
  · simp only [approx, midpoint_eq_smul_add, invOf_eq_inv, smul_eq_mul, ← div_eq_inv_mul]
    have := add_le_add (ihn (left c)) (ihn (right c))
    norm_num at this
    

Proof state:
case succ
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
x : X
n : ℕ
ihn : ∀ (c : CU P), approx n c x ≤ 1
c : CU P
this : approx n (left c) x + approx n (right c) x ≤ 2
⊢ (approx n (left c) x + approx n (right c) x) / 2 ≤ 1

Next tactic:
exact Iff.mpr (div_le_one zero_lt_two) this
theorem approx_le_approx_of_U_sub_C {c₁ c₂ : CU P} (h : c₁.U ⊆ c₂.C) (n₁ n₂ : ℕ) (x : X) :
    c₂.approx n₂ x ≤ c₁.approx n₁ x := by
  

Proof state:
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c₁ c₂ : CU P
h : c₁.U ⊆ c₂.C
n₁ n₂ : ℕ
x : X
⊢ approx n₂ c₂ x ≤ approx n₁ c₁ x

Next tactic:
by_cases hx : x ∈ c₁.U
theorem approx_le_approx_of_U_sub_C {c₁ c₂ : CU P} (h : c₁.U ⊆ c₂.C) (n₁ n₂ : ℕ) (x : X) :
    c₂.approx n₂ x ≤ c₁.approx n₁ x := by
  by_cases hx : x ∈ c₁.U
  · 

Proof state:
case pos
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c₁ c₂ : CU P
h : c₁.U ⊆ c₂.C
n₁ n₂ : ℕ
x : X
hx : x ∈ c₁.U
⊢ approx n₂ c₂ x ≤ approx n₁ c₁ x

Next tactic:
calc
      approx n₂ c₂ x = 0 := approx_of_mem_C _ _ (h hx)
      _ ≤ approx n₁ c₁ x := approx_nonneg _ _ _
theorem approx_le_approx_of_U_sub_C {c₁ c₂ : CU P} (h : c₁.U ⊆ c₂.C) (n₁ n₂ : ℕ) (x : X) :
    c₂.approx n₂ x ≤ c₁.approx n₁ x := by
  by_cases hx : x ∈ c₁.U
  · calc
      approx n₂ c₂ x = 0 := approx_of_mem_C _ _ (h hx)
      _ ≤ approx n₁ c₁ x := approx_nonneg _ _ _
  · 

Proof state:
case neg
X : Type u_1
inst✝ : TopologicalSpace X
P : Set X → Prop
c₁ c₂ : CU P
h : c₁.U ⊆ c₂.C
n₁ n₂ : ℕ
x : X
hx : x ∉ c₁.U
⊢ approx n₂ c₂ x ≤ approx n₁ c₁ x

Next tactic:
calc
      approx n₂ c₂ x ≤ 1 := approx_le_one _ _ _
      _ = approx n₁ c₁ x := (approx_of_nmem_U _ _ hx).symm