l3lab/ntp-mathlib huggingface dataset:
@[elab_as_elim]
protected theorem induction_on {C : (⨁ i, β i) → Prop} (x : ⨁ i, β i) (H_zero : C 0)
    (H_basic : ∀ (i : ι) (x : β i), C (of β i x))
    (H_plus : ∀ x y, C x → C y → C (x + y)) : C x := by
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝ : (i : ι) → AddCommMonoid (β i)
C : (⨁ (i : ι), β i) → Prop
x : ⨁ (i : ι), β i
H_zero : C 0
H_basic : ∀ (i : ι) (x : β i), C ((of β i) x)
H_plus : ∀ (x y : ⨁ (i : ι), β i), C x → C y → C (x + y)
⊢ C x

Next tactic:
apply DFinsupp.induction x H_zero
@[elab_as_elim]
protected theorem induction_on {C : (⨁ i, β i) → Prop} (x : ⨁ i, β i) (H_zero : C 0)
    (H_basic : ∀ (i : ι) (x : β i), C (of β i x))
    (H_plus : ∀ x y, C x → C y → C (x + y)) : C x := by
  apply DFinsupp.induction x H_zero
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝ : (i : ι) → AddCommMonoid (β i)
C : (⨁ (i : ι), β i) → Prop
x : ⨁ (i : ι), β i
H_zero : C 0
H_basic : ∀ (i : ι) (x : β i), C ((of β i) x)
H_plus : ∀ (x y : ⨁ (i : ι), β i), C x → C y → C (x + y)
⊢ ∀ (i : ι) (b : (fun i => β i) i) (f : Π₀ (i : ι), (fun i => β i) i),
    f i = 0 → b ≠ 0 → C f → C (DFinsupp.single i b + f)

Next tactic:
intro i b f h1 h2 ih
@[elab_as_elim]
protected theorem induction_on {C : (⨁ i, β i) → Prop} (x : ⨁ i, β i) (H_zero : C 0)
    (H_basic : ∀ (i : ι) (x : β i), C (of β i x))
    (H_plus : ∀ x y, C x → C y → C (x + y)) : C x := by
  apply DFinsupp.induction x H_zero
  intro i b f h1 h2 ih
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝ : (i : ι) → AddCommMonoid (β i)
C : (⨁ (i : ι), β i) → Prop
x : ⨁ (i : ι), β i
H_zero : C 0
H_basic : ∀ (i : ι) (x : β i), C ((of β i) x)
H_plus : ∀ (x y : ⨁ (i : ι), β i), C x → C y → C (x + y)
i : ι
b : β i
f : Π₀ (i : ι), (fun i => β i) i
h1 : f i = 0
h2 : b ≠ 0
ih : C f
⊢ C (DFinsupp.single i b + f)

Next tactic:
solve_by_elim
theorem toAddMonoid.unique (f : ⨁ i, β i) : ψ f = toAddMonoid (fun i => ψ.comp (of β i)) f := by
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
φ : (i : ι) → β i →+ γ
ψ : (⨁ (i : ι), β i) →+ γ
f : ⨁ (i : ι), β i
⊢ ψ f = (toAddMonoid fun i => AddMonoidHom.comp ψ (of β i)) f

Next tactic:
congr
theorem toAddMonoid.unique (f : ⨁ i, β i) : ψ f = toAddMonoid (fun i => ψ.comp (of β i)) f := by
  congr
  -- Porting note: ext applies addHom_ext' here, which isn't what we want.
  

Proof state:
case e_a
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
φ : (i : ι) → β i →+ γ
ψ : (⨁ (i : ι), β i) →+ γ
f : ⨁ (i : ι), β i
⊢ ψ = toAddMonoid fun i => AddMonoidHom.comp ψ (of β i)

Next tactic:
apply DFinsupp.addHom_ext'
theorem toAddMonoid.unique (f : ⨁ i, β i) : ψ f = toAddMonoid (fun i => ψ.comp (of β i)) f := by
  congr
  -- Porting note: ext applies addHom_ext' here, which isn't what we want.
  apply DFinsupp.addHom_ext'
  

Proof state:
case e_a.H
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
φ : (i : ι) → β i →+ γ
ψ : (⨁ (i : ι), β i) →+ γ
f : ⨁ (i : ι), β i
⊢ ∀ (x : ι),
    AddMonoidHom.comp ψ (DFinsupp.singleAddHom (fun i => (fun i => β i) i) x) =
      AddMonoidHom.comp (toAddMonoid fun i => AddMonoidHom.comp ψ (of β i))
        (DFinsupp.singleAddHom (fun i => (fun i => β i) i) x)

