File: Mathlib/Data/Set/Card.lean

full_name: Set.encard
code: /-- The cardinality of a set as a term in `ℕ∞` -/
noncomputable def encard (s : Set α) : ℕ∞ 
goal: ℕ∞

full_name: Set.encard_univ_coe
code: @[simp] theorem encard_univ_coe (s : Set α) : encard (univ : Set s) = encard s 
goal: Set.univ.encard = s.encard

full_name: Set.encard_univ
code: theorem encard_univ (α : Type*) :
    encard (univ : Set α) = PartENat.withTopEquiv (PartENat.card α) 
goal: Set.univ.encard = PartENat.withTopEquiv (PartENat.card α)

full_name: Set.Finite.encard_eq_coe_toFinset_card
code: theorem Finite.encard_eq_coe_toFinset_card (h : s.Finite) : s.encard = h.toFinset.card 
goal: s.encard = ↑h.toFinset.card

full_name: Set.encard_eq_coe_toFinset_card
code: theorem encard_eq_coe_toFinset_card (s : Set α) [Fintype s] : encard s = s.toFinset.card 
goal: s.encard = ↑s.toFinset.card

full_name: Set.encard_coe_eq_coe_finsetCard
code: @[simp, norm_cast] theorem encard_coe_eq_coe_finsetCard (s : Finset α) :
    encard (s : Set α) = s.card 
goal: (↑s).encard = ↑s.card

full_name: Set.Infinite.encard_eq
code: theorem Infinite.encard_eq {s : Set α} (h : s.Infinite) : s.encard = ⊤ 
goal: s.encard = ⊤

full_name: Set.encard_eq_zero
code: @[simp] theorem encard_eq_zero : s.encard = 0 ↔ s = ∅ 
goal: s.encard = 0 ↔ s = ∅

full_name: Set.encard_empty
code: @[simp] theorem encard_empty : (∅ : Set α).encard = 0 
goal: ∅.encard = 0

full_name: Set.nonempty_of_encard_ne_zero
code: theorem nonempty_of_encard_ne_zero (h : s.encard ≠ 0) : s.Nonempty 
goal: s.Nonempty

full_name: Set.encard_ne_zero
code: theorem encard_ne_zero : s.encard ≠ 0 ↔ s.Nonempty 
goal: s.encard ≠ 0 ↔ s.Nonempty

full_name: Set.encard_pos
code: @[simp] theorem encard_pos : 0 < s.encard ↔ s.Nonempty 
goal: 0 < s.encard ↔ s.Nonempty

full_name: Set.encard_singleton
code: @[simp] theorem encard_singleton (e : α) : ({e} : Set α).encard = 1 
goal: {e}.encard = 1

full_name: Set.encard_union_eq
code: theorem encard_union_eq (h : Disjoint s t) : (s ∪ t).encard = s.encard + t.encard 
goal: (s ∪ t).encard = s.encard + t.encard

full_name: Set.encard_insert_of_not_mem
code: theorem encard_insert_of_not_mem {a : α} (has : a ∉ s) : (insert a s).encard = s.encard + 1 
goal: (insert a s).encard = s.encard + 1

full_name: Set.Finite.encard_lt_top
code: theorem Finite.encard_lt_top (h : s.Finite) : s.encard < ⊤ 
goal: s.encard < ⊤

full_name: Set.Finite.encard_eq_coe
code: theorem Finite.encard_eq_coe (h : s.Finite) : s.encard = ENat.toNat s.encard 
goal: s.encard = ↑s.encard.toNat

full_name: Set.Finite.exists_encard_eq_coe
code: theorem Finite.exists_encard_eq_coe (h : s.Finite) : ∃ (n : ℕ), s.encard = n 
goal: ∃ n, s.encard = ↑n

full_name: Set.encard_lt_top_iff
code: @[simp] theorem encard_lt_top_iff : s.encard < ⊤ ↔ s.Finite 
goal: s.encard < ⊤ ↔ s.Finite

full_name: Set.encard_eq_top_iff
code: @[simp] theorem encard_eq_top_iff : s.encard = ⊤ ↔ s.Infinite 
goal: s.encard = ⊤ ↔ s.Infinite

full_name: Set.encard_ne_top_iff
code: theorem encard_ne_top_iff : s.encard ≠ ⊤ ↔ s.Finite 
goal: s.encard ≠ ⊤ ↔ s.Finite

full_name: Set.finite_of_encard_le_coe
code: theorem finite_of_encard_le_coe {k : ℕ} (h : s.encard ≤ k) : s.Finite 
goal: s.Finite

full_name: Set.finite_of_encard_eq_coe
code: theorem finite_of_encard_eq_coe {k : ℕ} (h : s.encard = k) : s.Finite 
goal: s.Finite

full_name: Set.encard_le_coe_iff
code: theorem encard_le_coe_iff {k : ℕ} : s.encard ≤ k ↔ s.Finite ∧ ∃ (n₀ : ℕ), s.encard = n₀ ∧ n₀ ≤ k 
goal: s.encard ≤ ↑k ↔ s.Finite ∧ ∃ n₀, s.encard = ↑n₀ ∧ n₀ ≤ k

full_name: Set.encard_le_card
code: theorem encard_le_card (h : s ⊆ t) : s.encard ≤ t.encard 
goal: s.encard ≤ t.encard

full_name: Set.encard_mono
code: theorem encard_mono {α : Type*} : Monotone (encard : Set α → ℕ∞) 
goal: Monotone Set.encard

full_name: Set.encard_diff_add_encard_of_subset
code: theorem encard_diff_add_encard_of_subset (h : s ⊆ t) : (t \ s).encard + s.encard = t.encard 
goal: (t \ s).encard + s.encard = t.encard

full_name: Set.one_le_encard_iff_nonempty
code: @[simp] theorem one_le_encard_iff_nonempty : 1 ≤ s.encard ↔ s.Nonempty 
goal: 1 ≤ s.encard ↔ s.Nonempty

full_name: Set.encard_diff_add_encard_inter
code: theorem encard_diff_add_encard_inter (s t : Set α) :
    (s \ t).encard + (s ∩ t).encard = s.encard 
goal: (s \ t).encard + (s ∩ t).encard = s.encard

full_name: Set.encard_union_add_encard_inter
code: theorem encard_union_add_encard_inter (s t : Set α) :
    (s ∪ t).encard + (s ∩ t).encard = s.encard + t.encard 
