File: Mathlib/Data/Fintype/Card.lean

full_name: Fintype.card
code: /-- `card α` is the number of elements in `α`, defined when `α` is a fintype. -/
def card (α) [Fintype α] : ℕ 
goal: ℕ

full_name: Fintype.truncEquivFin
code: /-- There is (computably) an equivalence between `α` and `Fin (card α)`.

Since it is not unique and depends on which permutation
of the universe list is used, the equivalence is wrapped in `Trunc` to
preserve computability.

See `Fintype.equivFin` for the noncomputable version,
and `Fintype.truncEquivFinOfCardEq` and `Fintype.equivFinOfCardEq`
for an equiv `α ≃ Fin n` given `Fintype.card α = n`.

See `Fintype.truncFinBijection` for a version without `[DecidableEq α]`.
-/
def truncEquivFin (α) [DecidableEq α] [Fintype α] : Trunc (α ≃ Fin (card α)) 
goal: Trunc (α ≃ Fin (Fintype.card α))

full_name: Fintype.equivFin
code: /-- There is (noncomputably) an equivalence between `α` and `Fin (card α)`.

See `Fintype.truncEquivFin` for the computable version,
and `Fintype.truncEquivFinOfCardEq` and `Fintype.equivFinOfCardEq`
for an equiv `α ≃ Fin n` given `Fintype.card α = n`.
-/
noncomputable def equivFin (α) [Fintype α] : α ≃ Fin (card α) 
goal: α ≃ Fin (Fintype.card α)

full_name: Fintype.truncFinBijection
code: /-- There is (computably) a bijection between `Fin (card α)` and `α`.

Since it is not unique and depends on which permutation
of the universe list is used, the bijection is wrapped in `Trunc` to
preserve computability.

