l3lab/ntp-mathlib huggingface dataset:
theorem image_uIcc (h : ContinuousOn f <| [[a, b]]) :
    f '' [[a, b]] = [[sInf (f '' [[a, b]]), sSup (f '' [[a, b]])]] := by
  refine' h.image_uIcc_eq_Icc.trans (uIcc_of_le _).symm
  refine' csInf_le_csSup _ _ (nonempty_uIcc.image _) <;> rw [h.image_uIcc_eq_Icc]
  

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f [[a, b]]
⊢ BddBelow (Icc (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]])))
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f [[a, b]]
⊢ BddAbove (Icc (sInf (f '' [[a, b]])) (sSup (f '' [[a, b]])))

Next tactic:
exacts [bddBelow_Icc, bddAbove_Icc]
theorem sInf_image_Icc_le (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
    sInf (f '' Icc a b) ≤ f c := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f (Icc a b)
hc : c ∈ Icc a b
⊢ sInf (f '' Icc a b) ≤ f c

Next tactic:
have := mem_image_of_mem f hc
theorem sInf_image_Icc_le (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
    sInf (f '' Icc a b) ≤ f c := by
  have := mem_image_of_mem f hc
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f (Icc a b)
hc : c ∈ Icc a b
this : f c ∈ f '' Icc a b
⊢ sInf (f '' Icc a b) ≤ f c

Next tactic:
rw [h.image_Icc (hc.1.trans hc.2)] at this
theorem sInf_image_Icc_le (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
    sInf (f '' Icc a b) ≤ f c := by
  have := mem_image_of_mem f hc
  rw [h.image_Icc (hc.1.trans hc.2)] at this
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f (Icc a b)
hc : c ∈ Icc a b
this : f c ∈ Icc (sInf (f '' Icc a b)) (sSup (f '' Icc a b))
⊢ sInf (f '' Icc a b) ≤ f c

Next tactic:
exact this.1
theorem le_sSup_image_Icc (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
    f c ≤ sSup (f '' Icc a b) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f (Icc a b)
hc : c ∈ Icc a b
⊢ f c ≤ sSup (f '' Icc a b)

Next tactic:
have := mem_image_of_mem f hc
theorem le_sSup_image_Icc (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
    f c ≤ sSup (f '' Icc a b) := by
  have := mem_image_of_mem f hc
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f (Icc a b)
hc : c ∈ Icc a b
this : f c ∈ f '' Icc a b
⊢ f c ≤ sSup (f '' Icc a b)

Next tactic:
rw [h.image_Icc (hc.1.trans hc.2)] at this
theorem le_sSup_image_Icc (h : ContinuousOn f <| Icc a b) (hc : c ∈ Icc a b) :
    f c ≤ sSup (f '' Icc a b) := by
  have := mem_image_of_mem f hc
  rw [h.image_Icc (hc.1.trans hc.2)] at this
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝⁷ : ConditionallyCompleteLinearOrder α
inst✝⁶ : TopologicalSpace α
inst✝⁵ : OrderTopology α
inst✝⁴ : TopologicalSpace β
inst✝³ : TopologicalSpace γ
inst✝² : DenselyOrdered α
inst✝¹ : ConditionallyCompleteLinearOrder β
inst✝ : OrderTopology β
f : α → β
a b c : α
h : ContinuousOn f (Icc a b)
hc : c ∈ Icc a b
this : f c ∈ Icc (sInf (f '' Icc a b)) (sSup (f '' Icc a b))
⊢ f c ≤ sSup (f '' Icc a b)

Next tactic:
exact this.2
lemma card_eq_finsetCard (s : Finset α) : Nat.card s = s.card := by
  

Proof state:
α : Type u_1
β : Type u_2
s : Finset α
⊢ Nat.card { x // x ∈ s } = Finset.card s

Next tactic:
simp only [Nat.card_eq_fintype_card, Fintype.card_coe]
lemma card_eq_card_toFinset (s : Set α) [Fintype s] : Nat.card s = s.toFinset.card := by
  

Proof state:
α : Type u_1
β : Type u_2
s : Set α
inst✝ : Fintype ↑s
⊢ Nat.card ↑s = Finset.card (Set.toFinset s)

Next tactic:
simp only [← Nat.card_eq_finsetCard, s.mem_toFinset]
lemma card_eq_card_finite_toFinset {s : Set α} (hs : s.Finite) : Nat.card s = hs.toFinset.card := by
  

Proof state:
α : Type u_1
β : Type u_2
s : Set α
hs : Set.Finite s
⊢ Nat.card ↑s = Finset.card (Set.Finite.toFinset hs)

Next tactic:
simp only [← Nat.card_eq_finsetCard, hs.mem_toFinset]
@[simp] theorem card_of_isEmpty [IsEmpty α] : Nat.card α = 0 := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝ : IsEmpty α
⊢ Nat.card α = 0

Next tactic:
simp [Nat.card]
lemma card_eq_zero : Nat.card α = 0 ↔ IsEmpty α ∨ Infinite α := by
  

Proof state:
α : Type u_1
β : Type u_2
⊢ Nat.card α = 0 ↔ IsEmpty α ∨ Infinite α

Next tactic:
simp [Nat.card, mk_eq_zero_iff, aleph0_le_mk_iff]
lemma card_ne_zero : Nat.card α ≠ 0 ↔ Nonempty α ∧ Finite α := by 

Proof state:
α : Type u_1
β : Type u_2
⊢ Nat.card α ≠ 0 ↔ Nonempty α ∧ Finite α

Next tactic:
simp [card_eq_zero, not_or]
lemma card_pos_iff : 0 < Nat.card α ↔ Nonempty α ∧ Finite α := by
  

Proof state:
α : Type u_1
β : Type u_2
⊢ 0 < Nat.card α ↔ Nonempty α ∧ Finite α

Next tactic:
simp [Nat.card, mk_eq_zero_iff, mk_lt_aleph0_iff]
lemma card_le_card_of_injective {α : Type u} {β : Type v} [Finite β] (f : α → β)
    (hf : Injective f) : Nat.card α ≤ Nat.card β := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u
β : Type v
inst✝ : Finite β
f : α → β
hf : Injective f
⊢ Nat.card α ≤ Nat.card β

Next tactic:
simpa using toNat_le_of_le_of_lt_aleph0 (by simp [lt_aleph0_of_finite]) $
    mk_le_of_injective (α := ULift.{max u v} α) (β := ULift.{max u v} β) $ ULift.map_injective.2 hf
lemma card_le_card_of_injective {α : Type u} {β : Type v} [Finite β] (f : α → β)
    (hf : Injective f) : Nat.card α ≤ Nat.card β := by
  simpa using toNat_le_of_le_of_lt_aleph0 (by 

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u
β : Type v
inst✝ : Finite β
f : α → β
hf : Injective f
⊢ #(ULift.{max u v, v} β) < ℵ₀

Next tactic:
simp [lt_aleph0_of_finite]
lemma card_le_card_of_surjective {α : Type u} {β : Type v} [Finite α] (f : α → β)
    (hf : Surjective f) : Nat.card β ≤ Nat.card α := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u
β : Type v
inst✝ : Finite α
f : α → β
hf : Surjective f
⊢ Nat.card β ≤ Nat.card α

Next tactic:
simpa using toNat_le_of_le_of_lt_aleph0 (by simp [lt_aleph0_of_finite]) $ mk_le_of_surjective
    (α := ULift.{max u v} α) (β := ULift.{max u v} β) $ ULift.map_surjective.2 hf
lemma card_le_card_of_surjective {α : Type u} {β : Type v} [Finite α] (f : α → β)
    (hf : Surjective f) : Nat.card β ≤ Nat.card α := by
  simpa using toNat_le_of_le_of_lt_aleph0 (by 

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u
β : Type v
inst✝ : Finite α
f : α → β
hf : Surjective f
⊢ #(ULift.{max u v, u} α) < ℵ₀

Next tactic:
simp [lt_aleph0_of_finite]
theorem card_eq_of_equiv_fin {α : Type*} {n : ℕ} (f : α ≃ Fin n) : Nat.card α = n := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
n : ℕ
f : α ≃ Fin n
⊢ Nat.card α = n

Next tactic:
simpa only [card_eq_fintype_card, Fintype.card_fin] using card_congr f
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  

Proof state:
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
classical
  obtain hs | hs := s.finite_or_infinite
  · have := hs.fintype
    have := fintypeImage s f
    simp_rw [Nat.card_eq_fintype_card, Set.card_image_of_inj_on hf]
  · have := hs.to_subtype
    have := (hs.image hf).to_subtype
    simp [Nat.card_eq_zero_of_infinite]
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  

Proof state:
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
obtain hs | hs := s.finite_or_infinite
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  obtain hs | hs := s.finite_or_infinite
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
hs : Set.Finite s
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
have := hs.fintype
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  obtain hs | hs := s.finite_or_infinite
  · have := hs.fintype
    

Proof state:
case inl
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
hs : Set.Finite s
this : Fintype ↑s
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
have := fintypeImage s f
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  obtain hs | hs := s.finite_or_infinite
  · have := hs.fintype
    have := fintypeImage s f
    

Proof state:
case inl
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
hs : Set.Finite s
this✝ : Fintype ↑s
this : Fintype ↑(f '' s)
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
simp_rw [Nat.card_eq_fintype_card, Set.card_image_of_inj_on hf]
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  obtain hs | hs := s.finite_or_infinite
  · have := hs.fintype
    have := fintypeImage s f
    simp_rw [Nat.card_eq_fintype_card, Set.card_image_of_inj_on hf]
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
hs : Set.Infinite s
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
have := hs.to_subtype
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  obtain hs | hs := s.finite_or_infinite
  · have := hs.fintype
    have := fintypeImage s f
    simp_rw [Nat.card_eq_fintype_card, Set.card_image_of_inj_on hf]
  · have := hs.to_subtype
    

Proof state:
case inr
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
hs : Set.Infinite s
this : Infinite ↑s
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
have := (hs.image hf).to_subtype
lemma card_image_of_injOn (hf : s.InjOn f) : Nat.card (f '' s) = Nat.card s := by
  classical
  obtain hs | hs := s.finite_or_infinite
  · have := hs.fintype
    have := fintypeImage s f
    simp_rw [Nat.card_eq_fintype_card, Set.card_image_of_inj_on hf]
  · have := hs.to_subtype
    have := (hs.image hf).to_subtype
    

Proof state:
case inr
α : Type u_1
β : Type u_2
s t : Set α
β✝ : Type u_3
f : α → β✝
hf : InjOn f s
hs : Set.Infinite s
this✝ : Infinite ↑s
this : Infinite ↑(f '' s)
⊢ Nat.card ↑(f '' s) = Nat.card ↑s

Next tactic:
simp [Nat.card_eq_zero_of_infinite]
lemma card_preimage_of_injOn {s : Set β} (hf : (f ⁻¹' s).InjOn f) (hsf : s ⊆ range f) :
    Nat.card (f ⁻¹' s) = Nat.card s := by
  

Proof state:
α : Type u_1
β : Type u_2
s✝ t : Set α
α✝ : Type u_3
f : α✝ → β
s : Set β
hf : InjOn f (f ⁻¹' s)
hsf : s ⊆ range f
⊢ Nat.card ↑(f ⁻¹' s) = Nat.card ↑s

Next tactic:
rw [← Nat.card_image_of_injOn hf, image_preimage_eq_iff.2 hsf]
/-- If the cardinality is positive, that means it is a finite type, so there is
an equivalence between `α` and `Fin (Nat.card α)`. See also `Finite.equivFin`. -/
def equivFinOfCardPos {α : Type*} (h : Nat.card α ≠ 0) : α ≃ Fin (Nat.card α) := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
h : Nat.card α ≠ 0
⊢ α ≃ Fin (Nat.card α)

Next tactic:
cases fintypeOrInfinite α
/-- If the cardinality is positive, that means it is a finite type, so there is
an equivalence between `α` and `Fin (Nat.card α)`. See also `Finite.equivFin`. -/
def equivFinOfCardPos {α : Type*} (h : Nat.card α ≠ 0) : α ≃ Fin (Nat.card α) := by
  cases fintypeOrInfinite α
  · 

Proof state:
case inl
α✝ : Type u_1
β : Type u_2
α : Type u_3
h : Nat.card α ≠ 0
val✝ : Fintype α
⊢ α ≃ Fin (Nat.card α)

Next tactic:
simpa only [card_eq_fintype_card] using Fintype.equivFin α
/-- If the cardinality is positive, that means it is a finite type, so there is
an equivalence between `α` and `Fin (Nat.card α)`. See also `Finite.equivFin`. -/
def equivFinOfCardPos {α : Type*} (h : Nat.card α ≠ 0) : α ≃ Fin (Nat.card α) := by
  cases fintypeOrInfinite α
  · simpa only [card_eq_fintype_card] using Fintype.equivFin α
  · 

Proof state:
case inr
α✝ : Type u_1
β : Type u_2
α : Type u_3
h : Nat.card α ≠ 0
val✝ : Infinite α
⊢ α ≃ Fin (Nat.card α)

Next tactic:
simp only [card_eq_zero_of_infinite, ne_eq, not_true_eq_false] at h
theorem card_of_subsingleton (a : α) [Subsingleton α] : Nat.card α = 1 := by
  

Proof state:
α : Type u_1
β : Type u_2
a : α
inst✝ : Subsingleton α
⊢ Nat.card α = 1

Next tactic:
letI := Fintype.ofSubsingleton a
theorem card_of_subsingleton (a : α) [Subsingleton α] : Nat.card α = 1 := by
  letI := Fintype.ofSubsingleton a
  

Proof state:
α : Type u_1
β : Type u_2
a : α
inst✝ : Subsingleton α
this : Fintype α := Fintype.ofSubsingleton a
⊢ Nat.card α = 1

Next tactic:
rw [card_eq_fintype_card, Fintype.card_ofSubsingleton a]
@[simp]
theorem card_sum [Finite α] [Finite β] : Nat.card (α ⊕ β) = Nat.card α + Nat.card β := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Finite α
inst✝ : Finite β
⊢ Nat.card (α ⊕ β) = Nat.card α + Nat.card β

Next tactic:
have := Fintype.ofFinite α
@[simp]
theorem card_sum [Finite α] [Finite β] : Nat.card (α ⊕ β) = Nat.card α + Nat.card β := by
  have := Fintype.ofFinite α
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Finite α
inst✝ : Finite β
this : Fintype α
⊢ Nat.card (α ⊕ β) = Nat.card α + Nat.card β

Next tactic:
have := Fintype.ofFinite β
@[simp]
theorem card_sum [Finite α] [Finite β] : Nat.card (α ⊕ β) = Nat.card α + Nat.card β := by
  have := Fintype.ofFinite α
  have := Fintype.ofFinite β
  

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : Finite α
inst✝ : Finite β
this✝ : Fintype α
this : Fintype β
⊢ Nat.card (α ⊕ β) = Nat.card α + Nat.card β

Next tactic:
simp_rw [Nat.card_eq_fintype_card, Fintype.card_sum]
@[simp]
theorem card_prod (α β : Type*) : Nat.card (α × β) = Nat.card α * Nat.card β := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
⊢ Nat.card (α × β) = Nat.card α * Nat.card β

Next tactic:
simp only [Nat.card, mk_prod, toNat_mul, toNat_lift]
theorem card_pi {β : α → Type*} [Fintype α] : Nat.card (∀ a, β a) = ∏ a, Nat.card (β a) := by
  

Proof state:
α : Type u_1
β✝ : Type u_2
β : α → Type u_3
inst✝ : Fintype α
⊢ Nat.card ((a : α) → β a) = ∏ a : α, Nat.card (β a)

Next tactic:
simp_rw [Nat.card, mk_pi, prod_eq_of_fintype, toNat_lift, toNat_finset_prod]
theorem card_fun [Finite α] : Nat.card (α → β) = Nat.card β ^ Nat.card α := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Finite α
⊢ Nat.card (α → β) = Nat.card β ^ Nat.card α

Next tactic:
haveI := Fintype.ofFinite α
theorem card_fun [Finite α] : Nat.card (α → β) = Nat.card β ^ Nat.card α := by
  haveI := Fintype.ofFinite α
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : Finite α
this : Fintype α
⊢ Nat.card (α → β) = Nat.card β ^ Nat.card α

Next tactic:
rw [Nat.card_pi, Finset.prod_const, Finset.card_univ, ← Nat.card_eq_fintype_card]
@[simp]
theorem card_zmod (n : ℕ) : Nat.card (ZMod n) = n := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
⊢ Nat.card (ZMod n) = n

Next tactic:
cases n
@[simp]
theorem card_zmod (n : ℕ) : Nat.card (ZMod n) = n := by
  cases n
  · 

Proof state:
case zero
α : Type u_1
β : Type u_2
⊢ Nat.card (ZMod zero) = zero

Next tactic:
exact @Nat.card_eq_zero_of_infinite _ Int.infinite
@[simp]
theorem card_zmod (n : ℕ) : Nat.card (ZMod n) = n := by
  cases n
  · exact @Nat.card_eq_zero_of_infinite _ Int.infinite
  · 

Proof state:
case succ
α : Type u_1
β : Type u_2
n✝ : ℕ
⊢ Nat.card (ZMod (succ n✝)) = succ n✝

Next tactic:
rw [Nat.card_eq_fintype_card, ZMod.card]
lemma card_singleton_prod (a : α) (t : Set β) : Nat.card ({a} ×ˢ t) = Nat.card t := by
  

Proof state:
α : Type u_1
β : Type u_2
a : α
t : Set β
⊢ Nat.card ↑({a} ×ˢ t) = Nat.card ↑t

Next tactic:
rw [singleton_prod, Nat.card_image_of_injective (Prod.mk.inj_left a)]
lemma card_prod_singleton (s : Set α) (b : β) : Nat.card (s ×ˢ {b}) = Nat.card s := by
  

Proof state:
α : Type u_1
β : Type u_2
s : Set α
b : β
⊢ Nat.card ↑(s ×ˢ {b}) = Nat.card ↑s

Next tactic:
rw [prod_singleton, Nat.card_image_of_injective (Prod.mk.inj_right b)]
@[simp]
theorem card_sum (α β : Type*) :
    PartENat.card (α ⊕ β) = PartENat.card α + PartENat.card β := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
⊢ card (α ⊕ β) = card α + card β

Next tactic:
simp only [PartENat.card, Cardinal.mk_sum, map_add, Cardinal.toPartENat_lift]
@[simp]
theorem _root_.Cardinal.natCast_le_toPartENat_iff {n : ℕ} {c : Cardinal} :
    ↑n ≤ toPartENat c ↔ ↑n ≤ c := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
c : Cardinal.{u_3}
⊢ ↑n ≤ toPartENat c ↔ ↑n ≤ c

Next tactic:
rw [← toPartENat_cast n, toPartENat_le_iff_of_le_aleph0 (le_of_lt (nat_lt_aleph0 n))]
@[simp]
theorem _root_.Cardinal.toPartENat_le_natCast_iff {c : Cardinal} {n : ℕ} :
    toPartENat c ≤ n ↔ c ≤ n := by
  

Proof state:
α : Type u_1
β : Type u_2
c : Cardinal.{u_3}
n : ℕ
⊢ toPartENat c ≤ ↑n ↔ c ≤ ↑n

Next tactic:
rw [← toPartENat_cast n, toPartENat_le_iff_of_lt_aleph0 (nat_lt_aleph0 n)]
@[simp]
theorem _root_.Cardinal.natCast_eq_toPartENat_iff {n : ℕ} {c : Cardinal} :
    ↑n = toPartENat c ↔ ↑n = c := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
c : Cardinal.{u_3}
⊢ ↑n = toPartENat c ↔ ↑n = c

Next tactic:
rw [le_antisymm_iff, le_antisymm_iff, Cardinal.toPartENat_le_natCast_iff,
    Cardinal.natCast_le_toPartENat_iff]
@[simp]
theorem _root_.Cardinal.toPartENat_eq_natCast_iff {c : Cardinal} {n : ℕ} :
    Cardinal.toPartENat c = n ↔ c = n := by


Proof state:
α : Type u_1
β : Type u_2
c : Cardinal.{u_3}
n : ℕ
⊢ toPartENat c = ↑n ↔ c = ↑n

Next tactic:
rw [eq_comm, Cardinal.natCast_eq_toPartENat_iff, eq_comm]
@[simp]
theorem _root_.Cardinal.natCast_lt_toPartENat_iff {n : ℕ} {c : Cardinal} :
    ↑n < toPartENat c ↔ ↑n < c := by
  

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
c : Cardinal.{u_3}
⊢ ↑n < toPartENat c ↔ ↑n < c

Next tactic:
simp only [← not_le, Cardinal.toPartENat_le_natCast_iff]
@[simp]
theorem _root_.Cardinal.toPartENat_lt_natCast_iff {n : ℕ} {c : Cardinal} :
    toPartENat c < ↑n ↔ c < ↑n :=
by 

Proof state:
α : Type u_1
β : Type u_2
n : ℕ
c : Cardinal.{u_3}
⊢ toPartENat c < ↑n ↔ c < ↑n

Next tactic:
simp only [← not_le, Cardinal.natCast_le_toPartENat_iff]
theorem card_eq_zero_iff_empty (α : Type*) : card α = 0 ↔ IsEmpty α := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α = 0 ↔ IsEmpty α

Next tactic:
rw [← Cardinal.mk_eq_zero_iff]
theorem card_eq_zero_iff_empty (α : Type*) : card α = 0 ↔ IsEmpty α := by
  rw [← Cardinal.mk_eq_zero_iff]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α = 0 ↔ #α = 0

Next tactic:
conv_rhs => rw [← Nat.cast_zero]
theorem card_eq_zero_iff_empty (α : Type*) : card α = 0 ↔ IsEmpty α := by
  rw [← Cardinal.mk_eq_zero_iff]
  conv_rhs => 

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
| #α = 0

Next tactic:
rw [← Nat.cast_zero]
theorem card_eq_zero_iff_empty (α : Type*) : card α = 0 ↔ IsEmpty α := by
  rw [← Cardinal.mk_eq_zero_iff]
  conv_rhs => rw [← Nat.cast_zero]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α = 0 ↔ #α = ↑0

Next tactic:
simp only [← Cardinal.toPartENat_eq_natCast_iff]
theorem card_eq_zero_iff_empty (α : Type*) : card α = 0 ↔ IsEmpty α := by
  rw [← Cardinal.mk_eq_zero_iff]
  conv_rhs => rw [← Nat.cast_zero]
  simp only [← Cardinal.toPartENat_eq_natCast_iff]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α = 0 ↔ toPartENat #α = ↑0

Next tactic:
simp only [PartENat.card, Nat.cast_zero]
theorem card_le_one_iff_subsingleton (α : Type*) : card α ≤ 1 ↔ Subsingleton α := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α ≤ 1 ↔ Subsingleton α

Next tactic:
rw [← le_one_iff_subsingleton]
theorem card_le_one_iff_subsingleton (α : Type*) : card α ≤ 1 ↔ Subsingleton α := by
  rw [← le_one_iff_subsingleton]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α ≤ 1 ↔ #α ≤ 1

Next tactic:
conv_rhs => rw [← Nat.cast_one]
theorem card_le_one_iff_subsingleton (α : Type*) : card α ≤ 1 ↔ Subsingleton α := by
  rw [← le_one_iff_subsingleton]
  conv_rhs => 

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
| #α ≤ 1

Next tactic:
rw [← Nat.cast_one]
theorem card_le_one_iff_subsingleton (α : Type*) : card α ≤ 1 ↔ Subsingleton α := by
  rw [← le_one_iff_subsingleton]
  conv_rhs => rw [← Nat.cast_one]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α ≤ 1 ↔ #α ≤ ↑1

Next tactic:
rw [← Cardinal.toPartENat_le_natCast_iff]
theorem card_le_one_iff_subsingleton (α : Type*) : card α ≤ 1 ↔ Subsingleton α := by
  rw [← le_one_iff_subsingleton]
  conv_rhs => rw [← Nat.cast_one]
  rw [← Cardinal.toPartENat_le_natCast_iff]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ card α ≤ 1 ↔ toPartENat #α ≤ ↑1

Next tactic:
simp only [PartENat.card, Nat.cast_one]
theorem one_lt_card_iff_nontrivial (α : Type*) : 1 < card α ↔ Nontrivial α := by
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ 1 < card α ↔ Nontrivial α

Next tactic:
rw [← Cardinal.one_lt_iff_nontrivial]
theorem one_lt_card_iff_nontrivial (α : Type*) : 1 < card α ↔ Nontrivial α := by
  rw [← Cardinal.one_lt_iff_nontrivial]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ 1 < card α ↔ 1 < #α

Next tactic:
conv_rhs => rw [← Nat.cast_one]
theorem one_lt_card_iff_nontrivial (α : Type*) : 1 < card α ↔ Nontrivial α := by
  rw [← Cardinal.one_lt_iff_nontrivial]
  conv_rhs => 

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
| 1 < #α

Next tactic:
rw [← Nat.cast_one]
theorem one_lt_card_iff_nontrivial (α : Type*) : 1 < card α ↔ Nontrivial α := by
  rw [← Cardinal.one_lt_iff_nontrivial]
  conv_rhs => rw [← Nat.cast_one]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ 1 < card α ↔ ↑1 < #α

Next tactic:
rw [← natCast_lt_toPartENat_iff]
theorem one_lt_card_iff_nontrivial (α : Type*) : 1 < card α ↔ Nontrivial α := by
  rw [← Cardinal.one_lt_iff_nontrivial]
  conv_rhs => rw [← Nat.cast_one]
  rw [← natCast_lt_toPartENat_iff]
  

Proof state:
α✝ : Type u_1
β : Type u_2
α : Type u_3
⊢ 1 < card α ↔ ↑1 < toPartENat #α

Next tactic:
simp only [PartENat.card, Nat.cast_one]
instance (k G : Type u) [CommRing k] [Monoid G] : Linear k (Rep k G) := by 

Proof state:
k G : Type u
inst✝¹ : CommRing k
inst✝ : Monoid G
⊢ Linear k (Rep k G)

Next tactic:
infer_instance
instance (V : Rep k G) : AddCommGroup V := by
  

Proof state:
k G : Type u
inst✝¹ : CommRing k
inst✝ : Monoid G
V : Rep k G
⊢ AddCommGroup (CoeSort.coe V)

Next tactic:
change AddCommGroup ((forget₂ (Rep k G) (ModuleCat k)).obj V)
instance (V : Rep k G) : AddCommGroup V := by
  change AddCommGroup ((forget₂ (Rep k G) (ModuleCat k)).obj V); 

Proof state:
k G : Type u
inst✝¹ : CommRing k
inst✝ : Monoid G
V : Rep k G
⊢ AddCommGroup ↑((forget₂ (Rep k G) (ModuleCat k)).obj V)

Next tactic:
infer_instance
instance (V : Rep k G) : Module k V := by
  

Proof state:
k G : Type u
inst✝¹ : CommRing k
inst✝ : Monoid G
V : Rep k G
⊢ Module k (CoeSort.coe V)

Next tactic:
change Module k ((forget₂ (Rep k G) (ModuleCat k)).obj V)