l3lab/ntp-mathlib huggingface dataset:
lemma not_mem_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    t ∉ hC.diffFinset hs ht := by
  intro hs_mem
  suffices t ⊆ s \ t by
    have h := @disjoint_sdiff_self_right _ t s _
    specialize h le_rfl this
    simp only [Set.bot_eq_empty, Set.le_eq_subset, subset_empty_iff] at h
    refine hC.empty_not_mem_diffFinset hs ht ?_
    rwa [← h]
  rw [← hC.sUnion_diffFinset hs ht]
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
hs_mem : t ∈ diffFinset hC hs ht
⊢ t ⊆ ⋃₀ ↑(diffFinset hC hs ht)

Next tactic:
exact subset_sUnion_of_mem hs_mem
lemma sUnion_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) (hst : t ⊆ s) :
    ⋃₀ insert t (hC.diffFinset hs ht) = s := by
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
hst : t ⊆ s
⊢ ⋃₀ insert t ↑(diffFinset hC hs ht) = s

Next tactic:
conv_rhs => rw [← union_diff_cancel hst, ← hC.sUnion_diffFinset hs ht]
lemma sUnion_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) (hst : t ⊆ s) :
    ⋃₀ insert t (hC.diffFinset hs ht) = s := by
  conv_rhs => 

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
hst : t ⊆ s
| s

Next tactic:
rw [← union_diff_cancel hst, ← hC.sUnion_diffFinset hs ht]
lemma sUnion_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) (hst : t ⊆ s) :
    ⋃₀ insert t (hC.diffFinset hs ht) = s := by
  conv_rhs => rw [← union_diff_cancel hst, ← hC.sUnion_diffFinset hs ht]
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
hst : t ⊆ s
⊢ ⋃₀ insert t ↑(diffFinset hC hs ht) = t ∪ ⋃₀ ↑(diffFinset hC hs ht)

Next tactic:
simp only [mem_coe, sUnion_insert]
lemma disjoint_sUnion_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    Disjoint t (⋃₀ hC.diffFinset hs ht) := by
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
⊢ Disjoint t (⋃₀ ↑(diffFinset hC hs ht))

Next tactic:
rw [hC.sUnion_diffFinset]
lemma disjoint_sUnion_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    Disjoint t (⋃₀ hC.diffFinset hs ht) := by
  rw [hC.sUnion_diffFinset]
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
⊢ Disjoint t (s \ t)

Next tactic:
exact disjoint_sdiff_right
lemma pairwiseDisjoint_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    PairwiseDisjoint (insert t (hC.diffFinset hs ht) : Set (Set α)) id := by
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
⊢ PairwiseDisjoint (insert t ↑(diffFinset hC hs ht)) id

Next tactic:
have h := hC.pairwiseDisjoint_diffFinset hs ht
lemma pairwiseDisjoint_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    PairwiseDisjoint (insert t (hC.diffFinset hs ht) : Set (Set α)) id := by
  have h := hC.pairwiseDisjoint_diffFinset hs ht
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
h : PairwiseDisjoint (↑(diffFinset hC hs ht)) id
⊢ PairwiseDisjoint (insert t ↑(diffFinset hC hs ht)) id

Next tactic:
refine PairwiseDisjoint.insert_of_not_mem h (hC.not_mem_diffFinset hs ht) fun u hu ↦ ?_
lemma pairwiseDisjoint_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    PairwiseDisjoint (insert t (hC.diffFinset hs ht) : Set (Set α)) id := by
  have h := hC.pairwiseDisjoint_diffFinset hs ht
  refine PairwiseDisjoint.insert_of_not_mem h (hC.not_mem_diffFinset hs ht) fun u hu ↦ ?_
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
h : PairwiseDisjoint (↑(diffFinset hC hs ht)) id
u : Set α
hu : u ∈ ↑(diffFinset hC hs ht)
⊢ Disjoint (id t) (id u)

Next tactic:
simp_rw [id.def]
lemma pairwiseDisjoint_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    PairwiseDisjoint (insert t (hC.diffFinset hs ht) : Set (Set α)) id := by
  have h := hC.pairwiseDisjoint_diffFinset hs ht
  refine PairwiseDisjoint.insert_of_not_mem h (hC.not_mem_diffFinset hs ht) fun u hu ↦ ?_
  simp_rw [id.def]
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
h : PairwiseDisjoint (↑(diffFinset hC hs ht)) id
u : Set α
hu : u ∈ ↑(diffFinset hC hs ht)
⊢ Disjoint t u