See `Fintype.truncEquivFin` for a version that gives an equivalence
given `[DecidableEq α]`.
-/
def truncFinBijection (α) [Fintype α] : Trunc { f : Fin (card α) → α // Bijective f } 
goal: Trunc { f // Function.Bijective f }

full_name: Fintype.subtype_card
code: theorem subtype_card {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) :
    @card { x // p x } (Fintype.subtype s H) = s.card 
goal: Fintype.card { x // p x } = s.card

full_name: Fintype.card_of_subtype
code: theorem card_of_subtype {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x)
    [Fintype { x // p x }] : card { x // p x } = s.card 
goal: Fintype.card { x // p x } = s.card

full_name: Fintype.card_ofFinset
code: @[simp]
theorem card_ofFinset {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) :
    @Fintype.card p (ofFinset s H) = s.card 
goal: Fintype.card ↑p = s.card

full_name: Fintype.card_of_finset'
code: theorem card_of_finset' {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) [Fintype p] :
    Fintype.card p = s.card 
goal: Fintype.card ↑p = s.card

full_name: Fintype.ofEquiv_card
code: theorem ofEquiv_card [Fintype α] (f : α ≃ β) : @card β (ofEquiv α f) = card α 
goal: Fintype.card β = Fintype.card α

full_name: Fintype.card_congr
code: theorem card_congr {α β} [Fintype α] [Fintype β] (f : α ≃ β) : card α = card β 
goal: Fintype.card α = Fintype.card β

full_name: Fintype.card_congr'
code: @[congr]
theorem card_congr' {α β} [Fintype α] [Fintype β] (h : α = β) : card α = card β 
goal: Fintype.card α = Fintype.card β

full_name: Fintype.truncEquivFinOfCardEq
code: /-- If the cardinality of `α` is `n`, there is computably a bijection between `α` and `Fin n`.

See `Fintype.equivFinOfCardEq` for the noncomputable definition,
and `Fintype.truncEquivFin` and `Fintype.equivFin` for the bijection `α ≃ Fin (card α)`.
-/
def truncEquivFinOfCardEq [DecidableEq α] {n : ℕ} (h : Fintype.card α = n) : Trunc (α ≃ Fin n) 
goal: Trunc (α ≃ Fin n)

full_name: Fintype.equivFinOfCardEq
code: /-- If the cardinality of `α` is `n`, there is noncomputably a bijection between `α` and `Fin n`.

See `Fintype.truncEquivFinOfCardEq` for the computable definition,
and `Fintype.truncEquivFin` and `Fintype.equivFin` for the bijection `α ≃ Fin (card α)`.
-/
noncomputable def equivFinOfCardEq {n : ℕ} (h : Fintype.card α = n) : α ≃ Fin n 
goal: α ≃ Fin n

full_name: Fintype.truncEquivOfCardEq
code: /-- Two `Fintype`s with the same cardinality are (computably) in bijection.

See `Fintype.equivOfCardEq` for the noncomputable version,
and `Fintype.truncEquivFinOfCardEq` and `Fintype.equivFinOfCardEq` for
the specialization to `Fin`.
-/
def truncEquivOfCardEq [DecidableEq α] [DecidableEq β] (h : card α = card β) : Trunc (α ≃ β) 
goal: Trunc (α ≃ β)

full_name: Fintype.equivOfCardEq
code: /-- Two `Fintype`s with the same cardinality are (noncomputably) in bijection.

See `Fintype.truncEquivOfCardEq` for the computable version,
and `Fintype.truncEquivFinOfCardEq` and `Fintype.equivFinOfCardEq` for
the specialization to `Fin`.
-/
noncomputable def equivOfCardEq (h : card α = card β) : α ≃ β 
goal: α ≃ β

full_name: Fintype.card_eq
code: theorem card_eq {α β} [_F : Fintype α] [_G : Fintype β] : card α = card β ↔ Nonempty (α ≃ β) 
goal: Fintype.card α = Fintype.card β ↔ Nonempty (α ≃ β)

full_name: Fintype.card_ofSubsingleton
code: /-- Note: this lemma is specifically about `Fintype.ofSubsingleton`. For a statement about
arbitrary `Fintype` instances, use either `Fintype.card_le_one_iff_subsingleton` or
`Fintype.card_unique`. -/
@[simp]
theorem card_ofSubsingleton (a : α) [Subsingleton α] : @Fintype.card _ (ofSubsingleton a) = 1 
goal: Fintype.card α = 1

full_name: Fintype.card_unique
code: @[simp]
theorem card_unique [Unique α] [h : Fintype α] : Fintype.card α = 1 
goal: Fintype.card α = 1

full_name: Fintype.card_ofIsEmpty
code: /-- Note: this lemma is specifically about `Fintype.ofIsEmpty`. For a statement about
arbitrary `Fintype` instances, use `Fintype.card_eq_zero`. -/
@[simp]
theorem card_ofIsEmpty [IsEmpty α] : @Fintype.card α Fintype.ofIsEmpty = 0 
goal: Fintype.card α = 0

full_name: Set.toFinset_card
code: @[simp]
theorem toFinset_card {α : Type*} (s : Set α) [Fintype s] : s.toFinset.card = Fintype.card s 
goal: s.toFinset.card = Fintype.card ↑s

full_name: Finset.card_univ
code: @[simp]
theorem Finset.card_univ [Fintype α] : (Finset.univ : Finset α).card = Fintype.card α 
goal: Finset.univ.card = Fintype.card α

full_name: Finset.eq_univ_of_card
code: theorem Finset.eq_univ_of_card [Fintype α] (s : Finset α) (hs : s.card = Fintype.card α) :
    s = univ 
goal: s = Finset.univ

full_name: Finset.card_eq_iff_eq_univ
code: theorem Finset.card_eq_iff_eq_univ [Fintype α] (s : Finset α) :
    s.card = Fintype.card α ↔ s = Finset.univ 
goal: s.card = Fintype.card α ↔ s = Finset.univ

full_name: Finset.card_le_univ
code: theorem Finset.card_le_univ [Fintype α] (s : Finset α) : s.card ≤ Fintype.card α 
goal: s.card ≤ Fintype.card α

full_name: Finset.card_lt_univ_of_not_mem
code: theorem Finset.card_lt_univ_of_not_mem [Fintype α] {s : Finset α} {x : α} (hx : x ∉ s) :
    s.card < Fintype.card α 
goal: s.card < Fintype.card α

full_name: Finset.card_lt_iff_ne_univ
code: theorem Finset.card_lt_iff_ne_univ [Fintype α] (s : Finset α) :
    s.card < Fintype.card α ↔ s ≠ Finset.univ 
goal: s.card < Fintype.card α ↔ s ≠ Finset.univ

full_name: Finset.card_compl_lt_iff_nonempty
code: theorem Finset.card_compl_lt_iff_nonempty [Fintype α] [DecidableEq α] (s : Finset α) :
    sᶜ.card < Fintype.card α ↔ s.Nonempty 
goal: sᶜ.card < Fintype.card α ↔ s.Nonempty

full_name: Finset.card_univ_diff
code: theorem Finset.card_univ_diff [DecidableEq α] [Fintype α] (s : Finset α) :
    (Finset.univ \ s).card = Fintype.card α - s.card 
goal: (Finset.univ \ s).card = Fintype.card α - s.card

full_name: Finset.card_compl
code: theorem Finset.card_compl [DecidableEq α] [Fintype α] (s : Finset α) :
    sᶜ.card = Fintype.card α - s.card 
goal: sᶜ.card = Fintype.card α - s.card

full_name: Finset.card_add_card_compl
code: @[simp]
theorem Finset.card_add_card_compl [DecidableEq α] [Fintype α] (s : Finset α) :
    s.card + sᶜ.card = Fintype.card α 
goal: s.card + sᶜ.card = Fintype.card α

full_name: Finset.card_compl_add_card
code: @[simp]
theorem Finset.card_compl_add_card [DecidableEq α] [Fintype α] (s : Finset α) :
    sᶜ.card + s.card = Fintype.card α 
goal: sᶜ.card + s.card = Fintype.card α

full_name: Fintype.card_compl_set
code: theorem Fintype.card_compl_set [Fintype α] (s : Set α) [Fintype s] [Fintype (↥sᶜ : Sort _)] :
    Fintype.card (↥sᶜ : Sort _) = Fintype.card α - Fintype.card s 
goal: Fintype.card ↑sᶜ = Fintype.card α - Fintype.card ↑s

full_name: Fintype.card_fin
code: @[simp]
theorem Fintype.card_fin (n : ℕ) : Fintype.card (Fin n) = n 
goal: Fintype.card (Fin n) = n

full_name: Fintype.card_fin_lt_of_le
code: theorem Fintype.card_fin_lt_of_le {m n : ℕ} (h : m ≤ n) :
    Fintype.card {i : Fin n // i < m} = m 
goal: Fintype.card { i // ↑i < m } = m

full_name: Finset.card_fin
code: theorem Finset.card_fin (n : ℕ) : Finset.card (Finset.univ : Finset (Fin n)) = n 
goal: Finset.univ.card = n

full_name: fin_injective
code: /-- `Fin` as a map from `ℕ` to `Type` is injective. Note that since this is a statement about
equality of types, using it should be avoided if possible. -/
theorem fin_injective : Function.Injective Fin 
goal: Function.Injective Fin

full_name: Fin.cast_eq_cast'
code: /-- A reversed version of `Fin.cast_eq_cast` that is easier to rewrite with. -/
theorem Fin.cast_eq_cast' {n m : ℕ} (h : Fin n = Fin m) :
    _root_.cast h = Fin.cast (fin_injective h) 
goal: cast h = Fin.cast ⋯

full_name: card_finset_fin_le
code: theorem card_finset_fin_le {n : ℕ} (s : Finset (Fin n)) : s.card ≤ n 
goal: s.card ≤ n

full_name: Fintype.card_subtype_eq
code: theorem Fintype.card_subtype_eq (y : α) [Fintype { x // x = y }] :
    Fintype.card { x // x = y } = 1 
goal: Fintype.card { x // x = y } = 1

full_name: Fintype.card_subtype_eq'
code: theorem Fintype.card_subtype_eq' (y : α) [Fintype { x // y = x }] :
    Fintype.card { x // y = x } = 1 
goal: Fintype.card { x // y = x } = 1

full_name: Fintype.card_empty
code: theorem Fintype.card_empty : Fintype.card Empty = 0 
goal: Fintype.card Empty = 0

full_name: Fintype.card_pempty
code: theorem Fintype.card_pempty : Fintype.card PEmpty = 0 
goal: Fintype.card PEmpty.{u_4 + 1} = 0

full_name: Fintype.card_unit
code: theorem Fintype.card_unit : Fintype.card Unit = 1 
goal: Fintype.card Unit = 1

full_name: Fintype.card_punit
code: @[simp]
theorem Fintype.card_punit : Fintype.card PUnit = 1 
goal: Fintype.card PUnit.{u_4 + 1} = 1

full_name: Fintype.card_bool
code: @[simp]
theorem Fintype.card_bool : Fintype.card Bool = 2 
goal: Fintype.card Bool = 2

full_name: Fintype.card_ulift
code: @[simp]
theorem Fintype.card_ulift (α : Type*) [Fintype α] : Fintype.card (ULift α) = Fintype.card α 
goal: Fintype.card (ULift.{u_5, u_4} α) = Fintype.card α

full_name: Fintype.card_plift
code: @[simp]
theorem Fintype.card_plift (α : Type*) [Fintype α] : Fintype.card (PLift α) = Fintype.card α 
goal: Fintype.card (PLift α) = Fintype.card α

full_name: Fintype.card_orderDual
code: @[simp]
theorem Fintype.card_orderDual (α : Type*) [Fintype α] : Fintype.card αᵒᵈ = Fintype.card α 
goal: Fintype.card αᵒᵈ = Fintype.card α

full_name: Fintype.card_lex
code: @[simp]
theorem Fintype.card_lex (α : Type*) [Fintype α] : Fintype.card (Lex α) = Fintype.card α 
goal: Fintype.card (Lex α) = Fintype.card α

full_name: Fintype.card_multiplicative
code: @[simp] lemma Fintype.card_multiplicative (α : Type*) [Fintype α] :
    card (Multiplicative α) = card α 
goal: Fintype.card (Multiplicative α) = Fintype.card α

full_name: Fintype.card_additive
code: @[simp] lemma Fintype.card_additive (α : Type*) [Fintype α] : card (Additive α) = card α 
goal: Fintype.card (Additive α) = Fintype.card α

full_name: Fintype.sumLeft
code: /-- Given that `α ⊕ β` is a fintype, `α` is also a fintype. This is non-computable as it uses
that `Sum.inl` is an injection, but there's no clear inverse if `α` is empty. -/
noncomputable def Fintype.sumLeft {α β} [Fintype (α ⊕ β)] : Fintype α 
goal: Fintype α

full_name: Fintype.sumRight
code: /-- Given that `α ⊕ β` is a fintype, `β` is also a fintype. This is non-computable as it uses
that `Sum.inr` is an injection, but there's no clear inverse if `β` is empty. -/
noncomputable def Fintype.sumRight {α β} [Fintype (α ⊕ β)] : Fintype β 
goal: Fintype β

full_name: Fintype.finite
code: protected theorem Fintype.finite {α : Type*} (_inst : Fintype α) : Finite α 
goal: Finite α

full_name: Finite.of_fintype
code: /-- For efficiency reasons, we want `Finite` instances to have higher
priority than ones coming from `Fintype` instances. -/
-- @[nolint fintype_finite] -- Porting note: do we need this
instance (priority := 900) Finite.of_fintype (α : Type*) [Fintype α] : Finite α 
goal: Finite α

full_name: finite_iff_nonempty_fintype
code: theorem finite_iff_nonempty_fintype (α : Type*) : Finite α ↔ Nonempty (Fintype α) 
goal: Finite α ↔ Nonempty (Fintype α)

full_name: nonempty_fintype
code: /-- See also `nonempty_encodable`, `nonempty_denumerable`. -/
theorem nonempty_fintype (α : Type*) [Finite α] : Nonempty (Fintype α) 
goal: Nonempty (Fintype α)

full_name: Fintype.ofFinite
code: /-- Noncomputably get a `Fintype` instance from a `Finite` instance. This is not an
instance because we want `Fintype` instances to be useful for computations. -/
noncomputable def Fintype.ofFinite (α : Type*) [Finite α] : Fintype α 
goal: Fintype α

full_name: Finite.of_injective
code: theorem Finite.of_injective {α β : Sort*} [Finite β] (f : α → β) (H : Injective f) : Finite α 
goal: Finite α

full_name: Subtype.finite
code: /-- This instance also provides `[Finite s]` for `s : Set α`. -/
instance Subtype.finite {α : Sort*} [Finite α] {p : α → Prop} : Finite { x // p x } 
goal: Finite { x // p x }

full_name: Finite.of_surjective
code: theorem Finite.of_surjective {α β : Sort*} [Finite α] (f : α → β) (H : Surjective f) : Finite β 
goal: Finite β

full_name: Finite.exists_univ_list
code: theorem Finite.exists_univ_list (α) [Finite α] : ∃ l : List α, l.Nodup ∧ ∀ x : α, x ∈ l 
goal: ∃ l, l.Nodup ∧ ∀ (x : α), x ∈ l

full_name: List.Nodup.length_le_card
code: theorem List.Nodup.length_le_card {α : Type*} [Fintype α] {l : List α} (h : l.Nodup) :
    l.length ≤ Fintype.card α 
goal: l.length ≤ Fintype.card α

full_name: Fintype.card_le_of_injective
code: theorem card_le_of_injective (f : α → β) (hf : Function.Injective f) : card α ≤ card β 
goal: Fintype.card α ≤ Fintype.card β

full_name: Fintype.card_le_of_embedding
code: theorem card_le_of_embedding (f : α ↪ β) : card α ≤ card β 
goal: Fintype.card α ≤ Fintype.card β

full_name: Fintype.card_lt_of_injective_of_not_mem
code: theorem card_lt_of_injective_of_not_mem (f : α → β) (h : Function.Injective f) {b : β}
    (w : b ∉ Set.range f) : card α < card β 
goal: Fintype.card α < Fintype.card β

full_name: Fintype.card_lt_of_injective_not_surjective
code: theorem card_lt_of_injective_not_surjective (f : α → β) (h : Function.Injective f)
    (h' : ¬Function.Surjective f) : card α < card β 
goal: Fintype.card α < Fintype.card β

full_name: Fintype.card_le_of_surjective
code: theorem card_le_of_surjective (f : α → β) (h : Function.Surjective f) : card β ≤ card α 
goal: Fintype.card β ≤ Fintype.card α

full_name: Fintype.card_range_le
code: theorem card_range_le {α β : Type*} (f : α → β) [Fintype α] [Fintype (Set.range f)] :
    Fintype.card (Set.range f) ≤ Fintype.card α 
goal: Fintype.card ↑(Set.range f) ≤ Fintype.card α

full_name: Fintype.card_range
code: theorem card_range {α β F : Type*} [FunLike F α β] [EmbeddingLike F α β] (f : F) [Fintype α]
    [Fintype (Set.range f)] : Fintype.card (Set.range f) = Fintype.card α 
goal: Fintype.card ↑(Set.range ⇑f) = Fintype.card α

full_name: Fintype.exists_ne_map_eq_of_card_lt
code: /-- The pigeonhole principle for finitely many pigeons and pigeonholes.
This is the `Fintype` version of `Finset.exists_ne_map_eq_of_card_lt_of_maps_to`.
-/
theorem exists_ne_map_eq_of_card_lt (f : α → β) (h : Fintype.card β < Fintype.card α) :
    ∃ x y, x ≠ y ∧ f x = f y 
goal: ∃ x y, x ≠ y ∧ f x = f y

full_name: Fintype.card_eq_one_iff
code: theorem card_eq_one_iff : card α = 1 ↔ ∃ x : α, ∀ y, y = x 
goal: Fintype.card α = 1 ↔ ∃ x, ∀ (y : α), y = x

full_name: Fintype.card_eq_zero_iff
code: theorem card_eq_zero_iff : card α = 0 ↔ IsEmpty α 
goal: Fintype.card α = 0 ↔ IsEmpty α

full_name: Fintype.card_eq_zero
code: @[simp] theorem card_eq_zero [IsEmpty α] : card α = 0 
goal: Fintype.card α = 0

full_name: Fintype.card_eq_one_iff_nonempty_unique
code: theorem card_eq_one_iff_nonempty_unique : card α = 1 ↔ Nonempty (Unique α) 
goal: Fintype.card α = 1 ↔ Nonempty (Unique α)

full_name: Fintype.cardEqZeroEquivEquivEmpty
code: /-- A `Fintype` with cardinality zero is equivalent to `Empty`. -/
def cardEqZeroEquivEquivEmpty : card α = 0 ≃ (α ≃ Empty) 
goal: Fintype.card α = 0 ≃ (α ≃ Empty)

full_name: Fintype.card_pos_iff
code: theorem card_pos_iff : 0 < card α ↔ Nonempty α 
goal: 0 < Fintype.card α ↔ Nonempty α

full_name: Fintype.card_pos
code: theorem card_pos [h : Nonempty α] : 0 < card α 
goal: 0 < Fintype.card α

full_name: Fintype.card_ne_zero
code: @[simp]
theorem card_ne_zero [Nonempty α] : card α ≠ 0 
goal: Fintype.card α ≠ 0

full_name: Fintype.instNeZeroNatCardOfNonempty
code: instance [Nonempty α] : NeZero (card α) 
goal: NeZero (Fintype.card α)

full_name: Fintype.card_le_one_iff
code: theorem card_le_one_iff : card α ≤ 1 ↔ ∀ a b : α, a = b 
goal: Fintype.card α ≤ 1 ↔ ∀ (a b : α), a = b

full_name: Fintype.card_le_one_iff_subsingleton
code: theorem card_le_one_iff_subsingleton : card α ≤ 1 ↔ Subsingleton α 
goal: Fintype.card α ≤ 1 ↔ Subsingleton α

full_name: Fintype.one_lt_card_iff_nontrivial
code: theorem one_lt_card_iff_nontrivial : 1 < card α ↔ Nontrivial α 
goal: 1 < Fintype.card α ↔ Nontrivial α

full_name: Fintype.exists_ne_of_one_lt_card
code: theorem exists_ne_of_one_lt_card (h : 1 < card α) (a : α) : ∃ b : α, b ≠ a 
goal: ∃ b, b ≠ a

full_name: Fintype.exists_pair_of_one_lt_card
code: theorem exists_pair_of_one_lt_card (h : 1 < card α) : ∃ a b : α, a ≠ b 
goal: ∃ a b, a ≠ b

full_name: Fintype.card_eq_one_of_forall_eq
code: theorem card_eq_one_of_forall_eq {i : α} (h : ∀ j, j = i) : card α = 1 
goal: Fintype.card α = 1

full_name: Fintype.exists_unique_iff_card_one
code: theorem exists_unique_iff_card_one {α} [Fintype α] (p : α → Prop) [DecidablePred p] :
    (∃! a : α, p a) ↔ (Finset.univ.filter p).card = 1 
goal: (∃! a, p a) ↔ (Finset.filter p Finset.univ).card = 1

full_name: Fintype.one_lt_card
code: theorem one_lt_card [h : Nontrivial α] : 1 < Fintype.card α 
goal: 1 < Fintype.card α

full_name: Fintype.one_lt_card_iff
code: theorem one_lt_card_iff : 1 < card α ↔ ∃ a b : α, a ≠ b 
goal: 1 < Fintype.card α ↔ ∃ a b, a ≠ b

full_name: Fintype.two_lt_card_iff
code: nonrec theorem two_lt_card_iff : 2 < card α ↔ ∃ a b c : α, a ≠ b ∧ a ≠ c ∧ b ≠ c 
goal: 2 < Fintype.card α ↔ ∃ a b c, a ≠ b ∧ a ≠ c ∧ b ≠ c

full_name: Fintype.card_of_bijective
code: theorem card_of_bijective {f : α → β} (hf : Bijective f) : card α = card β 
goal: Fintype.card α = Fintype.card β

full_name: Finite.surjective_of_injective
code: theorem surjective_of_injective {f : α → α} (hinj : Injective f) : Surjective f 
goal: Function.Surjective f

full_name: Finite.injective_iff_surjective
code: theorem injective_iff_surjective {f : α → α} : Injective f ↔ Surjective f 
goal: Function.Injective f ↔ Function.Surjective f

full_name: Finite.injective_iff_bijective
code: theorem injective_iff_bijective {f : α → α} : Injective f ↔ Bijective f 
goal: Function.Injective f ↔ Function.Bijective f

full_name: Finite.surjective_iff_bijective
code: theorem surjective_iff_bijective {f : α → α} : Surjective f ↔ Bijective f 
goal: Function.Surjective f ↔ Function.Bijective f

full_name: Finite.injective_iff_surjective_of_equiv
code: theorem injective_iff_surjective_of_equiv {f : α → β} (e : α ≃ β) : Injective f ↔ Surjective f 
goal: Function.Injective f ↔ Function.Surjective f

full_name: Fintype.bijective_iff_injective_and_card
code: theorem bijective_iff_injective_and_card (f : α → β) :
    Bijective f ↔ Injective f ∧ card α = card β 
goal: Function.Bijective f ↔ Function.Injective f ∧ Fintype.card α = Fintype.card β

full_name: Fintype.bijective_iff_surjective_and_card
code: theorem bijective_iff_surjective_and_card (f : α → β) :
    Bijective f ↔ Surjective f ∧ card α = card β 
goal: Function.Bijective f ↔ Function.Surjective f ∧ Fintype.card α = Fintype.card β

full_name: Function.LeftInverse.rightInverse_of_card_le
code: theorem _root_.Function.LeftInverse.rightInverse_of_card_le {f : α → β} {g : β → α}
    (hfg : LeftInverse f g) (hcard : card α ≤ card β) : RightInverse f g 
goal: Function.RightInverse f g

full_name: Function.RightInverse.leftInverse_of_card_le
code: theorem _root_.Function.RightInverse.leftInverse_of_card_le {f : α → β} {g : β → α}
    (hfg : RightInverse f g) (hcard : card β ≤ card α) : LeftInverse f g 
goal: Function.LeftInverse f g

full_name: Equiv.ofLeftInverseOfCardLE_symm_apply
code: /-- Construct an equivalence from functions that are inverse to each other. -/
@[simps]
def ofLeftInverseOfCardLE (hβα : card β ≤ card α) (f : α → β) (g : β → α) (h : LeftInverse g f) :
    α ≃ β 
goal: ∀ (a : β), (Equiv.ofLeftInverseOfCardLE hβα f g h).symm a = g a

full_name: Equiv.ofLeftInverseOfCardLE
code: /-- Construct an equivalence from functions that are inverse to each other. -/
@[simps]
def ofLeftInverseOfCardLE (hβα : card β ≤ card α) (f : α → β) (g : β → α) (h : LeftInverse g f) :
    α ≃ β 
goal: α ≃ β

full_name: Equiv.ofLeftInverseOfCardLE_apply
code: /-- Construct an equivalence from functions that are inverse to each other. -/
@[simps]
def ofLeftInverseOfCardLE (hβα : card β ≤ card α) (f : α → β) (g : β → α) (h : LeftInverse g f) :
    α ≃ β 
goal: ∀ (a : α), (Equiv.ofLeftInverseOfCardLE hβα f g h) a = f a

full_name: Equiv.ofRightInverseOfCardLE_apply
code: /-- Construct an equivalence from functions that are inverse to each other. -/
@[simps]
def ofRightInverseOfCardLE (hαβ : card α ≤ card β) (f : α → β) (g : β → α) (h : RightInverse g f) :
    α ≃ β 
goal: ∀ (a : α), (Equiv.ofRightInverseOfCardLE hαβ f g h) a = f a

full_name: Equiv.ofRightInverseOfCardLE_symm_apply
code: /-- Construct an equivalence from functions that are inverse to each other. -/
@[simps]
def ofRightInverseOfCardLE (hαβ : card α ≤ card β) (f : α → β) (g : β → α) (h : RightInverse g f) :
    α ≃ β 
goal: ∀ (a : β), (Equiv.ofRightInverseOfCardLE hαβ f g h).symm a = g a

full_name: Equiv.ofRightInverseOfCardLE
code: /-- Construct an equivalence from functions that are inverse to each other. -/
@[simps]
def ofRightInverseOfCardLE (hαβ : card α ≤ card β) (f : α → β) (g : β → α) (h : RightInverse g f) :
    α ≃ β 
goal: α ≃ β

full_name: Fintype.card_coe
code: @[simp]
theorem Fintype.card_coe (s : Finset α) [Fintype s] : Fintype.card s = s.card 
goal: Fintype.card { x // x ∈ s } = s.card

full_name: Finset.equivFin
code: /-- Noncomputable equivalence between a finset `s` coerced to a type and `Fin s.card`. -/
noncomputable def Finset.equivFin (s : Finset α) : s ≃ Fin s.card 
goal: { x // x ∈ s } ≃ Fin s.card

full_name: Finset.equivFinOfCardEq
code: /-- Noncomputable equivalence between a finset `s` as a fintype and `Fin n`, when there is a
proof that `s.card = n`. -/
noncomputable def Finset.equivFinOfCardEq {s : Finset α} {n : ℕ} (h : s.card = n) : s ≃ Fin n 
goal: { x // x ∈ s } ≃ Fin n

full_name: Finset.card_eq_of_equiv_fin
code: theorem Finset.card_eq_of_equiv_fin {s : Finset α} {n : ℕ} (i : s ≃ Fin n) : s.card = n 
goal: s.card = n

full_name: Finset.card_eq_of_equiv_fintype
code: theorem Finset.card_eq_of_equiv_fintype {s : Finset α} [Fintype β] (i : s ≃ β) :
    s.card = Fintype.card β 
goal: s.card = Fintype.card β

full_name: Finset.equivOfCardEq
code: /-- Noncomputable equivalence between two finsets `s` and `t` as fintypes when there is a proof
that `s.card = t.card`. -/
noncomputable def Finset.equivOfCardEq {s : Finset α} {t : Finset β} (h : s.card = t.card) :
    s ≃ t 
goal: { x // x ∈ s } ≃ { x // x ∈ t }

full_name: Finset.card_eq_of_equiv
code: theorem Finset.card_eq_of_equiv {s : Finset α} {t : Finset β} (i : s ≃ t) : s.card = t.card 
goal: s.card = t.card

full_name: Finset.exists_superset_card_eq
code: /-- We can inflate a set `s` to any bigger size. -/
lemma Finset.exists_superset_card_eq [Fintype α] {n : ℕ} {s : Finset α} (hsn : s.card ≤ n)
    (hnα : n ≤ Fintype.card α) :
    ∃ t, s ⊆ t ∧ t.card = n 
goal: ∃ t, s ⊆ t ∧ t.card = n

full_name: Fintype.card_prop
code: @[simp]
theorem Fintype.card_prop : Fintype.card Prop = 2 
goal: Fintype.card Prop = 2

full_name: set_fintype_card_le_univ
code: theorem set_fintype_card_le_univ [Fintype α] (s : Set α) [Fintype s] :
    Fintype.card s ≤ Fintype.card α 
goal: Fintype.card ↑s ≤ Fintype.card α

full_name: set_fintype_card_eq_univ_iff
code: theorem set_fintype_card_eq_univ_iff [Fintype α] (s : Set α) [Fintype s] :
    Fintype.card s = Fintype.card α ↔ s = Set.univ 
goal: Fintype.card ↑s = Fintype.card α ↔ s = Set.univ

full_name: Function.Embedding.equivOfFintypeSelfEmbedding
code: /-- An embedding from a `Fintype` to itself can be promoted to an equivalence. -/
noncomputable def equivOfFintypeSelfEmbedding [Finite α] (e : α ↪ α) : α ≃ α 
goal: α ≃ α

full_name: Function.Embedding.equiv_of_fintype_self_embedding_to_embedding
code: @[simp]
theorem equiv_of_fintype_self_embedding_to_embedding [Finite α] (e : α ↪ α) :
    e.equivOfFintypeSelfEmbedding.toEmbedding = e 
goal: e.equivOfFintypeSelfEmbedding.toEmbedding = e

full_name: Function.Embedding.isEmpty_of_card_lt
code: /-- If `‖β‖ < ‖α‖` there are no embeddings `α ↪ β`.
This is a formulation of the pigeonhole principle.

Note this cannot be an instance as it needs `h`. -/
@[simp]
theorem isEmpty_of_card_lt [Fintype α] [Fintype β] (h : Fintype.card β < Fintype.card α) :
    IsEmpty (α ↪ β) 
goal: IsEmpty (α ↪ β)

full_name: Function.Embedding.truncOfCardLE
code: /-- A constructive embedding of a fintype `α` in another fintype `β` when `card α ≤ card β`. -/
def truncOfCardLE [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β]
    (h : Fintype.card α ≤ Fintype.card β) : Trunc (α ↪ β) 
goal: Trunc (α ↪ β)

full_name: Function.Embedding.nonempty_of_card_le
code: theorem nonempty_of_card_le [Fintype α] [Fintype β] (h : Fintype.card α ≤ Fintype.card β) :
    Nonempty (α ↪ β) 
goal: Nonempty (α ↪ β)

full_name: Function.Embedding.nonempty_iff_card_le
code: theorem nonempty_iff_card_le [Fintype α] [Fintype β] :
    Nonempty (α ↪ β) ↔ Fintype.card α ≤ Fintype.card β 
goal: Nonempty (α ↪ β) ↔ Fintype.card α ≤ Fintype.card β

full_name: Function.Embedding.exists_of_card_le_finset
code: theorem exists_of_card_le_finset [Fintype α] {s : Finset β} (h : Fintype.card α ≤ s.card) :
    ∃ f : α ↪ β, Set.range f ⊆ s 
goal: ∃ f, Set.range ⇑f ⊆ ↑s

full_name: Finset.univ_map_embedding
code: @[simp]
theorem Finset.univ_map_embedding {α : Type*} [Fintype α] (e : α ↪ α) : univ.map e = univ 
goal: Finset.map e Finset.univ = Finset.univ

full_name: Fintype.card_lt_of_surjective_not_injective
code: theorem card_lt_of_surjective_not_injective [Fintype α] [Fintype β] (f : α → β)
    (h : Function.Surjective f) (h' : ¬Function.Injective f) : card β < card α 
goal: Fintype.card β < Fintype.card α

full_name: Fintype.card_subtype_le
code: theorem Fintype.card_subtype_le [Fintype α] (p : α → Prop) [DecidablePred p] :
    Fintype.card { x // p x } ≤ Fintype.card α 
goal: Fintype.card { x // p x } ≤ Fintype.card α

full_name: Fintype.card_subtype_lt
code: theorem Fintype.card_subtype_lt [Fintype α] {p : α → Prop} [DecidablePred p] {x : α} (hx : ¬p x) :
    Fintype.card { x // p x } < Fintype.card α 
goal: Fintype.card { x // p x } < Fintype.card α

full_name: Fintype.card_subtype
code: theorem Fintype.card_subtype [Fintype α] (p : α → Prop) [DecidablePred p] :
    Fintype.card { x // p x } = ((Finset.univ : Finset α).filter p).card 
goal: Fintype.card { x // p x } = (Finset.filter p Finset.univ).card

full_name: Fintype.card_subtype_compl
code: @[simp]
theorem Fintype.card_subtype_compl [Fintype α] (p : α → Prop) [Fintype { x // p x }]
    [Fintype { x // ¬p x }] :
    Fintype.card { x // ¬p x } = Fintype.card α - Fintype.card { x // p x } 
goal: Fintype.card { x // ¬p x } = Fintype.card α - Fintype.card { x // p x }

full_name: Fintype.card_subtype_mono
code: theorem Fintype.card_subtype_mono (p q : α → Prop) (h : p ≤ q) [Fintype { x // p x }]
    [Fintype { x // q x }] : Fintype.card { x // p x } ≤ Fintype.card { x // q x } 
goal: Fintype.card { x // p x } ≤ Fintype.card { x // q x }

full_name: Fintype.card_compl_eq_card_compl
code: /-- If two subtypes of a fintype have equal cardinality, so do their complements. -/
theorem Fintype.card_compl_eq_card_compl [Finite α] (p q : α → Prop) [Fintype { x // p x }]
    [Fintype { x // ¬p x }] [Fintype { x // q x }] [Fintype { x // ¬q x }]
    (h : Fintype.card { x // p x } = Fintype.card { x // q x }) :
    Fintype.card { x // ¬p x } = Fintype.card { x // ¬q x } 
goal: Fintype.card { x // ¬p x } = Fintype.card { x // ¬q x }

full_name: Fintype.card_quotient_le
code: theorem Fintype.card_quotient_le [Fintype α] (s : Setoid α)
    [DecidableRel ((· ≈ ·) : α → α → Prop)] : Fintype.card (Quotient s) ≤ Fintype.card α 
goal: Fintype.card (Quotient s) ≤ Fintype.card α

full_name: Fintype.card_quotient_lt
code: theorem Fintype.card_quotient_lt [Fintype α] {s : Setoid α} [DecidableRel ((· ≈ ·) : α → α → Prop)]
    {x y : α} (h1 : x ≠ y) (h2 : x ≈ y) : Fintype.card (Quotient s) < Fintype.card α 
goal: Fintype.card (Quotient s) < Fintype.card α

full_name: univ_eq_singleton_of_card_one
code: theorem univ_eq_singleton_of_card_one {α} [Fintype α] (x : α) (h : Fintype.card α = 1) :
    (univ : Finset α) = {x} 
goal: Finset.univ = {x}

full_name: Finite.wellFounded_of_trans_of_irrefl
code: theorem wellFounded_of_trans_of_irrefl (r : α → α → Prop) [IsTrans α r] [IsIrrefl α r] :
    WellFounded r 
goal: WellFounded r

full_name: Finite.to_wellFoundedLT
code: instance (priority := 100) to_wellFoundedLT [Preorder α] : WellFoundedLT α 
goal: WellFoundedLT α

full_name: Finite.to_wellFoundedGT
code: instance (priority := 100) to_wellFoundedGT [Preorder α] : WellFoundedGT α 
goal: WellFoundedGT α

full_name: Finite.LinearOrder.isWellOrder_lt
code: instance (priority := 10) LinearOrder.isWellOrder_lt [LinearOrder α] : IsWellOrder α (· < ·) 
goal: IsWellOrder α fun x x_1 => x < x_1

full_name: Finite.LinearOrder.isWellOrder_gt
code: instance (priority := 10) LinearOrder.isWellOrder_gt [LinearOrder α] : IsWellOrder α (· > ·) 
goal: IsWellOrder α fun x x_1 => x > x_1

full_name: Fintype.false
code: protected theorem Fintype.false [Infinite α] (_h : Fintype α) : False 
goal: False

full_name: isEmpty_fintype
code: @[simp]
theorem isEmpty_fintype {α : Type*} : IsEmpty (Fintype α) ↔ Infinite α 
goal: IsEmpty (Fintype α) ↔ Infinite α

full_name: fintypeOfNotInfinite
code: /-- A non-infinite type is a fintype. -/
noncomputable def fintypeOfNotInfinite {α : Type*} (h : ¬Infinite α) : Fintype α 
goal: Fintype α

full_name: fintypeOrInfinite
code: /-- Any type is (classically) either a `Fintype`, or `Infinite`.

One can obtain the relevant typeclasses via `cases fintypeOrInfinite α`.
-/
noncomputable def fintypeOrInfinite (α : Type*) : Fintype α ⊕' Infinite α 
goal: Fintype α ⊕' Infinite α

full_name: Finset.exists_minimal
code: theorem Finset.exists_minimal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬x < m 
goal: ∃ m ∈ s, ∀ x ∈ s, ¬x < m

full_name: Finset.exists_maximal
code: theorem Finset.exists_maximal {α : Type*} [Preorder α] (s : Finset α) (h : s.Nonempty) :
    ∃ m ∈ s, ∀ x ∈ s, ¬m < x 
goal: ∃ m ∈ s, ∀ x ∈ s, ¬m < x

full_name: Infinite.of_not_fintype
code: theorem of_not_fintype (h : Fintype α → False) : Infinite α 
goal: Infinite α

full_name: Infinite.of_injective_to_set
code: /-- If `s : Set α` is a proper subset of `α` and `f : α → s` is injective, then `α` is infinite. -/
theorem of_injective_to_set {s : Set α} (hs : s ≠ Set.univ) {f : α → s} (hf : Injective f) :
    Infinite α 
goal: Infinite α

full_name: Infinite.of_surjective_from_set
code: /-- If `s : Set α` is a proper subset of `α` and `f : s → α` is surjective, then `α` is infinite. -/
theorem of_surjective_from_set {s : Set α} (hs : s ≠ Set.univ) {f : s → α} (hf : Surjective f) :
    Infinite α 
goal: Infinite α

full_name: Infinite.exists_not_mem_finset
code: theorem exists_not_mem_finset [Infinite α] (s : Finset α) : ∃ x, x ∉ s 
goal: ∃ x, x ∉ s

full_name: Infinite.instNontrivial
code: instance (priority := 100) (α : Type*) [H : Infinite α] : Nontrivial α 
goal: Nontrivial α

full_name: Infinite.nonempty
code: protected theorem nonempty (α : Type*) [Infinite α] : Nonempty α 
goal: Nonempty α

full_name: Infinite.of_injective
code: theorem of_injective {α β} [Infinite β] (f : β → α) (hf : Injective f) : Infinite α 
goal: Infinite α

full_name: Infinite.of_surjective
code: theorem of_surjective {α β} [Infinite β] (f : α → β) (hf : Surjective f) : Infinite α 
goal: Infinite α

full_name: instInfiniteNat
code: instance : Infinite ℕ 
goal: Infinite ℕ

full_name: Int.infinite
code: instance Int.infinite : Infinite ℤ 
goal: Infinite ℤ

full_name: instInfiniteMultisetOfNonempty
code: instance [Nonempty α] : Infinite (Multiset α) 
goal: Infinite (Multiset α)

full_name: instInfiniteListOfNonempty
code: instance [Nonempty α] : Infinite (List α) 
goal: Infinite (List α)

full_name: String.infinite
code: instance String.infinite : Infinite String 
goal: Infinite String

full_name: Infinite.set
code: instance Infinite.set [Infinite α] : Infinite (Set α) 
goal: Infinite (Set α)

full_name: instInfiniteFinset
code: instance [Infinite α] : Infinite (Finset α) 
goal: Infinite (Finset α)

full_name: instInfiniteOption
code: instance [Infinite α] : Infinite (Option α) 
goal: Infinite (Option α)

full_name: Sum.infinite_of_left
code: instance Sum.infinite_of_left [Infinite α] : Infinite (α ⊕ β) 
goal: Infinite (α ⊕ β)

full_name: Sum.infinite_of_right
code: instance Sum.infinite_of_right [Infinite β] : Infinite (α ⊕ β) 
goal: Infinite (α ⊕ β)

full_name: Prod.infinite_of_right
code: instance Prod.infinite_of_right [Nonempty α] [Infinite β] : Infinite (α × β) 
goal: Infinite (α × β)

full_name: Prod.infinite_of_left
code: instance Prod.infinite_of_left [Infinite α] [Nonempty β] : Infinite (α × β) 
goal: Infinite (α × β)

full_name: instInfiniteProdSubtypeCommute
code: instance instInfiniteProdSubtypeCommute [Mul α] [Infinite α] :
    Infinite { p : α × α // Commute p.1 p.2 } 
goal: Infinite { p // Commute p.1 p.2 }

full_name: _private.Mathlib.Data.Fintype.Card.0.Infinite.natEmbeddingAux
code: private noncomputable def natEmbeddingAux (α : Type*) [Infinite α] : ℕ → α
  
goal: ℕ → α

full_name: _private.Mathlib.Data.Fintype.Card.0.Infinite.natEmbeddingAux_injective
code: private theorem natEmbeddingAux_injective (α : Type*) [Infinite α] :
    Function.Injective (natEmbeddingAux α) 
goal: Function.Injective (Infinite.natEmbeddingAux α)

full_name: Infinite.natEmbedding
code: /-- Embedding of `ℕ` into an infinite type. -/
noncomputable def natEmbedding (α : Type*) [Infinite α] : ℕ ↪ α 
goal: ℕ ↪ α

full_name: Infinite.exists_subset_card_eq
code: /-- See `Infinite.exists_superset_card_eq` for a version that, for an `s : Finset α`,
provides a superset `t : Finset α`, `s ⊆ t` such that `t.card` is fixed. -/
theorem exists_subset_card_eq (α : Type*) [Infinite α] (n : ℕ) : ∃ s : Finset α, s.card = n 
goal: ∃ s, s.card = n

full_name: Infinite.exists_superset_card_eq
code: /-- See `Infinite.exists_subset_card_eq` for a version that provides an arbitrary
`s : Finset α` for any cardinality. -/
theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : s.card ≤ n) :
    ∃ t : Finset α, s ⊆ t ∧ t.card = n 
goal: ∃ t, s ⊆ t ∧ t.card = n

full_name: fintypeOfFinsetCardLe
code: /-- If every finset in a type has bounded cardinality, that type is finite. -/
noncomputable def fintypeOfFinsetCardLe {ι : Type*} (n : ℕ) (w : ∀ s : Finset ι, s.card ≤ n) :
    Fintype ι 
goal: Fintype ι

full_name: not_injective_infinite_finite
code: theorem not_injective_infinite_finite {α β} [Infinite α] [Finite β] (f : α → β) : ¬Injective f 
goal: ¬Function.Injective f

full_name: Finite.exists_ne_map_eq_of_infinite
code: /-- The pigeonhole principle for infinitely many pigeons in finitely many pigeonholes. If there are
infinitely many pigeons in finitely many pigeonholes, then there are at least two pigeons in the
same pigeonhole.

See also: `Fintype.exists_ne_map_eq_of_card_lt`, `Finite.exists_infinite_fiber`.
-/
theorem Finite.exists_ne_map_eq_of_infinite {α β} [Infinite α] [Finite β] (f : α → β) :
    ∃ x y : α, x ≠ y ∧ f x = f y 
goal: ∃ x y, x ≠ y ∧ f x = f y

full_name: Function.Embedding.is_empty
code: instance Function.Embedding.is_empty {α β} [Infinite α] [Finite β] : IsEmpty (α ↪ β) 
goal: IsEmpty (α ↪ β)

full_name: Finite.exists_infinite_fiber
code: /-- The strong pigeonhole principle for infinitely many pigeons in
finitely many pigeonholes.  If there are infinitely many pigeons in
finitely many pigeonholes, then there is a pigeonhole with infinitely
many pigeons.

See also: `Finite.exists_ne_map_eq_of_infinite`
-/
theorem Finite.exists_infinite_fiber [Infinite α] [Finite β] (f : α → β) :
    ∃ y : β, Infinite (f ⁻¹' {y}) 
goal: ∃ y, Infinite ↑(f ⁻¹' {y})

full_name: not_surjective_finite_infinite
code: theorem not_surjective_finite_infinite {α β} [Finite α] [Infinite β] (f : α → β) : ¬Surjective f 
goal: ¬Function.Surjective f

full_name: List.exists_pw_disjoint_with_card
code: /-- For any `c : List ℕ` whose sum is at most `Fintype.card α`,
  we can find `o : List (List α)` whose members have no duplicate,
  whose lengths given by `c`, and which are pairwise disjoint -/
theorem List.exists_pw_disjoint_with_card {α : Type*} [Fintype α]
    {c : List ℕ} (hc : c.sum ≤ Fintype.card α) :
    ∃ o : List (List α),
      o.map length = c ∧ (∀ s ∈ o, s.Nodup) ∧ Pairwise List.Disjoint o 
goal: ∃ o, List.map List.length o = c ∧ (∀ s ∈ o, s.Nodup) ∧ List.Pairwise List.Disjoint o

full_name: truncOfCardPos
code: /-- A `Fintype` with positive cardinality constructively contains an element.
-/
def truncOfCardPos {α} [Fintype α] (h : 0 < Fintype.card α) : Trunc α 
goal: Trunc α

full_name: Fintype.induction_subsingleton_or_nontrivial
code: /-- A custom induction principle for fintypes. The base case is a subsingleton type,
and the induction step is for non-trivial types, and one can assume the hypothesis for
smaller types (via `Fintype.card`).

The major premise is `Fintype α`, so to use this with the `induction` tactic you have to give a name
to that instance and use that name.
-/
@[elab_as_elim]
theorem Fintype.induction_subsingleton_or_nontrivial {P : ∀ (α) [Fintype α], Prop} (α : Type*)
    [Fintype α] (hbase : ∀ (α) [Fintype α] [Subsingleton α], P α)
    (hstep : ∀ (α) [Fintype α] [Nontrivial α],
      (∀ (β) [Fintype β], Fintype.card β < Fintype.card α → P β) → P α) :
    P α 
goal: P α