goal: (s ∪ t).encard + (s ∩ t).encard = s.encard + t.encard

full_name: Set.encard_eq_encard_iff_encard_diff_eq_encard_diff
code: theorem encard_eq_encard_iff_encard_diff_eq_encard_diff (h : (s ∩ t).Finite) :
    s.encard = t.encard ↔ (s \ t).encard = (t \ s).encard 
goal: s.encard = t.encard ↔ (s \ t).encard = (t \ s).encard

full_name: Set.encard_le_encard_iff_encard_diff_le_encard_diff
code: theorem encard_le_encard_iff_encard_diff_le_encard_diff (h : (s ∩ t).Finite) :
    s.encard ≤ t.encard ↔ (s \ t).encard ≤ (t \ s).encard 
goal: s.encard ≤ t.encard ↔ (s \ t).encard ≤ (t \ s).encard

full_name: Set.encard_lt_encard_iff_encard_diff_lt_encard_diff
code: theorem encard_lt_encard_iff_encard_diff_lt_encard_diff (h : (s ∩ t).Finite) :
    s.encard < t.encard ↔ (s \ t).encard < (t \ s).encard 
goal: s.encard < t.encard ↔ (s \ t).encard < (t \ s).encard

full_name: Set.encard_union_le
code: theorem encard_union_le (s t : Set α) : (s ∪ t).encard ≤ s.encard + t.encard 
goal: (s ∪ t).encard ≤ s.encard + t.encard

full_name: Set.finite_iff_finite_of_encard_eq_encard
code: theorem finite_iff_finite_of_encard_eq_encard (h : s.encard = t.encard) : s.Finite ↔ t.Finite 
goal: s.Finite ↔ t.Finite

full_name: Set.infinite_iff_infinite_of_encard_eq_encard
code: theorem infinite_iff_infinite_of_encard_eq_encard (h : s.encard = t.encard) :
    s.Infinite ↔ t.Infinite 
goal: s.Infinite ↔ t.Infinite

full_name: Set.Finite.finite_of_encard_le
code: theorem Finite.finite_of_encard_le {s : Set α} {t : Set β} (hs : s.Finite)
    (h : t.encard ≤ s.encard) : t.Finite 
goal: t.Finite

full_name: Set.Finite.eq_of_subset_of_encard_le
code: theorem Finite.eq_of_subset_of_encard_le (ht : t.Finite) (hst : s ⊆ t) (hts : t.encard ≤ s.encard) :
    s = t 
goal: s = t

full_name: Set.Finite.eq_of_subset_of_encard_le'
code: theorem Finite.eq_of_subset_of_encard_le' (hs : s.Finite) (hst : s ⊆ t)
    (hts : t.encard ≤ s.encard) : s = t 
goal: s = t

full_name: Set.Finite.encard_lt_encard
code: theorem Finite.encard_lt_encard (ht : t.Finite) (h : s ⊂ t) : s.encard < t.encard 
goal: s.encard < t.encard

full_name: Set.encard_strictMono
code: theorem encard_strictMono [Finite α] : StrictMono (encard : Set α → ℕ∞) 
goal: StrictMono Set.encard

full_name: Set.encard_diff_add_encard
code: theorem encard_diff_add_encard (s t : Set α) : (s \ t).encard + t.encard = (s ∪ t).encard 
goal: (s \ t).encard + t.encard = (s ∪ t).encard

full_name: Set.encard_le_encard_diff_add_encard
code: theorem encard_le_encard_diff_add_encard (s t : Set α) : s.encard ≤ (s \ t).encard + t.encard 
goal: s.encard ≤ (s \ t).encard + t.encard

full_name: Set.tsub_encard_le_encard_diff
code: theorem tsub_encard_le_encard_diff (s t : Set α) : s.encard - t.encard ≤ (s \ t).encard 
goal: s.encard - t.encard ≤ (s \ t).encard

full_name: Set.encard_add_encard_compl
code: theorem encard_add_encard_compl (s : Set α) : s.encard + sᶜ.encard = (univ : Set α).encard 
goal: s.encard + sᶜ.encard = Set.univ.encard

full_name: Set.encard_insert_le
code: theorem encard_insert_le (s : Set α) (x : α) : (insert x s).encard ≤ s.encard + 1 
goal: (insert x s).encard ≤ s.encard + 1

full_name: Set.encard_singleton_inter
code: theorem encard_singleton_inter (s : Set α) (x : α) : ({x} ∩ s).encard ≤ 1 
goal: ({x} ∩ s).encard ≤ 1

full_name: Set.encard_diff_singleton_add_one
code: theorem encard_diff_singleton_add_one (h : a ∈ s) :
    (s \ {a}).encard + 1 = s.encard 
goal: (s \ {a}).encard + 1 = s.encard

full_name: Set.encard_diff_singleton_of_mem
code: theorem encard_diff_singleton_of_mem (h : a ∈ s) :
    (s \ {a}).encard = s.encard - 1 
goal: (s \ {a}).encard = s.encard - 1

full_name: Set.encard_tsub_one_le_encard_diff_singleton
code: theorem encard_tsub_one_le_encard_diff_singleton (s : Set α) (x : α) :
    s.encard - 1 ≤ (s \ {x}).encard 
goal: s.encard - 1 ≤ (s \ {x}).encard

full_name: Set.encard_exchange
code: theorem encard_exchange (ha : a ∉ s) (hb : b ∈ s) : (insert a (s \ {b})).encard = s.encard 
goal: (insert a (s \ {b})).encard = s.encard

full_name: Set.encard_exchange'
code: theorem encard_exchange' (ha : a ∉ s) (hb : b ∈ s) : (insert a s \ {b}).encard = s.encard 
goal: (insert a s \ {b}).encard = s.encard

full_name: Set.encard_eq_add_one_iff
code: theorem encard_eq_add_one_iff {k : ℕ∞} :
    s.encard = k + 1 ↔ (∃ a t, ¬a ∈ t ∧ insert a t = s ∧ t.encard = k) 
goal: s.encard = k + 1 ↔ ∃ a t, a ∉ t ∧ insert a t = s ∧ t.encard = k