Next tactic:
refine Disjoint.mono_right ?_ (hC.disjoint_sUnion_diffFinset hs ht)
lemma pairwiseDisjoint_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    PairwiseDisjoint (insert t (hC.diffFinset hs ht) : Set (Set α)) id := by
  have h := hC.pairwiseDisjoint_diffFinset hs ht
  refine PairwiseDisjoint.insert_of_not_mem h (hC.not_mem_diffFinset hs ht) fun u hu ↦ ?_
  simp_rw [id.def]
  refine Disjoint.mono_right ?_ (hC.disjoint_sUnion_diffFinset hs ht)
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
h : PairwiseDisjoint (↑(diffFinset hC hs ht)) id
u : Set α
hu : u ∈ ↑(diffFinset hC hs ht)
⊢ u ≤ ⋃₀ ↑(diffFinset hC hs ht)

Next tactic:
simp only [Set.le_eq_subset]
lemma pairwiseDisjoint_insert_diffFinset (hC : IsSetSemiring C) (hs : s ∈ C) (ht : t ∈ C) :
    PairwiseDisjoint (insert t (hC.diffFinset hs ht) : Set (Set α)) id := by
  have h := hC.pairwiseDisjoint_diffFinset hs ht
  refine PairwiseDisjoint.insert_of_not_mem h (hC.not_mem_diffFinset hs ht) fun u hu ↦ ?_
  simp_rw [id.def]
  refine Disjoint.mono_right ?_ (hC.disjoint_sUnion_diffFinset hs ht)
  simp only [Set.le_eq_subset]
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
hC : IsSetSemiring C
hs : s ∈ C
ht : t ∈ C
h : PairwiseDisjoint (↑(diffFinset hC hs ht)) id
u : Set α
hu : u ∈ ↑(diffFinset hC hs ht)
⊢ u ⊆ ⋃₀ ↑(diffFinset hC hs ht)

Next tactic:
exact subset_sUnion_of_mem hu
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
hI : ↑I ⊆ C
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I = ⋃₀ ↑J

Next tactic:
revert hI
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  

Proof state:
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
⊢ ↑I ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I = ⋃₀ ↑J

Next tactic:
refine Finset.induction ?_ ?_ I
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · 

Proof state:
case refine_1
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
⊢ ↑∅ ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑∅ = ⋃₀ ↑J

Next tactic:
intro
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    

Proof state:
case refine_1
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
hI✝ : ↑∅ ⊆ C
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑∅ = ⋃₀ ↑J

Next tactic:
simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    

Proof state:
case refine_1
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
hI✝ : ↑∅ ⊆ C
⊢ ∃ J, ↑J ⊆ C ∧ PairwiseDisjoint (↑J) id ∧ s = ⋃₀ ↑J

Next tactic:
refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    

Proof state:
case refine_1
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
hI✝ : ↑∅ ⊆ C
⊢ PairwiseDisjoint (↑{s}) id ∧ s = ⋃₀ ↑{s}

Next tactic:
simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  

Proof state:
case refine_2
α : Type u_1
C : Set (Set α)
s t : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
⊢ ∀ ⦃a : Set α⦄ {s_1 : Finset (Set α)},
    a ∉ s_1 →
      (↑s_1 ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑s_1 = ⋃₀ ↑J) →
        ↑(insert a s_1) ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert a s_1) = ⋃₀ ↑J

Next tactic:
intro t I' _ h h_insert_subset
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  

Proof state:
case refine_2
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : ↑(insert t I') ⊆ C
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert t I') = ⋃₀ ↑J

Next tactic:
rw [coe_insert] at h_insert_subset
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  

Proof state:
case refine_2
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert t I') = ⋃₀ ↑J

Next tactic:
have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
  

Proof state:
case refine_2
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
ht : t ∈ C
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert t I') = ⋃₀ ↑J

Next tactic:
obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans h_insert_subset)
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
  obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans h_insert_subset)
  

Proof state:
case refine_2.intro.intro.intro
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
ht : t ∈ C
J : Finset (Set α)
h_ss : ↑J ⊆ C
h_dis : PairwiseDisjoint (↑J) id
h_eq : s \ ⋃₀ ↑I' = ⋃₀ ↑J
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert t I') = ⋃₀ ↑J

Next tactic:
let Ju : ∀ u ∈ C, Finset (Set α) := fun u hu ↦ hC.diffFinset hu ht
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
  obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans h_insert_subset)
  let Ju : ∀ u ∈ C, Finset (Set α) := fun u hu ↦ hC.diffFinset hu ht
  

Proof state:
case refine_2.intro.intro.intro
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
ht : t ∈ C
J : Finset (Set α)
h_ss : ↑J ⊆ C
h_dis : PairwiseDisjoint (↑J) id
h_eq : s \ ⋃₀ ↑I' = ⋃₀ ↑J
Ju : (u : Set α) → u ∈ C → Finset (Set α) := fun u hu => diffFinset hC hu ht
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert t I') = ⋃₀ ↑J