Next tactic:
simp [toAddMonoid, of]
@[simp]
theorem fromAddMonoid_of (i : ι) (f : γ →+ β i) : fromAddMonoid (of _ i f) = (of _ i).comp f := by
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
i : ι
f : γ →+ β i
⊢ fromAddMonoid ((of (fun i => γ →+ β i) i) f) = AddMonoidHom.comp (of β i) f

Next tactic:
rw [fromAddMonoid, toAddMonoid_of]
@[simp]
theorem fromAddMonoid_of (i : ι) (f : γ →+ β i) : fromAddMonoid (of _ i f) = (of _ i).comp f := by
  rw [fromAddMonoid, toAddMonoid_of]
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
i : ι
f : γ →+ β i
⊢ (AddMonoidHom.compHom (of β i)) f = AddMonoidHom.comp (of β i) f

Next tactic:
rfl
theorem fromAddMonoid_of_apply (i : ι) (f : γ →+ β i) (x : γ) :
    fromAddMonoid (of _ i f) x = of _ i (f x) := by
      

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
i : ι
f : γ →+ β i
x : γ
⊢ (fromAddMonoid ((of (fun i => γ →+ β i) i) f)) x = (of β i) (f x)

Next tactic:
rw [fromAddMonoid_of, AddMonoidHom.coe_comp, Function.comp]
/-- The natural equivalence between `⨁ _ : ι, M` and `M` when `Unique ι`. -/
protected def id (M : Type v) (ι : Type* := PUnit) [AddCommMonoid M] [Unique ι] :
    (⨁ _ : ι, M) ≃+ M :=
  {
    DirectSum.toAddMonoid fun _ =>
      AddMonoidHom.id
        M with
    toFun := DirectSum.toAddMonoid fun _ => AddMonoidHom.id M
    invFun := of (fun _ => M) default
    left_inv := fun x =>
      DirectSum.induction_on x (by 

Proof state:
ι✝ : Type v
dec_ι : DecidableEq ι✝
β : ι✝ → Type w
inst✝³ : (i : ι✝) → AddCommMonoid (β i)
γ : Type u₁
inst✝² : AddCommMonoid γ
M : Type v
ι : optParam (Type u_1) PUnit.{u_1 + 1}
inst✝¹ : AddCommMonoid M
inst✝ : Unique ι
src✝ : (⨁ (i : ι), M) →+ M := toAddMonoid fun x => AddMonoidHom.id M
x : ⨁ (x : ι), M
⊢ (of (fun x => M) default) ((toAddMonoid fun x => AddMonoidHom.id M) 0) = 0

Next tactic:
rw [AddMonoidHom.map_zero, AddMonoidHom.map_zero]
/-- The natural equivalence between `⨁ _ : ι, M` and `M` when `Unique ι`. -/
protected def id (M : Type v) (ι : Type* := PUnit) [AddCommMonoid M] [Unique ι] :
    (⨁ _ : ι, M) ≃+ M :=
  {
    DirectSum.toAddMonoid fun _ =>
      AddMonoidHom.id
        M with
    toFun := DirectSum.toAddMonoid fun _ => AddMonoidHom.id M
    invFun := of (fun _ => M) default
    left_inv := fun x =>
      DirectSum.induction_on x (by rw [AddMonoidHom.map_zero, AddMonoidHom.map_zero])
        (fun p x => by 

Proof state:
ι✝ : Type v
dec_ι : DecidableEq ι✝
β : ι✝ → Type w
inst✝³ : (i : ι✝) → AddCommMonoid (β i)
γ : Type u₁
inst✝² : AddCommMonoid γ
M : Type v
ι : optParam (Type u_1) PUnit.{u_1 + 1}
inst✝¹ : AddCommMonoid M
inst✝ : Unique ι
src✝ : (⨁ (i : ι), M) →+ M := toAddMonoid fun x => AddMonoidHom.id M
x✝ : ⨁ (x : ι), M
p : ι
x : M
⊢ (of (fun x => M) default) ((toAddMonoid fun x => AddMonoidHom.id M) ((of (fun i => M) p) x)) = (of (fun i => M) p) x

Next tactic:
rw [Unique.default_eq p, toAddMonoid_of]
/-- The natural equivalence between `⨁ _ : ι, M` and `M` when `Unique ι`. -/
protected def id (M : Type v) (ι : Type* := PUnit) [AddCommMonoid M] [Unique ι] :
    (⨁ _ : ι, M) ≃+ M :=
  {
    DirectSum.toAddMonoid fun _ =>
      AddMonoidHom.id
        M with
    toFun := DirectSum.toAddMonoid fun _ => AddMonoidHom.id M
    invFun := of (fun _ => M) default
    left_inv := fun x =>
      DirectSum.induction_on x (by rw [AddMonoidHom.map_zero, AddMonoidHom.map_zero])
        (fun p x => by rw [Unique.default_eq p, toAddMonoid_of]; 

Proof state:
ι✝ : Type v
dec_ι : DecidableEq ι✝
β : ι✝ → Type w
inst✝³ : (i : ι✝) → AddCommMonoid (β i)
γ : Type u₁
inst✝² : AddCommMonoid γ
M : Type v
ι : optParam (Type u_1) PUnit.{u_1 + 1}
inst✝¹ : AddCommMonoid M
inst✝ : Unique ι
src✝ : (⨁ (i : ι), M) →+ M := toAddMonoid fun x => AddMonoidHom.id M
x✝ : ⨁ (x : ι), M
p : ι
x : M
⊢ (of (fun x => M) p) ((AddMonoidHom.id M) x) = (of (fun i => M) p) x

Next tactic:
rfl
/-- The natural equivalence between `⨁ _ : ι, M` and `M` when `Unique ι`. -/
protected def id (M : Type v) (ι : Type* := PUnit) [AddCommMonoid M] [Unique ι] :
    (⨁ _ : ι, M) ≃+ M :=
  {
    DirectSum.toAddMonoid fun _ =>
      AddMonoidHom.id
        M with
    toFun := DirectSum.toAddMonoid fun _ => AddMonoidHom.id M
    invFun := of (fun _ => M) default
    left_inv := fun x =>
      DirectSum.induction_on x (by rw [AddMonoidHom.map_zero, AddMonoidHom.map_zero])
        (fun p x => by rw [Unique.default_eq p, toAddMonoid_of]; rfl) fun x y ihx ihy => by
        

Proof state:
ι✝ : Type v
dec_ι : DecidableEq ι✝
β : ι✝ → Type w
inst✝³ : (i : ι✝) → AddCommMonoid (β i)
γ : Type u₁
inst✝² : AddCommMonoid γ
M : Type v
ι : optParam (Type u_1) PUnit.{u_1 + 1}
inst✝¹ : AddCommMonoid M
inst✝ : Unique ι
src✝ : (⨁ (i : ι), M) →+ M := toAddMonoid fun x => AddMonoidHom.id M
x✝ x y : ⨁ (i : ι), M
ihx : (of (fun x => M) default) ((toAddMonoid fun x => AddMonoidHom.id M) x) = x
ihy : (of (fun x => M) default) ((toAddMonoid fun x => AddMonoidHom.id M) y) = y
⊢ (of (fun x => M) default) ((toAddMonoid fun x => AddMonoidHom.id M) (x + y)) = x + y

Next tactic:
rw [AddMonoidHom.map_add, AddMonoidHom.map_add, ihx, ihy]
@[simp]
theorem equivCongrLeft_apply (h : ι ≃ κ) (f : ⨁ i, β i) (k : κ) :
    equivCongrLeft h f k = f (h.symm k) := by
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝¹ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝ : AddCommMonoid γ
κ : Type u_1
h : ι ≃ κ
f : ⨁ (i : ι), β i
k : κ
⊢ ((equivCongrLeft h) f) k = f (h.symm k)

Next tactic:
exact DFinsupp.comapDomain'_apply _ h.right_inv _ _
theorem coe_of_apply {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] {A : ι → S} (i j : ι) (x : A i) :
    (of (fun i ↦ {x // x ∈ A i}) i x j : M) = if i = j then x else 0 := by
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝⁵ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝⁴ : AddCommMonoid γ
M : Type u_1
S : Type u_2
inst✝³ : DecidableEq ι
inst✝² : AddCommMonoid M
inst✝¹ : SetLike S M
inst✝ : AddSubmonoidClass S M
A : ι → S
i j : ι
x : ↥(A i)
⊢ ↑(((of (fun i => ↥(A i)) i) x) j) = ↑(if i = j then x else 0)

Next tactic:
obtain rfl | h := Decidable.eq_or_ne i j
theorem coe_of_apply {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] {A : ι → S} (i j : ι) (x : A i) :
    (of (fun i ↦ {x // x ∈ A i}) i x j : M) = if i = j then x else 0 := by
  obtain rfl | h := Decidable.eq_or_ne i j
  · 

Proof state:
case inl
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝⁵ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝⁴ : AddCommMonoid γ
M : Type u_1
S : Type u_2
inst✝³ : DecidableEq ι
inst✝² : AddCommMonoid M
inst✝¹ : SetLike S M
inst✝ : AddSubmonoidClass S M
A : ι → S
i : ι
x : ↥(A i)
⊢ ↑(((of (fun i => ↥(A i)) i) x) i) = ↑(if i = i then x else 0)

Next tactic:
rw [DirectSum.of_eq_same, if_pos rfl]
theorem coe_of_apply {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] {A : ι → S} (i j : ι) (x : A i) :
    (of (fun i ↦ {x // x ∈ A i}) i x j : M) = if i = j then x else 0 := by
  obtain rfl | h := Decidable.eq_or_ne i j
  · rw [DirectSum.of_eq_same, if_pos rfl]
  · 

Proof state:
case inr
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝⁵ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝⁴ : AddCommMonoid γ
M : Type u_1
S : Type u_2
inst✝³ : DecidableEq ι
inst✝² : AddCommMonoid M
inst✝¹ : SetLike S M
inst✝ : AddSubmonoidClass S M
A : ι → S
i j : ι
x : ↥(A i)
h : i ≠ j
⊢ ↑(((of (fun i => ↥(A i)) i) x) j) = ↑(if i = j then x else 0)

Next tactic:
rw [DirectSum.of_eq_of_ne _ _ _ _ h, if_neg h, ZeroMemClass.coe_zero, ZeroMemClass.coe_zero]
theorem IsInternal.addSubmonoid_iSup_eq_top {M : Type*} [DecidableEq ι] [AddCommMonoid M]
    (A : ι → AddSubmonoid M) (h : IsInternal A) : iSup A = ⊤ := by
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝³ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝² : AddCommMonoid γ
M : Type u_1
inst✝¹ : DecidableEq ι
inst✝ : AddCommMonoid M
A : ι → AddSubmonoid M
h : IsInternal A
⊢ iSup A = ⊤

Next tactic:
rw [AddSubmonoid.iSup_eq_mrange_dfinsupp_sumAddHom, AddMonoidHom.mrange_top_iff_surjective]
theorem IsInternal.addSubmonoid_iSup_eq_top {M : Type*} [DecidableEq ι] [AddCommMonoid M]
    (A : ι → AddSubmonoid M) (h : IsInternal A) : iSup A = ⊤ := by
  rw [AddSubmonoid.iSup_eq_mrange_dfinsupp_sumAddHom, AddMonoidHom.mrange_top_iff_surjective]
  

Proof state:
ι : Type v
dec_ι : DecidableEq ι
β : ι → Type w
inst✝³ : (i : ι) → AddCommMonoid (β i)
γ : Type u₁
inst✝² : AddCommMonoid γ
M : Type u_1
inst✝¹ : DecidableEq ι
inst✝ : AddCommMonoid M
A : ι → AddSubmonoid M
h : IsInternal A
⊢ Function.Surjective ⇑(DFinsupp.sumAddHom fun i => AddSubmonoid.subtype (A i))

Next tactic:
exact Function.Bijective.surjective h
theorem eq_univ_iff_forall : s = univ ↔ ∀ x, x ∈ s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ s = univ ↔ ∀ (x : α), x ∈ s

Next tactic:
simp [ext_iff]
@[simp, norm_cast]
theorem coe_univ : ↑(univ : Finset α) = (Set.univ : Set α) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ ↑univ = Set.univ

Next tactic:
ext
@[simp, norm_cast]
theorem coe_univ : ↑(univ : Finset α) = (Set.univ : Set α) := by ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
x✝ : α
⊢ x✝ ∈ ↑univ ↔ x✝ ∈ Set.univ

Next tactic:
simp
@[simp, norm_cast]
theorem coe_eq_univ : (s : Set α) = Set.univ ↔ s = univ := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ ↑s = Set.univ ↔ s = univ

Next tactic:
rw [← coe_univ, coe_inj]
theorem Nonempty.eq_univ [Subsingleton α] : s.Nonempty → s = univ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : Subsingleton α
⊢ Finset.Nonempty s → s = univ

Next tactic:
rintro ⟨x, hx⟩
theorem Nonempty.eq_univ [Subsingleton α] : s.Nonempty → s = univ := by
  rintro ⟨x, hx⟩
  

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : Subsingleton α
x : α
hx : x ∈ s
⊢ s = univ

Next tactic:
refine' eq_univ_of_forall fun y => by rwa [Subsingleton.elim y x]
theorem Nonempty.eq_univ [Subsingleton α] : s.Nonempty → s = univ := by
  rintro ⟨x, hx⟩
  refine' eq_univ_of_forall fun y => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : Subsingleton α
x : α
hx : x ∈ s
y : α
⊢ y ∈ s

Next tactic:
rwa [Subsingleton.elim y x]
theorem univ_nonempty_iff : (univ : Finset α).Nonempty ↔ Nonempty α := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ Finset.Nonempty univ ↔ Nonempty α

Next tactic:
rw [← coe_nonempty, coe_univ, Set.nonempty_iff_univ_nonempty]
theorem univ_eq_empty_iff : (univ : Finset α) = ∅ ↔ IsEmpty α := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ univ = ∅ ↔ IsEmpty α

Next tactic:
rw [← not_nonempty_iff, ← univ_nonempty_iff, not_nonempty_iff_eq_empty]
theorem codisjoint_left : Codisjoint s t ↔ ∀ ⦃a⦄, a ∉ s → a ∈ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ Codisjoint s t ↔ ∀ ⦃a : α⦄, a ∉ s → a ∈ t

Next tactic:
classical simp [codisjoint_iff, eq_univ_iff_forall, or_iff_not_imp_left]
theorem codisjoint_left : Codisjoint s t ↔ ∀ ⦃a⦄, a ∉ s → a ∈ t := by
  classical 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : Fintype α
s t : Finset α
⊢ Codisjoint s t ↔ ∀ ⦃a : α⦄, a ∉ s → a ∈ t

Next tactic:
simp [codisjoint_iff, eq_univ_iff_forall, or_iff_not_imp_left]
@[simp]
theorem mem_compl : a ∈ sᶜ ↔ a ∉ s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a : α
⊢ a ∈ sᶜ ↔ a ∉ s

Next tactic:
simp [compl_eq_univ_sdiff]
theorem not_mem_compl : a ∉ sᶜ ↔ a ∈ s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a : α
⊢ a ∉ sᶜ ↔ a ∈ s

Next tactic:
rw [mem_compl, not_not]
@[simp]
theorem compl_erase : (s.erase a)ᶜ = insert a sᶜ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a : α
⊢ (erase s a)ᶜ = insert a sᶜ

Next tactic:
ext
@[simp]
theorem compl_erase : (s.erase a)ᶜ = insert a sᶜ := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a a✝ : α
⊢ a✝ ∈ (erase s a)ᶜ ↔ a✝ ∈ insert a sᶜ

Next tactic:
simp only [or_iff_not_imp_left, mem_insert, not_and, mem_compl, mem_erase]
@[simp]
theorem compl_insert : (insert a s)ᶜ = sᶜ.erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a : α
⊢ (insert a s)ᶜ = erase sᶜ a

Next tactic:
ext
@[simp]
theorem compl_insert : (insert a s)ᶜ = sᶜ.erase a := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a a✝ : α
⊢ a✝ ∈ (insert a s)ᶜ ↔ a✝ ∈ erase sᶜ a

Next tactic:
simp only [not_or, mem_insert, iff_self_iff, mem_compl, mem_erase]
theorem insert_compl_insert (ha : a ∉ s) : insert a (insert a s)ᶜ = sᶜ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a : α
ha : a ∉ s
⊢ insert a (insert a s)ᶜ = sᶜ

Next tactic:
simp_rw [compl_insert, insert_erase (mem_compl.2 ha)]
@[simp]
theorem insert_compl_self (x : α) : insert x ({x}ᶜ : Finset α) = univ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a x : α
⊢ insert x {x}ᶜ = univ

Next tactic:
rw [← compl_erase, erase_singleton, compl_empty]
@[simp]
theorem compl_filter (p : α → Prop) [DecidablePred p] [∀ x, Decidable ¬p x] :
    (univ.filter p)ᶜ = univ.filter fun x => ¬p x :=
  ext <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s t : Finset α
inst✝² : DecidableEq α
a : α
p : α → Prop
inst✝¹ : DecidablePred p
inst✝ : (x : α) → Decidable ¬p x
⊢ ∀ (a : α), a ∈ (filter p univ)ᶜ ↔ a ∈ filter (fun x => ¬p x) univ

Next tactic:
simp
theorem compl_ne_univ_iff_nonempty (s : Finset α) : sᶜ ≠ univ ↔ s.Nonempty := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s✝ t : Finset α
inst✝ : DecidableEq α
a : α
s : Finset α
⊢ sᶜ ≠ univ ↔ Finset.Nonempty s

Next tactic:
simp [eq_univ_iff_forall, Finset.Nonempty]
theorem compl_singleton (a : α) : ({a} : Finset α)ᶜ = univ.erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : DecidableEq α
a✝ a : α
⊢ {a}ᶜ = erase univ a

Next tactic:
rw [compl_eq_univ_sdiff, sdiff_singleton_eq_erase]
theorem insert_inj_on' (s : Finset α) : Set.InjOn (fun a => insert a s) (sᶜ : Finset α) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s✝ t : Finset α
inst✝ : DecidableEq α
a : α
s : Finset α
⊢ Set.InjOn (fun a => insert a s) ↑sᶜ

Next tactic:
rw [coe_compl]
theorem insert_inj_on' (s : Finset α) : Set.InjOn (fun a => insert a s) (sᶜ : Finset α) := by
  rw [coe_compl]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s✝ t : Finset α
inst✝ : DecidableEq α
a : α
s : Finset α
⊢ Set.InjOn (fun a => insert a s) (↑s)ᶜ

Next tactic:
exact s.insert_inj_on
@[simp] lemma univ_inter (s : Finset α) : univ ∩ s = s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s✝ t : Finset α
inst✝ : DecidableEq α
a : α
s : Finset α
⊢ univ ∩ s = s

Next tactic:
ext a
@[simp] lemma univ_inter (s : Finset α) : univ ∩ s = s := by ext a; 

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s✝ t : Finset α
inst✝ : DecidableEq α
a✝ : α
s : Finset α
a : α
⊢ a ∈ univ ∩ s ↔ a ∈ s

Next tactic:
simp
@[simp] lemma inter_univ (s : Finset α) : s ∩ univ = s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s✝ t : Finset α
inst✝ : DecidableEq α
a : α
s : Finset α
⊢ s ∩ univ = s

Next tactic:
rw [inter_comm, univ_inter]
@[simp]
theorem piecewise_univ [∀ i : α, Decidable (i ∈ (univ : Finset α))] {δ : α → Sort*}
    (f g : ∀ i, δ i) : univ.piecewise f g = f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : (i : α) → Decidable (i ∈ univ)
δ : α → Sort u_4
f g : (i : α) → δ i
⊢ piecewise univ f g = f

Next tactic:
ext i
@[simp]
theorem piecewise_univ [∀ i : α, Decidable (i ∈ (univ : Finset α))] {δ : α → Sort*}
    (f g : ∀ i, δ i) : univ.piecewise f g = f := by
  ext i
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
inst✝ : (i : α) → Decidable (i ∈ univ)
δ : α → Sort u_4
f g : (i : α) → δ i
i : α
⊢ piecewise univ f g i = f i

Next tactic:
simp [piecewise]
theorem piecewise_compl [DecidableEq α] (s : Finset α) [∀ i : α, Decidable (i ∈ s)]
    [∀ i : α, Decidable (i ∈ sᶜ)] {δ : α → Sort*} (f g : ∀ i, δ i) :
    sᶜ.piecewise f g = s.piecewise g f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s✝ t : Finset α
inst✝² : DecidableEq α
s : Finset α
inst✝¹ : (i : α) → Decidable (i ∈ s)
inst✝ : (i : α) → Decidable (i ∈ sᶜ)
δ : α → Sort u_4
f g : (i : α) → δ i
⊢ piecewise sᶜ f g = piecewise s g f

Next tactic:
ext i
theorem piecewise_compl [DecidableEq α] (s : Finset α) [∀ i : α, Decidable (i ∈ s)]
    [∀ i : α, Decidable (i ∈ sᶜ)] {δ : α → Sort*} (f g : ∀ i, δ i) :
    sᶜ.piecewise f g = s.piecewise g f := by
  ext i
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s✝ t : Finset α
inst✝² : DecidableEq α
s : Finset α
inst✝¹ : (i : α) → Decidable (i ∈ s)
inst✝ : (i : α) → Decidable (i ∈ sᶜ)
δ : α → Sort u_4
f g : (i : α) → δ i
i : α
⊢ piecewise sᶜ f g i = piecewise s g f i

Next tactic:
simp [piecewise]
@[simp]
theorem piecewise_erase_univ {δ : α → Sort*} [DecidableEq α] (a : α) (f g : ∀ a, δ a) :
    (Finset.univ.erase a).piecewise f g = Function.update f a (g a) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : Fintype α
s t : Finset α
δ : α → Sort u_4
inst✝ : DecidableEq α
a : α
f g : (a : α) → δ a
⊢ piecewise (erase univ a) f g = update f a (g a)

Next tactic:
rw [← compl_singleton, piecewise_compl, piecewise_singleton]
theorem univ_map_equiv_to_embedding {α β : Type*} [Fintype α] [Fintype β] (e : α ≃ β) :
    univ.map e.toEmbedding = univ :=
  eq_univ_iff_forall.mpr fun b => mem_map.mpr ⟨e.symm b, mem_univ _, by 

Proof state:
α✝ : Type u_1
β✝ : Type u_2
γ : Type u_3
inst✝² : Fintype α✝
s t : Finset α✝
α : Type u_4
β : Type u_5
inst✝¹ : Fintype α
inst✝ : Fintype β
e : α ≃ β
b : β
⊢ (Equiv.toEmbedding e) (e.symm b) = b

Next tactic:
simp
@[simp]
theorem univ_filter_exists (f : α → β) [Fintype β] [DecidablePred fun y => ∃ x, f x = y]
    [DecidableEq β] : (Finset.univ.filter fun y => ∃ x, f x = y) = Finset.univ.image f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s t : Finset α
f : α → β
inst✝² : Fintype β
inst✝¹ : DecidablePred fun y => ∃ x, f x = y
inst✝ : DecidableEq β
⊢ filter (fun y => ∃ x, f x = y) univ = image f univ

Next tactic:
ext
@[simp]
theorem univ_filter_exists (f : α → β) [Fintype β] [DecidablePred fun y => ∃ x, f x = y]
    [DecidableEq β] : (Finset.univ.filter fun y => ∃ x, f x = y) = Finset.univ.image f := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s t : Finset α
f : α → β
inst✝² : Fintype β
inst✝¹ : DecidablePred fun y => ∃ x, f x = y
inst✝ : DecidableEq β
a✝ : β
⊢ a✝ ∈ filter (fun y => ∃ x, f x = y) univ ↔ a✝ ∈ image f univ

Next tactic:
simp
/-- Note this is a special case of `(Finset.image_preimage f univ _).symm`. -/
theorem univ_filter_mem_range (f : α → β) [Fintype β] [DecidablePred fun y => y ∈ Set.range f]
    [DecidableEq β] : (Finset.univ.filter fun y => y ∈ Set.range f) = Finset.univ.image f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s t : Finset α
f : α → β
inst✝² : Fintype β
inst✝¹ : DecidablePred fun y => y ∈ Set.range f
inst✝ : DecidableEq β
⊢ filter (fun y => y ∈ Set.range f) univ = image f univ

Next tactic:
letI : DecidablePred (fun y => ∃ x, f x = y) := by simpa using ‹_›
/-- Note this is a special case of `(Finset.image_preimage f univ _).symm`. -/
theorem univ_filter_mem_range (f : α → β) [Fintype β] [DecidablePred fun y => y ∈ Set.range f]
    [DecidableEq β] : (Finset.univ.filter fun y => y ∈ Set.range f) = Finset.univ.image f := by
  letI : DecidablePred (fun y => ∃ x, f x = y) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝³ : Fintype α
s t : Finset α
f : α → β
inst✝² : Fintype β
inst✝¹ : DecidablePred fun y => y ∈ Set.range f
inst✝ : DecidableEq β
⊢ DecidablePred fun y => ∃ x, f x = y

Next tactic:
simpa using ‹_›