full_name: Set.eq_empty_or_encard_eq_top_or_encard_diff_singleton_lt
code: /-- Every set is either empty, infinite, or can have its `encard` reduced by a removal. Intended
  for well-founded induction on the value of `encard`. -/
theorem eq_empty_or_encard_eq_top_or_encard_diff_singleton_lt (s : Set α) :
    s = ∅ ∨ s.encard = ⊤ ∨ ∃ a ∈ s, (s \ {a}).encard < s.encard 
goal: s = ∅ ∨ s.encard = ⊤ ∨ ∃ a ∈ s, (s \ {a}).encard < s.encard

full_name: Set.encard_pair
code: theorem encard_pair {x y : α} (hne : x ≠ y) : ({x, y} : Set α).encard = 2 
goal: {x, y}.encard = 2

full_name: Set.encard_eq_one
code: theorem encard_eq_one : s.encard = 1 ↔ ∃ x, s = {x} 
goal: s.encard = 1 ↔ ∃ x, s = {x}

full_name: Set.encard_le_one_iff_eq
code: theorem encard_le_one_iff_eq : s.encard ≤ 1 ↔ s = ∅ ∨ ∃ x, s = {x} 
goal: s.encard ≤ 1 ↔ s = ∅ ∨ ∃ x, s = {x}

full_name: Set.encard_le_one_iff
code: theorem encard_le_one_iff : s.encard ≤ 1 ↔ ∀ a b, a ∈ s → b ∈ s → a = b 
goal: s.encard ≤ 1 ↔ ∀ (a b : α), a ∈ s → b ∈ s → a = b

full_name: Set.one_lt_encard_iff
code: theorem one_lt_encard_iff : 1 < s.encard ↔ ∃ a b, a ∈ s ∧ b ∈ s ∧ a ≠ b 
goal: 1 < s.encard ↔ ∃ a b, a ∈ s ∧ b ∈ s ∧ a ≠ b

full_name: Set.exists_ne_of_one_lt_encard
code: theorem exists_ne_of_one_lt_encard (h : 1 < s.encard) (a : α) : ∃ b ∈ s, b ≠ a 
goal: ∃ b ∈ s, b ≠ a

full_name: Set.encard_eq_two
code: theorem encard_eq_two : s.encard = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} 
goal: s.encard = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y}

full_name: Set.encard_eq_three
code: theorem encard_eq_three {α : Type u_1} {s : Set α} :
    encard s = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} 
goal: s.encard = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}

full_name: Set.Nat.encard_range
code: theorem Nat.encard_range (k : ℕ) : {i | i < k}.encard = k 
goal: {i | i < k}.encard = ↑k

full_name: Set.Finite.eq_insert_of_subset_of_encard_eq_succ
code: theorem Finite.eq_insert_of_subset_of_encard_eq_succ (hs : s.Finite) (h : s ⊆ t)
    (hst : t.encard = s.encard + 1) : ∃ a, t = insert a s 
goal: ∃ a, t = insert a s

full_name: Set.exists_subset_encard_eq
code: theorem exists_subset_encard_eq {k : ℕ∞} (hk : k ≤ s.encard) : ∃ t, t ⊆ s ∧ t.encard = k 
goal: ∃ t ⊆ s, t.encard = k

full_name: Set.exists_superset_subset_encard_eq
code: theorem exists_superset_subset_encard_eq {k : ℕ∞}
    (hst : s ⊆ t) (hsk : s.encard ≤ k) (hkt : k ≤ t.encard) :
    ∃ r, s ⊆ r ∧ r ⊆ t ∧ r.encard = k 
goal: ∃ r, s ⊆ r ∧ r ⊆ t ∧ r.encard = k

full_name: Set.InjOn.encard_image
code: theorem InjOn.encard_image (h : InjOn f s) : (f '' s).encard = s.encard 
goal: (f '' s).encard = s.encard

full_name: Set.encard_congr
code: theorem encard_congr (e : s ≃ t) : s.encard = t.encard 
goal: s.encard = t.encard

full_name: Function.Injective.encard_image
code: theorem _root_.Function.Injective.encard_image (hf : f.Injective) (s : Set α) :
    (f '' s).encard = s.encard 
goal: (f '' s).encard = s.encard

full_name: Function.Embedding.enccard_le
code: theorem _root_.Function.Embedding.enccard_le (e : s ↪ t) : s.encard ≤ t.encard 
goal: s.encard ≤ t.encard

full_name: Set.encard_image_le
code: theorem encard_image_le (f : α → β) (s : Set α) : (f '' s).encard ≤ s.encard 
goal: (f '' s).encard ≤ s.encard

full_name: Set.Finite.injOn_of_encard_image_eq
code: theorem Finite.injOn_of_encard_image_eq (hs : s.Finite) (h : (f '' s).encard = s.encard) :
    InjOn f s 
goal: Set.InjOn f s