Next tactic:
have hJu_subset : ∀ (u) (hu : u ∈ C), ↑(Ju u hu) ⊆ C := by
    intro u hu x hx
    exact hC.diffFinset_subset hu ht hx
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
  obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans h_insert_subset)
  let Ju : ∀ u ∈ C, Finset (Set α) := fun u hu ↦ hC.diffFinset hu ht
  have hJu_subset : ∀ (u) (hu : u ∈ C), ↑(Ju u hu) ⊆ C := by
    

Proof state:
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
ht : t ∈ C
J : Finset (Set α)
h_ss : ↑J ⊆ C
h_dis : PairwiseDisjoint (↑J) id
h_eq : s \ ⋃₀ ↑I' = ⋃₀ ↑J
Ju : (u : Set α) → u ∈ C → Finset (Set α) := fun u hu => diffFinset hC hu ht
⊢ ∀ (u : Set α) (hu : u ∈ C), ↑(Ju u hu) ⊆ C

Next tactic:
intro u hu x hx
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
  obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans h_insert_subset)
  let Ju : ∀ u ∈ C, Finset (Set α) := fun u hu ↦ hC.diffFinset hu ht
  have hJu_subset : ∀ (u) (hu : u ∈ C), ↑(Ju u hu) ⊆ C := by
    intro u hu x hx
    

Proof state:
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
ht : t ∈ C
J : Finset (Set α)
h_ss : ↑J ⊆ C
h_dis : PairwiseDisjoint (↑J) id
h_eq : s \ ⋃₀ ↑I' = ⋃₀ ↑J
Ju : (u : Set α) → u ∈ C → Finset (Set α) := fun u hu => diffFinset hC hu ht
u : Set α
hu : u ∈ C
x : Set α
hx : x ∈ ↑(Ju u hu)
⊢ x ∈ C

Next tactic:
exact hC.diffFinset_subset hu ht hx
/-- In a semiring of sets `C`, for all set `s ∈ C` and finite set of sets `I ⊆ C`, there is a
finite set of sets in `C` whose union is `s \ ⋃₀ I`.
See `IsSetSemiring.diffFinset₀` for a definition that gives such a set. -/
lemma exists_disjoint_finset_diff_eq (hC : IsSetSemiring C) (hs : s ∈ C) (hI : ↑I ⊆ C) :
    ∃ (J : Finset (Set α)) (_h_ss : ↑J ⊆ C) (_h_dis : PairwiseDisjoint (J : Set (Set α)) id),
      s \ ⋃₀ I = ⋃₀ J := by
  classical
  revert hI
  refine Finset.induction ?_ ?_ I
  · intro
    simp only [coe_empty, sUnion_empty, diff_empty, exists_prop]
    refine ⟨{s}, singleton_subset_set_iff.mpr hs, ?_⟩
    simp only [coe_singleton, pairwiseDisjoint_singleton, sUnion_singleton, eq_self_iff_true,
      and_self_iff]
  intro t I' _ h h_insert_subset
  rw [coe_insert] at h_insert_subset
  have ht : t ∈ C := h_insert_subset (Set.mem_insert _ _)
  obtain ⟨J, h_ss, h_dis, h_eq⟩ := h ((Set.subset_insert _ _).trans h_insert_subset)
  let Ju : ∀ u ∈ C, Finset (Set α) := fun u hu ↦ hC.diffFinset hu ht
  have hJu_subset : ∀ (u) (hu : u ∈ C), ↑(Ju u hu) ⊆ C := by
    intro u hu x hx
    exact hC.diffFinset_subset hu ht hx
  

Proof state:
case refine_2.intro.intro.intro
α : Type u_1
C : Set (Set α)
s t✝ : Set α
I : Finset (Set α)
hC : IsSetSemiring C
hs : s ∈ C
t : Set α
I' : Finset (Set α)
a✝ : t ∉ I'
h : ↑I' ⊆ C → ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑I' = ⋃₀ ↑J
h_insert_subset : insert t ↑I' ⊆ C
ht : t ∈ C
J : Finset (Set α)
h_ss : ↑J ⊆ C
h_dis : PairwiseDisjoint (↑J) id
h_eq : s \ ⋃₀ ↑I' = ⋃₀ ↑J
Ju : (u : Set α) → u ∈ C → Finset (Set α) := fun u hu => diffFinset hC hu ht
hJu_subset : ∀ (u : Set α) (hu : u ∈ C), ↑(Ju u hu) ⊆ C
⊢ ∃ J, ∃ (_ : ↑J ⊆ C) (_ : PairwiseDisjoint (↑J) id), s \ ⋃₀ ↑(insert t I') = ⋃₀ ↑J

Next tactic:
have hJu_disj : ∀ (u) (hu : u ∈ C), (Ju u hu : Set (Set α)).PairwiseDisjoint id := fun u hu ↦
    hC.pairwiseDisjoint_diffFinset hu ht