l3lab/ntp-mathlib huggingface dataset:
theorem ergodic_zsmul_add (x : AddCircle T) {n : ℤ} (h : 1 < |n|) : Ergodic fun y => n • y + x := by
  set f : AddCircle T → AddCircle T := fun y => n • y + x
  let e : AddCircle T ≃ᵐ AddCircle T := MeasurableEquiv.addLeft (DivisibleBy.div x <| n - 1)
  have he : MeasurePreserving e volume volume :=
    measurePreserving_add_left volume (DivisibleBy.div x <| n - 1)
  suffices e ∘ f ∘ e.symm = fun y => n • y by
    rw [← he.ergodic_conjugate_iff, this]; exact ergodic_zsmul h
  replace h : n - 1 ≠ 0
  · rw [← abs_one] at h; rw [sub_ne_zero]; exact ne_of_apply_ne _ (ne_of_gt h)
  have hnx : n • DivisibleBy.div x (n - 1) = x + DivisibleBy.div x (n - 1) := by
    conv_rhs => congr; rw [← DivisibleBy.div_cancel x h]
    rw [sub_smul, one_smul, sub_add_cancel]
  ext y
  simp only [hnx, MeasurableEquiv.coe_addLeft, MeasurableEquiv.symm_addLeft, comp_apply, smul_add,
    zsmul_neg', neg_smul, neg_add_rev]
  

Proof state:
case h
T : ℝ
hT : Fact (0 < T)
x : AddCircle T
n : ℤ
f : AddCircle T → AddCircle T := fun y => n • y + x
e : AddCircle T ≃ᵐ AddCircle T := MeasurableEquiv.addLeft (DivisibleBy.div x (n - 1))
he : MeasurePreserving ⇑e
h : n - 1 ≠ 0
hnx : n • DivisibleBy.div x (n - 1) = x + DivisibleBy.div x (n - 1)
y : AddCircle T
⊢ DivisibleBy.div x (n - 1) + (-DivisibleBy.div x (n - 1) + -x + n • y + x) = n • y

Next tactic:
abel
theorem ergodic_nsmul_add (x : AddCircle T) {n : ℕ} (h : 1 < n) : Ergodic fun y => n • y + x :=
  ergodic_zsmul_add x (by 

Proof state:
T : ℝ
hT : Fact (0 < T)
x : AddCircle T
n : ℕ
h : 1 < n
⊢ 1 < |↑n|

Next tactic:
simp [h]
@[simp]
theorem continuous_proj :
    Continuous (Proj J : (I → Bool) → (I → Bool)) := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
⊢ Continuous (Proj J)

Next tactic:
dsimp (config := { unfoldPartialApp := true }) [Proj]
@[simp]
theorem continuous_proj :
    Continuous (Proj J : (I → Bool) → (I → Bool)) := by
  dsimp (config := { unfoldPartialApp := true }) [Proj]
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
⊢ Continuous fun c i => if J i then c i else false

Next tactic:
apply continuous_pi
@[simp]
theorem continuous_proj :
    Continuous (Proj J : (I → Bool) → (I → Bool)) := by
  dsimp (config := { unfoldPartialApp := true }) [Proj]
  apply continuous_pi
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
⊢ ∀ (i : I), Continuous fun a => if J i then a i else false

Next tactic:
intro i
@[simp]
theorem continuous_proj :
    Continuous (Proj J : (I → Bool) → (I → Bool)) := by
  dsimp (config := { unfoldPartialApp := true }) [Proj]
  apply continuous_pi
  intro i
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
i : I
⊢ Continuous fun a => if J i then a i else false

Next tactic:
split
@[simp]
theorem continuous_proj :
    Continuous (Proj J : (I → Bool) → (I → Bool)) := by
  dsimp (config := { unfoldPartialApp := true }) [Proj]
  apply continuous_pi
  intro i
  split
  · 

Proof state:
case h.inl
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
i : I
h✝ : J i
⊢ Continuous fun a => a i

Next tactic:
apply continuous_apply
@[simp]
theorem continuous_proj :
    Continuous (Proj J : (I → Bool) → (I → Bool)) := by
  dsimp (config := { unfoldPartialApp := true }) [Proj]
  apply continuous_pi
  intro i
  split
  · apply continuous_apply
  · 

Proof state:
case h.inr
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
i : I
h✝ : ¬J i
⊢ Continuous fun a => false

Next tactic:
apply continuous_const
theorem proj_eq_self {x : I → Bool} (h : ∀ i, x i ≠ false → J i) : Proj J x = x := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
x : I → Bool
h : ∀ (i : I), x i ≠ false → J i
⊢ Proj J x = x

Next tactic:
ext i
theorem proj_eq_self {x : I → Bool} (h : ∀ i, x i ≠ false → J i) : Proj J x = x := by
  ext i
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
x : I → Bool
h : ∀ (i : I), x i ≠ false → J i
i : I
⊢ Proj J x i = x i

Next tactic:
simp only [Proj, ite_eq_left_iff]
theorem proj_eq_self {x : I → Bool} (h : ∀ i, x i ≠ false → J i) : Proj J x = x := by
  ext i
  simp only [Proj, ite_eq_left_iff]
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
x : I → Bool
h : ∀ (i : I), x i ≠ false → J i
i : I
⊢ ¬J i → false = x i

Next tactic:
contrapose!
theorem proj_eq_self {x : I → Bool} (h : ∀ i, x i ≠ false → J i) : Proj J x = x := by
  ext i
  simp only [Proj, ite_eq_left_iff]
  contrapose!
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
x : I → Bool
h : ∀ (i : I), x i ≠ false → J i
i : I
⊢ false ≠ x i → J i

Next tactic:
simpa only [ne_comm] using h i
theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hh : ∀ (i : I), ∀ x ∈ C, x i ≠ false → J i
⊢ π C J = C

Next tactic:
ext x
theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by
  ext x
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hh : ∀ (i : I), ∀ x ∈ C, x i ≠ false → J i
x : I → Bool
⊢ x ∈ π C J ↔ x ∈ C

Next tactic:
refine ⟨fun ⟨y, hy, h⟩ ↦ ?_, fun h ↦ ⟨x, h, ?_⟩⟩
theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by
  ext x
  refine ⟨fun ⟨y, hy, h⟩ ↦ ?_, fun h ↦ ⟨x, h, ?_⟩⟩
  · 

Proof state:
case h.refine_1
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hh : ∀ (i : I), ∀ x ∈ C, x i ≠ false → J i
x : I → Bool
x✝ : x ∈ π C J
y : I → Bool
hy : y ∈ C
h : Proj J y = x
⊢ x ∈ C

Next tactic:
rwa [← h, proj_eq_self]
theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by
  ext x
  refine ⟨fun ⟨y, hy, h⟩ ↦ ?_, fun h ↦ ⟨x, h, ?_⟩⟩
  · rwa [← h, proj_eq_self]; 

Proof state:
case h.refine_1.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hh : ∀ (i : I), ∀ x ∈ C, x i ≠ false → J i
x : I → Bool
x✝ : x ∈ π C J
y : I → Bool
hy : y ∈ C
h : Proj J y = x
⊢ ∀ (i : I), y i ≠ false → J i

Next tactic:
exact (hh · y hy)
theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by
  ext x
  refine ⟨fun ⟨y, hy, h⟩ ↦ ?_, fun h ↦ ⟨x, h, ?_⟩⟩
  · rwa [← h, proj_eq_self]; exact (hh · y hy)
  · 

Proof state:
case h.refine_2
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hh : ∀ (i : I), ∀ x ∈ C, x i ≠ false → J i
x : I → Bool
h : x ∈ C
⊢ Proj J x = x

Next tactic:
rw [proj_eq_self]
theorem proj_prop_eq_self (hh : ∀ i x, x ∈ C → x i ≠ false → J i) : π C J = C := by
  ext x
  refine ⟨fun ⟨y, hy, h⟩ ↦ ?_, fun h ↦ ⟨x, h, ?_⟩⟩
  · rwa [← h, proj_eq_self]; exact (hh · y hy)
  · rw [proj_eq_self]; 

Proof state:
case h.refine_2.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hh : ∀ (i : I), ∀ x ∈ C, x i ≠ false → J i
x : I → Bool
h : x ∈ C
⊢ ∀ (i : I), x i ≠ false → J i

Next tactic:
exact (hh · x h)
theorem proj_comp_of_subset (h : ∀ i, J i → K i) : (Proj J ∘ Proj K) =
    (Proj J : (I → Bool) → (I → Bool)) := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
⊢ Proj J ∘ Proj K = Proj J

Next tactic:
ext x i
theorem proj_comp_of_subset (h : ∀ i, J i → K i) : (Proj J ∘ Proj K) =
    (Proj J : (I → Bool) → (I → Bool)) := by
  ext x i; 

Proof state:
case h.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
x : I → Bool
i : I
⊢ (Proj J ∘ Proj K) x i = Proj J x i

Next tactic:
dsimp [Proj]
theorem proj_comp_of_subset (h : ∀ i, J i → K i) : (Proj J ∘ Proj K) =
    (Proj J : (I → Bool) → (I → Bool)) := by
  ext x i; dsimp [Proj]; 

Proof state:
case h.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
x : I → Bool
i : I
⊢ (if J i then if K i then x i else false else false) = if J i then x i else false

Next tactic:
aesop
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
⊢ π (π C K) J = π C J

Next tactic:
ext x
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  

Proof state:
case h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
x : I → Bool
⊢ x ∈ π (π C K) J ↔ x ∈ π C J

Next tactic:
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · 

Proof state:
case h.refine_1
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h✝ : ∀ (i : I), J i → K i
x : I → Bool
h : x ∈ π (π C K) J
⊢ x ∈ π C J

Next tactic:
obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    

Proof state:
case h.refine_1.intro.intro.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
z : I → Bool
hz : z ∈ C
⊢ Proj J (Proj K z) ∈ π C J

Next tactic:
refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
    

Proof state:
case h.refine_1.intro.intro.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
z : I → Bool
hz : z ∈ C
⊢ Proj J z = (Proj J ∘ Proj K) z

Next tactic:
rw [proj_comp_of_subset J K h]
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
    rw [proj_comp_of_subset J K h]
  · 

Proof state:
case h.refine_2
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h✝ : ∀ (i : I), J i → K i
x : I → Bool
h : x ∈ π C J
⊢ x ∈ π (π C K) J

Next tactic:
obtain ⟨y, hy, rfl⟩ := h
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
    rw [proj_comp_of_subset J K h]
  · obtain ⟨y, hy, rfl⟩ := h
    

Proof state:
case h.refine_2.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
y : I → Bool
hy : y ∈ C
⊢ Proj J y ∈ π (π C K) J

Next tactic:
dsimp [π]
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
    rw [proj_comp_of_subset J K h]
  · obtain ⟨y, hy, rfl⟩ := h
    dsimp [π]
    

Proof state:
case h.refine_2.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
y : I → Bool
hy : y ∈ C
⊢ Proj J y ∈ Proj J '' (Proj K '' C)

Next tactic:
rw [← Set.image_comp]
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
    rw [proj_comp_of_subset J K h]
  · obtain ⟨y, hy, rfl⟩ := h
    dsimp [π]
    rw [← Set.image_comp]
    

Proof state:
case h.refine_2.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
y : I → Bool
hy : y ∈ C
⊢ Proj J y ∈ Proj J ∘ Proj K '' C

Next tactic:
refine ⟨y, hy, ?_⟩
theorem proj_eq_of_subset (h : ∀ i, J i → K i) : π (π C K) J = π C J := by
  ext x
  refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
  · obtain ⟨y, ⟨z, hz, rfl⟩, rfl⟩ := h
    refine ⟨z, hz, (?_ : _ = (Proj J ∘ Proj K) z)⟩
    rw [proj_comp_of_subset J K h]
  · obtain ⟨y, hy, rfl⟩ := h
    dsimp [π]
    rw [← Set.image_comp]
    refine ⟨y, hy, ?_⟩
    

Proof state:
case h.refine_2.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
y : I → Bool
hy : y ∈ C
⊢ (Proj J ∘ Proj K) y = Proj J y

Next tactic:
rw [proj_comp_of_subset J K h]
variable (J) in
theorem projRestricts_eq_id : ProjRestricts C (fun i (h : J i) ↦ h) = id := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
⊢ ProjRestricts C (_ : ∀ (i : I), J i → J i) = id

Next tactic:
ext ⟨x, y, hy, rfl⟩ i
variable (J) in
theorem projRestricts_eq_id : ProjRestricts C (fun i (h : J i) ↦ h) = id := by
  ext ⟨x, y, hy, rfl⟩ i
  

Proof state:
case h.mk.intro.intro.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
y : I → Bool
hy : y ∈ C
i : I
⊢ ↑(ProjRestricts C (_ : ∀ (i : I), J i → J i)
          { val := Proj (fun i => J i) y, property := (_ : ∃ a ∈ C, Proj (fun i => J i) a = Proj (fun i => J i) y) })
      i =
    ↑(id { val := Proj (fun i => J i) y, property := (_ : ∃ a ∈ C, Proj (fun i => J i) a = Proj (fun i => J i) y) }) i

Next tactic:
simp (config := { contextual := true }) only [π, Proj, ProjRestricts_coe, id_eq, if_true]
theorem projRestricts_eq_comp (hJK : ∀ i, J i → K i) (hKL : ∀ i, K i → L i) :
    ProjRestricts C hJK ∘ ProjRestricts C hKL = ProjRestricts C (fun i ↦ hKL i ∘ hJK i) := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hJK : ∀ (i : I), J i → K i
hKL : ∀ (i : I), K i → L i
⊢ ProjRestricts C hJK ∘ ProjRestricts C hKL = ProjRestricts C (_ : ∀ (i : I), J i → L i)

Next tactic:
ext x i
theorem projRestricts_eq_comp (hJK : ∀ i, J i → K i) (hKL : ∀ i, K i → L i) :
    ProjRestricts C hJK ∘ ProjRestricts C hKL = ProjRestricts C (fun i ↦ hKL i ∘ hJK i) := by
  ext x i
  

Proof state:
case h.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hJK : ∀ (i : I), J i → K i
hKL : ∀ (i : I), K i → L i
x : ↑(π C fun i => L i)
i : I
⊢ ↑((ProjRestricts C hJK ∘ ProjRestricts C hKL) x) i = ↑(ProjRestricts C (_ : ∀ (i : I), J i → L i) x) i

Next tactic:
simp only [π, Proj, Function.comp_apply, ProjRestricts_coe]
theorem projRestricts_eq_comp (hJK : ∀ i, J i → K i) (hKL : ∀ i, K i → L i) :
    ProjRestricts C hJK ∘ ProjRestricts C hKL = ProjRestricts C (fun i ↦ hKL i ∘ hJK i) := by
  ext x i
  simp only [π, Proj, Function.comp_apply, ProjRestricts_coe]
  

Proof state:
case h.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
hJK : ∀ (i : I), J i → K i
hKL : ∀ (i : I), K i → L i
x : ↑(π C fun i => L i)
i : I
⊢ (if J i then if K i then ↑x i else false else false) = if J i then ↑x i else false

Next tactic:
aesop
theorem projRestricts_comp_projRestrict (h : ∀ i, J i → K i) :
    ProjRestricts C h ∘ ProjRestrict C K = ProjRestrict C J := by
  

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
⊢ ProjRestricts C h ∘ ProjRestrict C K = ProjRestrict C J

Next tactic:
ext x i
theorem projRestricts_comp_projRestrict (h : ∀ i, J i → K i) :
    ProjRestricts C h ∘ ProjRestrict C K = ProjRestrict C J := by
  ext x i
  

Proof state:
case h.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
x : ↑C
i : I
⊢ ↑((ProjRestricts C h ∘ ProjRestrict C K) x) i = ↑(ProjRestrict C J x) i

Next tactic:
simp only [π, Proj, Function.comp_apply, ProjRestricts_coe, ProjRestrict_coe]
theorem projRestricts_comp_projRestrict (h : ∀ i, J i → K i) :
    ProjRestricts C h ∘ ProjRestrict C K = ProjRestrict C J := by
  ext x i
  simp only [π, Proj, Function.comp_apply, ProjRestricts_coe, ProjRestrict_coe]
  

Proof state:
case h.a.h
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
h : ∀ (i : I), J i → K i
x : ↑C
i : I
⊢ (if J i then if K i then ↑x i else false else false) = if J i then ↑x i else false

Next tactic:
aesop
/-- The objectwise map in the isomorphism `spanFunctor ≅ Profinite.indexFunctor`. -/
def iso_map : C(π C J, (IndexFunctor.obj C J)) :=
  ⟨fun x ↦ ⟨fun i ↦ x.val i.val, by
    

Proof state:
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
x : ↑(π C J)
⊢ (fun i => ↑x ↑i) ∈ IndexFunctor.obj C J

Next tactic:
rcases x with ⟨x, y, hy, rfl⟩
/-- The objectwise map in the isomorphism `spanFunctor ≅ Profinite.indexFunctor`. -/
def iso_map : C(π C J, (IndexFunctor.obj C J)) :=
  ⟨fun x ↦ ⟨fun i ↦ x.val i.val, by
    rcases x with ⟨x, y, hy, rfl⟩
    

Proof state:
case mk.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
y : I → Bool
hy : y ∈ C
⊢ (fun i => ↑{ val := Proj J y, property := (_ : ∃ a ∈ C, Proj J a = Proj J y) } ↑i) ∈ IndexFunctor.obj C J

Next tactic:
refine ⟨y, hy, ?_⟩
/-- The objectwise map in the isomorphism `spanFunctor ≅ Profinite.indexFunctor`. -/
def iso_map : C(π C J, (IndexFunctor.obj C J)) :=
  ⟨fun x ↦ ⟨fun i ↦ x.val i.val, by
    rcases x with ⟨x, y, hy, rfl⟩
    refine ⟨y, hy, ?_⟩
    

Proof state:
case mk.intro.intro
I : Type u
inst✝⁵ : Inhabited I
inst✝⁴ : LinearOrder I
inst✝³ : IsWellOrder I fun x x_1 => x < x_1
C : Set (I → Bool)
J K L : I → Prop
inst✝² : (i : I) → Decidable (J i)
inst✝¹ : (i : I) → Decidable (K i)
inst✝ : (i : I) → Decidable (L i)
y : I → Bool
hy : y ∈ C
⊢ (precomp Subtype.val) y = fun i => ↑{ val := Proj J y, property := (_ : ∃ a ∈ C, Proj J a = Proj J y) } ↑i

Next tactic:
ext ⟨i, hi⟩