full_name: Set.encard_preimage_of_injective_subset_range
code: theorem encard_preimage_of_injective_subset_range (hf : f.Injective) (ht : t ⊆ range f) :
    (f ⁻¹' t).encard = t.encard 
goal: (f ⁻¹' t).encard = t.encard

full_name: Set.encard_le_encard_of_injOn
code: theorem encard_le_encard_of_injOn (hf : MapsTo f s t) (f_inj : InjOn f s) :
    s.encard ≤ t.encard 
goal: s.encard ≤ t.encard

full_name: Set.Finite.exists_injOn_of_encard_le
code: theorem Finite.exists_injOn_of_encard_le [Nonempty β] {s : Set α} {t : Set β} (hs : s.Finite)
    (hle : s.encard ≤ t.encard) : ∃ (f : α → β), s ⊆ f ⁻¹' t ∧ InjOn f s 
goal: ∃ f, s ⊆ f ⁻¹' t ∧ Set.InjOn f s

full_name: Set.Finite.exists_bijOn_of_encard_eq
code: theorem Finite.exists_bijOn_of_encard_eq [Nonempty β] (hs : s.Finite) (h : s.encard = t.encard) :
    ∃ (f : α → β), BijOn f s t 
goal: ∃ f, Set.BijOn f s t

full_name: Set.tacticToFinite_tac
code: /-- A tactic (for use in default params) that applies `Set.toFinite` to synthesize a `Set.Finite`
  term. -/
syntax "toFinite_tac" : tactic
goal: Lean.ParserDescr

full_name: Set._aux_Mathlib_Data_Set_Card___macroRules_Set_tacticToFinite_tac_1
code: macro_rules
  | `(tactic| toFinite_tac) => `(tactic| apply Set.toFinite)
goal: Lean.Macro

full_name: Set.tacticTo_encard_tac
code: /-- A tactic useful for transferring proofs for `encard` to their corresponding `card` statements -/
syntax "to_encard_tac" : tactic
goal: Lean.ParserDescr

full_name: Set._aux_Mathlib_Data_Set_Card___macroRules_Set_tacticTo_encard_tac_1
code: macro_rules
  | `(tactic| to_encard_tac) => `(tactic|
      simp only [← Nat.cast_le (α := ℕ∞), ← Nat.cast_inj (R := ℕ∞), Nat.cast_add, Nat.cast_one])
goal: Lean.Macro

full_name: Set.ncard
code: /-- The cardinality of `s : Set α` . Has the junk value `0` if `s` is infinite -/
noncomputable def ncard (s : Set α) : ℕ 
goal: ℕ

full_name: Set.ncard_def
code: theorem ncard_def (s : Set α) : s.ncard = ENat.toNat s.encard 
goal: s.ncard = s.encard.toNat

full_name: Set.Finite.cast_ncard_eq
code: theorem Finite.cast_ncard_eq (hs : s.Finite) : s.ncard = s.encard 
goal: ↑s.ncard = s.encard

full_name: Set.Nat.card_coe_set_eq
code: theorem Nat.card_coe_set_eq (s : Set α) : Nat.card s = s.ncard 
goal: Nat.card ↑s = s.ncard

full_name: Set.ncard_eq_toFinset_card
code: theorem ncard_eq_toFinset_card (s : Set α) (hs : s.Finite := by toFinite_tac) :
    s.ncard = hs.toFinset.card 
goal: s.ncard = (Set.Finite.toFinset hs).card

full_name: Set.ncard_eq_toFinset_card'
code: theorem ncard_eq_toFinset_card' (s : Set α) [Fintype s] :
    s.ncard = s.toFinset.card 
goal: s.ncard = s.toFinset.card

full_name: Set.encard_le_coe_iff_finite_ncard_le
code: theorem encard_le_coe_iff_finite_ncard_le {k : ℕ} : s.encard ≤ k ↔ s.Finite ∧ s.ncard ≤ k 
goal: s.encard ≤ ↑k ↔ s.Finite ∧ s.ncard ≤ k

full_name: Set.Infinite.ncard
code: theorem Infinite.ncard (hs : s.Infinite) : s.ncard = 0 
goal: s.ncard = 0

full_name: Set.ncard_le_ncard
code: theorem ncard_le_ncard (hst : s ⊆ t) (ht : t.Finite := by toFinite_tac) :
    s.ncard ≤ t.ncard 
goal: s.ncard ≤ t.ncard

full_name: Set.ncard_mono
code: theorem ncard_mono [Finite α] : @Monotone (Set α) _ _ _ ncard 
goal: Monotone Set.ncard

full_name: Set.ncard_eq_zero
code: @[simp] theorem ncard_eq_zero (hs : s.Finite := by toFinite_tac) :
    s.ncard = 0 ↔ s = ∅ 
goal: s.ncard = 0 ↔ s = ∅

full_name: Set.ncard_coe_Finset
code: @[simp, norm_cast] theorem ncard_coe_Finset (s : Finset α) : (s : Set α).ncard = s.card 
goal: (↑s).ncard = s.card

full_name: Set.ncard_univ
code: theorem ncard_univ (α : Type*) : (univ : Set α).ncard = Nat.card α 
goal: Set.univ.ncard = Nat.card α

full_name: Set.ncard_empty
code: @[simp] theorem ncard_empty (α : Type*) : (∅ : Set α).ncard = 0 
goal: ∅.ncard = 0

full_name: Set.ncard_pos
code: theorem ncard_pos (hs : s.Finite := by toFinite_tac) : 0 < s.ncard ↔ s.Nonempty 
goal: 0 < s.ncard ↔ s.Nonempty

full_name: Set.ncard_ne_zero_of_mem
code: theorem ncard_ne_zero_of_mem {a : α} (h : a ∈ s) (hs : s.Finite := by toFinite_tac) : s.ncard ≠ 0 
goal: s.ncard ≠ 0

full_name: Set.finite_of_ncard_ne_zero
code: theorem finite_of_ncard_ne_zero (hs : s.ncard ≠ 0) : s.Finite 
goal: s.Finite

full_name: Set.finite_of_ncard_pos
code: theorem finite_of_ncard_pos (hs : 0 < s.ncard) : s.Finite 
goal: s.Finite

full_name: Set.nonempty_of_ncard_ne_zero
code: theorem nonempty_of_ncard_ne_zero (hs : s.ncard ≠ 0) : s.Nonempty 
goal: s.Nonempty

full_name: Set.ncard_singleton
code: @[simp] theorem ncard_singleton (a : α) : ({a} : Set α).ncard = 1 
goal: {a}.ncard = 1

full_name: Set.ncard_singleton_inter
code: theorem ncard_singleton_inter (a : α) (s : Set α) : ({a} ∩ s).ncard ≤ 1 
goal: ({a} ∩ s).ncard ≤ 1

full_name: Set.ncard_insert_of_not_mem
code: @[simp] theorem ncard_insert_of_not_mem {a : α} (h : a ∉ s) (hs : s.Finite := by toFinite_tac) :
    (insert a s).ncard = s.ncard + 1 
goal: (insert a s).ncard = s.ncard + 1

full_name: Set.ncard_insert_of_mem
code: theorem ncard_insert_of_mem {a : α} (h : a ∈ s) : ncard (insert a s) = s.ncard 
goal: (insert a s).ncard = s.ncard

full_name: Set.ncard_insert_le
code: theorem ncard_insert_le (a : α) (s : Set α) : (insert a s).ncard ≤ s.ncard + 1 
goal: (insert a s).ncard ≤ s.ncard + 1

full_name: Set.ncard_insert_eq_ite
code: theorem ncard_insert_eq_ite {a : α} [Decidable (a ∈ s)] (hs : s.Finite := by toFinite_tac) :
    ncard (insert a s) = if a ∈ s then s.ncard else s.ncard + 1 
goal: (insert a s).ncard = if a ∈ s then s.ncard else s.ncard + 1

full_name: Set.ncard_le_ncard_insert
code: theorem ncard_le_ncard_insert (a : α) (s : Set α) : s.ncard ≤ (insert a s).ncard 
goal: s.ncard ≤ (insert a s).ncard

full_name: Set.ncard_pair
code: @[simp] theorem ncard_pair {a b : α} (h : a ≠ b) : ({a, b} : Set α).ncard = 2 
goal: {a, b}.ncard = 2

full_name: Set.ncard_diff_singleton_add_one
code: @[simp] theorem ncard_diff_singleton_add_one {a : α} (h : a ∈ s)
    (hs : s.Finite := by toFinite_tac) : (s \ {a}).ncard + 1 = s.ncard 
goal: (s \ {a}).ncard + 1 = s.ncard

full_name: Set.ncard_diff_singleton_of_mem
code: @[simp] theorem ncard_diff_singleton_of_mem {a : α} (h : a ∈ s) (hs : s.Finite := by toFinite_tac) :
    (s \ {a}).ncard = s.ncard - 1 
goal: (s \ {a}).ncard = s.ncard - 1

full_name: Set.ncard_diff_singleton_lt_of_mem
code: theorem ncard_diff_singleton_lt_of_mem {a : α} (h : a ∈ s) (hs : s.Finite := by toFinite_tac) :
    (s \ {a}).ncard < s.ncard 
goal: (s \ {a}).ncard < s.ncard

full_name: Set.ncard_diff_singleton_le
code: theorem ncard_diff_singleton_le (s : Set α) (a : α) : (s \ {a}).ncard ≤ s.ncard 
goal: (s \ {a}).ncard ≤ s.ncard

full_name: Set.pred_ncard_le_ncard_diff_singleton
code: theorem pred_ncard_le_ncard_diff_singleton (s : Set α) (a : α) : s.ncard - 1 ≤ (s \ {a}).ncard 
goal: s.ncard - 1 ≤ (s \ {a}).ncard

full_name: Set.ncard_exchange
code: theorem ncard_exchange {a b : α} (ha : a ∉ s) (hb : b ∈ s) : (insert a (s \ {b})).ncard = s.ncard 
goal: (insert a (s \ {b})).ncard = s.ncard

full_name: Set.ncard_exchange'
code: theorem ncard_exchange' {a b : α} (ha : a ∉ s) (hb : b ∈ s) :
    (insert a s \ {b}).ncard = s.ncard 
goal: (insert a s \ {b}).ncard = s.ncard

full_name: Set.ncard_image_le
code: theorem ncard_image_le (hs : s.Finite := by toFinite_tac) : (f '' s).ncard ≤ s.ncard 
goal: (f '' s).ncard ≤ s.ncard

full_name: Set.ncard_image_of_injOn
code: theorem ncard_image_of_injOn (H : Set.InjOn f s) : (f '' s).ncard = s.ncard 
goal: (f '' s).ncard = s.ncard

full_name: Set.injOn_of_ncard_image_eq
code: theorem injOn_of_ncard_image_eq (h : (f '' s).ncard = s.ncard) (hs : s.Finite := by toFinite_tac) :
    Set.InjOn f s 
goal: Set.InjOn f s

full_name: Set.ncard_image_iff
code: theorem ncard_image_iff (hs : s.Finite := by toFinite_tac) :
    (f '' s).ncard = s.ncard ↔ Set.InjOn f s 
goal: (f '' s).ncard = s.ncard ↔ Set.InjOn f s

full_name: Set.ncard_image_of_injective
code: theorem ncard_image_of_injective (s : Set α) (H : f.Injective) : (f '' s).ncard = s.ncard 
goal: (f '' s).ncard = s.ncard

full_name: Set.ncard_preimage_of_injective_subset_range
code: theorem ncard_preimage_of_injective_subset_range {s : Set β} (H : f.Injective)
    (hs : s ⊆ Set.range f) :
    (f ⁻¹' s).ncard = s.ncard 
goal: (f ⁻¹' s).ncard = s.ncard

full_name: Set.fiber_ncard_ne_zero_iff_mem_image
code: theorem fiber_ncard_ne_zero_iff_mem_image {y : β} (hs : s.Finite := by toFinite_tac) :
    { x ∈ s | f x = y }.ncard ≠ 0 ↔ y ∈ f '' s 
goal: {x | x ∈ s ∧ f x = y}.ncard ≠ 0 ↔ y ∈ f '' s

full_name: Set.ncard_map
code: @[simp] theorem ncard_map (f : α ↪ β) : (f '' s).ncard = s.ncard 
goal: (⇑f '' s).ncard = s.ncard

full_name: Set.ncard_subtype
code: @[simp] theorem ncard_subtype (P : α → Prop) (s : Set α) :
    { x : Subtype P | (x : α) ∈ s }.ncard = (s ∩ setOf P).ncard 
goal: {x | ↑x ∈ s}.ncard = (s ∩ setOf P).ncard

full_name: Set.ncard_inter_le_ncard_left
code: theorem ncard_inter_le_ncard_left (s t : Set α) (hs : s.Finite := by toFinite_tac) :
    (s ∩ t).ncard ≤ s.ncard 
goal: (s ∩ t).ncard ≤ s.ncard

full_name: Set.ncard_inter_le_ncard_right
code: theorem ncard_inter_le_ncard_right (s t : Set α) (ht : t.Finite := by toFinite_tac) :
    (s ∩ t).ncard ≤ t.ncard 
goal: (s ∩ t).ncard ≤ t.ncard

full_name: Set.eq_of_subset_of_ncard_le
code: theorem eq_of_subset_of_ncard_le (h : s ⊆ t) (h' : t.ncard ≤ s.ncard)
    (ht : t.Finite := by toFinite_tac) : s = t 
goal: s = t

full_name: Set.subset_iff_eq_of_ncard_le
code: theorem subset_iff_eq_of_ncard_le (h : t.ncard ≤ s.ncard) (ht : t.Finite := by toFinite_tac) :
    s ⊆ t ↔ s = t 
goal: s ⊆ t ↔ s = t

full_name: Set.map_eq_of_subset
code: theorem map_eq_of_subset {f : α ↪ α} (h : f '' s ⊆ s) (hs : s.Finite := by toFinite_tac) :
    f '' s = s 
goal: ⇑f '' s = s

full_name: Set.sep_of_ncard_eq
code: theorem sep_of_ncard_eq {a : α} {P : α → Prop} (h : { x ∈ s | P x }.ncard = s.ncard) (ha : a ∈ s)
    (hs : s.Finite := by toFinite_tac) : P a 
goal: P a

full_name: Set.ncard_lt_ncard
code: theorem ncard_lt_ncard (h : s ⊂ t) (ht : t.Finite := by toFinite_tac) :
    s.ncard < t.ncard 
goal: s.ncard < t.ncard

full_name: Set.ncard_strictMono
code: theorem ncard_strictMono [Finite α] : @StrictMono (Set α) _ _ _ ncard 
goal: StrictMono Set.ncard

full_name: Set.ncard_eq_of_bijective
code: theorem ncard_eq_of_bijective {n : ℕ} (f : ∀ i, i < n → α)
    (hf : ∀ a ∈ s, ∃ i, ∃ h : i < n, f i h = a) (hf' : ∀ (i) (h : i < n), f i h ∈ s)
    (f_inj : ∀ (i j) (hi : i < n) (hj : j < n), f i hi = f j hj → i = j) : s.ncard = n 
goal: s.ncard = n

full_name: Set.ncard_congr
code: theorem ncard_congr {t : Set β} (f : ∀ a ∈ s, β) (h₁ : ∀ a ha, f a ha ∈ t)
    (h₂ : ∀ a b ha hb, f a ha = f b hb → a = b) (h₃ : ∀ b ∈ t, ∃ a ha, f a ha = b) :
    s.ncard = t.ncard 
goal: s.ncard = t.ncard

full_name: Set.ncard_le_ncard_of_injOn
code: theorem ncard_le_ncard_of_injOn {t : Set β} (f : α → β) (hf : ∀ a ∈ s, f a ∈ t) (f_inj : InjOn f s)
    (ht : t.Finite := by toFinite_tac) :
    s.ncard ≤ t.ncard 
goal: s.ncard ≤ t.ncard

full_name: Set.exists_ne_map_eq_of_ncard_lt_of_maps_to
code: theorem exists_ne_map_eq_of_ncard_lt_of_maps_to {t : Set β} (hc : t.ncard < s.ncard) {f : α → β}
    (hf : ∀ a ∈ s, f a ∈ t) (ht : t.Finite := by toFinite_tac) :
    ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ f x = f y 
goal: ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ f x = f y

full_name: Set.le_ncard_of_inj_on_range
code: theorem le_ncard_of_inj_on_range {n : ℕ} (f : ℕ → α) (hf : ∀ i < n, f i ∈ s)
    (f_inj : ∀ i < n, ∀ j < n, f i = f j → i = j) (hs : s.Finite := by toFinite_tac) :
    n ≤ s.ncard 
goal: n ≤ s.ncard

full_name: Set.surj_on_of_inj_on_of_ncard_le
code: theorem surj_on_of_inj_on_of_ncard_le {t : Set β} (f : ∀ a ∈ s, β) (hf : ∀ a ha, f a ha ∈ t)
    (hinj : ∀ a₁ a₂ ha₁ ha₂, f a₁ ha₁ = f a₂ ha₂ → a₁ = a₂) (hst : t.ncard ≤ s.ncard)
    (ht : t.Finite := by toFinite_tac) :
    ∀ b ∈ t, ∃ a ha, b = f a ha 
goal: b ∈ t → ∃ a, ∃ (ha : a ∈ s), b = f a ha

full_name: Set.inj_on_of_surj_on_of_ncard_le
code: theorem inj_on_of_surj_on_of_ncard_le {t : Set β} (f : ∀ a ∈ s, β) (hf : ∀ a ha, f a ha ∈ t)
    (hsurj : ∀ b ∈ t, ∃ a ha, f a ha = b) (hst : s.ncard ≤ t.ncard) ⦃a₁⦄ (ha₁ : a₁ ∈ s) ⦃a₂⦄
    (ha₂ : a₂ ∈ s) (ha₁a₂ : f a₁ ha₁ = f a₂ ha₂) (hs : s.Finite := by toFinite_tac) :
    a₁ = a₂ 
goal: a₁ = a₂

full_name: Set.ncard_union_add_ncard_inter
code: theorem ncard_union_add_ncard_inter (s t : Set α) (hs : s.Finite := by toFinite_tac)
    (ht : t.Finite := by toFinite_tac) : (s ∪ t).ncard + (s ∩ t).ncard = s.ncard + t.ncard 
goal: (s ∪ t).ncard + (s ∩ t).ncard = s.ncard + t.ncard

full_name: Set.ncard_inter_add_ncard_union
code: theorem ncard_inter_add_ncard_union (s t : Set α) (hs : s.Finite := by toFinite_tac)
    (ht : t.Finite := by toFinite_tac) : (s ∩ t).ncard + (s ∪ t).ncard = s.ncard + t.ncard 
goal: (s ∩ t).ncard + (s ∪ t).ncard = s.ncard + t.ncard

full_name: Set.ncard_union_le
code: theorem ncard_union_le (s t : Set α) : (s ∪ t).ncard ≤ s.ncard + t.ncard 
goal: (s ∪ t).ncard ≤ s.ncard + t.ncard

full_name: Set.ncard_union_eq
code: theorem ncard_union_eq (h : Disjoint s t) (hs : s.Finite := by toFinite_tac)
    (ht : t.Finite := by toFinite_tac) : (s ∪ t).ncard = s.ncard + t.ncard 
goal: (s ∪ t).ncard = s.ncard + t.ncard

full_name: Set.ncard_diff_add_ncard_of_subset
code: theorem ncard_diff_add_ncard_of_subset (h : s ⊆ t) (ht : t.Finite := by toFinite_tac) :
    (t \ s).ncard + s.ncard = t.ncard 
goal: (t \ s).ncard + s.ncard = t.ncard

full_name: Set.ncard_diff
code: theorem ncard_diff (h : s ⊆ t) (ht : t.Finite := by toFinite_tac) :
    (t \ s).ncard = t.ncard - s.ncard 
goal: (t \ s).ncard = t.ncard - s.ncard

full_name: Set.ncard_le_ncard_diff_add_ncard
code: theorem ncard_le_ncard_diff_add_ncard (s t : Set α) (ht : t.Finite := by toFinite_tac) :
    s.ncard ≤ (s \ t).ncard + t.ncard 
goal: s.ncard ≤ (s \ t).ncard + t.ncard

full_name: Set.le_ncard_diff
code: theorem le_ncard_diff (s t : Set α) (hs : s.Finite := by toFinite_tac) :
    t.ncard - s.ncard ≤ (t \ s).ncard 
goal: t.ncard - s.ncard ≤ (t \ s).ncard

full_name: Set.ncard_diff_add_ncard
code: theorem ncard_diff_add_ncard (s t : Set α) (hs : s.Finite := by toFinite_tac)
  (ht : t.Finite := by toFinite_tac) :
    (s \ t).ncard + t.ncard = (s ∪ t).ncard 
goal: (s \ t).ncard + t.ncard = (s ∪ t).ncard

full_name: Set.diff_nonempty_of_ncard_lt_ncard
code: theorem diff_nonempty_of_ncard_lt_ncard (h : s.ncard < t.ncard) (hs : s.Finite := by toFinite_tac) :
    (t \ s).Nonempty 
goal: (t \ s).Nonempty

full_name: Set.exists_mem_not_mem_of_ncard_lt_ncard
code: theorem exists_mem_not_mem_of_ncard_lt_ncard (h : s.ncard < t.ncard)
    (hs : s.Finite := by toFinite_tac) : ∃ e, e ∈ t ∧ e ∉ s 
goal: ∃ e ∈ t, e ∉ s

full_name: Set.ncard_inter_add_ncard_diff_eq_ncard
code: @[simp] theorem ncard_inter_add_ncard_diff_eq_ncard (s t : Set α)
    (hs : s.Finite := by toFinite_tac) : (s ∩ t).ncard + (s \ t).ncard = s.ncard 
goal: (s ∩ t).ncard + (s \ t).ncard = s.ncard

full_name: Set.ncard_eq_ncard_iff_ncard_diff_eq_ncard_diff
code: theorem ncard_eq_ncard_iff_ncard_diff_eq_ncard_diff (hs : s.Finite := by toFinite_tac)
    (ht : t.Finite := by toFinite_tac) : s.ncard = t.ncard ↔ (s \ t).ncard = (t \ s).ncard 
goal: s.ncard = t.ncard ↔ (s \ t).ncard = (t \ s).ncard

full_name: Set.ncard_le_ncard_iff_ncard_diff_le_ncard_diff
code: theorem ncard_le_ncard_iff_ncard_diff_le_ncard_diff (hs : s.Finite := by toFinite_tac)
    (ht : t.Finite := by toFinite_tac) : s.ncard ≤ t.ncard ↔ (s \ t).ncard ≤ (t \ s).ncard 
goal: s.ncard ≤ t.ncard ↔ (s \ t).ncard ≤ (t \ s).ncard

full_name: Set.ncard_lt_ncard_iff_ncard_diff_lt_ncard_diff
code: theorem ncard_lt_ncard_iff_ncard_diff_lt_ncard_diff (hs : s.Finite := by toFinite_tac)
    (ht : t.Finite := by toFinite_tac) : s.ncard < t.ncard ↔ (s \ t).ncard < (t \ s).ncard 
goal: s.ncard < t.ncard ↔ (s \ t).ncard < (t \ s).ncard

full_name: Set.ncard_add_ncard_compl
code: theorem ncard_add_ncard_compl (s : Set α) (hs : s.Finite := by toFinite_tac)
    (hsc : sᶜ.Finite := by toFinite_tac) : s.ncard + sᶜ.ncard = Nat.card α 
goal: s.ncard + sᶜ.ncard = Nat.card α

full_name: Set.exists_subsuperset_card_eq
code: /-- Given a subset `s` of a set `t`, of sizes at most and at least `n` respectively, there exists a
set `u` of size `n` which is both a superset of `s` and a subset of `t`. -/
lemma exists_subsuperset_card_eq {n : ℕ} (hst : s ⊆ t) (hsn : s.ncard ≤ n) (hnt : n ≤ t.ncard) :
    ∃ u, s ⊆ u ∧ u ⊆ t ∧ u.ncard = n 
goal: ∃ u, s ⊆ u ∧ u ⊆ t ∧ u.ncard = n

full_name: Set.exists_subset_card_eq
code: /-- We can shrink a set to any smaller size. -/
lemma exists_subset_card_eq {n : ℕ} (hns : n ≤ s.ncard) : ∃ t ⊆ s, t.ncard = n 
goal: ∃ t ⊆ s, t.ncard = n

full_name: Set.exists_intermediate_Set
code: /-- Given a set `t` and a set `s` inside it, we can shrink `t` to any appropriate size, and keep `s`
    inside it. -/
@[deprecated exists_subsuperset_card_eq (since := "2024-06-24")]
theorem exists_intermediate_Set (i : ℕ) (h₁ : i + s.ncard ≤ t.ncard) (h₂ : s ⊆ t) :
    ∃ r : Set α, s ⊆ r ∧ r ⊆ t ∧ r.ncard = i + s.ncard 
goal: ∃ r, s ⊆ r ∧ r ⊆ t ∧ r.ncard = i + s.ncard

full_name: Set.exists_intermediate_set'
code: @[deprecated exists_subsuperset_card_eq (since := "2024-06-24")]
theorem exists_intermediate_set' {m : ℕ} (hs : s.ncard ≤ m) (ht : m ≤ t.ncard) (h : s ⊆ t) :
    ∃ r : Set α, s ⊆ r ∧ r ⊆ t ∧ r.ncard = m 
goal: ∃ r, s ⊆ r ∧ r ⊆ t ∧ r.ncard = m

full_name: Set.exists_smaller_set
code: /-- We can shrink `s` to any smaller size. -/
@[deprecated exists_subset_card_eq (since := "2024-06-23")]
theorem exists_smaller_set (s : Set α) (i : ℕ) (h₁ : i ≤ s.ncard) :
    ∃ t : Set α, t ⊆ s ∧ t.ncard = i 
goal: ∃ t ⊆ s, t.ncard = i

full_name: Set.Infinite.exists_subset_ncard_eq
code: theorem Infinite.exists_subset_ncard_eq {s : Set α} (hs : s.Infinite) (k : ℕ) :
    ∃ t, t ⊆ s ∧ t.Finite ∧ t.ncard = k 
goal: ∃ t ⊆ s, t.Finite ∧ t.ncard = k

full_name: Set.Infinite.exists_superset_ncard_eq
code: theorem Infinite.exists_superset_ncard_eq {s t : Set α} (ht : t.Infinite) (hst : s ⊆ t)
    (hs : s.Finite) {k : ℕ} (hsk : s.ncard ≤ k) : ∃ s', s ⊆ s' ∧ s' ⊆ t ∧ s'.ncard = k 
goal: ∃ s', s ⊆ s' ∧ s' ⊆ t ∧ s'.ncard = k

full_name: Set.exists_subset_or_subset_of_two_mul_lt_ncard
code: theorem exists_subset_or_subset_of_two_mul_lt_ncard {n : ℕ} (hst : 2 * n < (s ∪ t).ncard) :
    ∃ r : Set α, n < r.ncard ∧ (r ⊆ s ∨ r ⊆ t) 
goal: ∃ r, n < r.ncard ∧ (r ⊆ s ∨ r ⊆ t)

full_name: Set.ncard_eq_one
code: @[simp] theorem ncard_eq_one : s.ncard = 1 ↔ ∃ a, s = {a} 
goal: s.ncard = 1 ↔ ∃ a, s = {a}

full_name: Set.exists_eq_insert_iff_ncard
code: theorem exists_eq_insert_iff_ncard (hs : s.Finite := by toFinite_tac) :
    (∃ a ∉ s, insert a s = t) ↔ s ⊆ t ∧ s.ncard + 1 = t.ncard 
goal: (∃ a ∉ s, insert a s = t) ↔ s ⊆ t ∧ s.ncard + 1 = t.ncard

full_name: Set.ncard_le_one
code: theorem ncard_le_one (hs : s.Finite := by toFinite_tac) :
    s.ncard ≤ 1 ↔ ∀ a ∈ s, ∀ b ∈ s, a = b 
goal: s.ncard ≤ 1 ↔ ∀ a ∈ s, ∀ b ∈ s, a = b

full_name: Set.ncard_le_one_iff
code: theorem ncard_le_one_iff (hs : s.Finite := by toFinite_tac) :
    s.ncard ≤ 1 ↔ ∀ {a b}, a ∈ s → b ∈ s → a = b 
goal: s.ncard ≤ 1 ↔ ∀ {a b : α}, a ∈ s → b ∈ s → a = b

full_name: Set.ncard_le_one_iff_eq
code: theorem ncard_le_one_iff_eq (hs : s.Finite := by toFinite_tac) :
    s.ncard ≤ 1 ↔ s = ∅ ∨ ∃ a, s = {a} 
goal: s.ncard ≤ 1 ↔ s = ∅ ∨ ∃ a, s = {a}

full_name: Set.ncard_le_one_iff_subset_singleton
code: theorem ncard_le_one_iff_subset_singleton [Nonempty α]
    (hs : s.Finite := by toFinite_tac) :
    s.ncard ≤ 1 ↔ ∃ x : α, s ⊆ {x} 
goal: s.ncard ≤ 1 ↔ ∃ x, s ⊆ {x}

full_name: Set.ncard_le_one_of_subsingleton
code: /-- A `Set` of a subsingleton type has cardinality at most one. -/
theorem ncard_le_one_of_subsingleton [Subsingleton α] (s : Set α) : s.ncard ≤ 1 
goal: s.ncard ≤ 1

full_name: Set.one_lt_ncard
code: theorem one_lt_ncard (hs : s.Finite := by toFinite_tac) :
    1 < s.ncard ↔ ∃ a ∈ s, ∃ b ∈ s, a ≠ b 
goal: 1 < s.ncard ↔ ∃ a ∈ s, ∃ b ∈ s, a ≠ b

full_name: Set.one_lt_ncard_iff
code: theorem one_lt_ncard_iff (hs : s.Finite := by toFinite_tac) :
    1 < s.ncard ↔ ∃ a b, a ∈ s ∧ b ∈ s ∧ a ≠ b 
goal: 1 < s.ncard ↔ ∃ a b, a ∈ s ∧ b ∈ s ∧ a ≠ b

full_name: Set.two_lt_ncard_iff
code: theorem two_lt_ncard_iff (hs : s.Finite := by toFinite_tac) :
    2 < s.ncard ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c 
goal: 2 < s.ncard ↔ ∃ a b c, a ∈ s ∧ b ∈ s ∧ c ∈ s ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c

full_name: Set.two_lt_ncard
code: theorem two_lt_ncard (hs : s.Finite := by toFinite_tac) :
    2 < s.ncard ↔ ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ a ≠ c ∧ b ≠ c 
goal: 2 < s.ncard ↔ ∃ a ∈ s, ∃ b ∈ s, ∃ c ∈ s, a ≠ b ∧ a ≠ c ∧ b ≠ c

full_name: Set.exists_ne_of_one_lt_ncard
code: theorem exists_ne_of_one_lt_ncard (hs : 1 < s.ncard) (a : α) : ∃ b, b ∈ s ∧ b ≠ a 
goal: ∃ b ∈ s, b ≠ a

full_name: Set.eq_insert_of_ncard_eq_succ
code: theorem eq_insert_of_ncard_eq_succ {n : ℕ} (h : s.ncard = n + 1) :
    ∃ a t, a ∉ t ∧ insert a t = s ∧ t.ncard = n 
goal: ∃ a t, a ∉ t ∧ insert a t = s ∧ t.ncard = n

full_name: Set.ncard_eq_succ
code: theorem ncard_eq_succ {n : ℕ} (hs : s.Finite := by toFinite_tac) :
    s.ncard = n + 1 ↔ ∃ a t, a ∉ t ∧ insert a t = s ∧ t.ncard = n 
goal: s.ncard = n + 1 ↔ ∃ a t, a ∉ t ∧ insert a t = s ∧ t.ncard = n

full_name: Set.ncard_eq_two
code: theorem ncard_eq_two : s.ncard = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y} 
goal: s.ncard = 2 ↔ ∃ x y, x ≠ y ∧ s = {x, y}

full_name: Set.ncard_eq_three
code: theorem ncard_eq_three : s.ncard = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z} 
goal: s.ncard = 3 ↔ ∃ x y z, x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ s = {x, y, z}