File: Mathlib/Data/Fintype/Basic.lean

full_name: Fintype.complete
code: /-- `Fintype α` means that `α` is finite, i.e. there are only
  finitely many distinct elements of type `α`. The evidence of this
  is a finset `elems` (a list up to permutation without duplicates),
  together with a proof that everything of type `α` is in the list. -/
class Fintype (α : Type*) where
  /-- The `Finset` containing all elements of a `Fintype` -/
  elems : Finset α
  /-- A proof that `elems` contains every element of the type -/
  complete : ∀ x : α, x ∈ elems
goal: x ∈ Fintype.elems

full_name: Fintype
code: /-- `Fintype α` means that `α` is finite, i.e. there are only
  finitely many distinct elements of type `α`. The evidence of this
  is a finset `elems` (a list up to permutation without duplicates),
  together with a proof that everything of type `α` is in the list. -/
class Fintype (α : Type*) where
  /-- The `Finset` containing all elements of a `Fintype` -/
  elems : Finset α
  /-- A proof that `elems` contains every element of the type -/
  complete : ∀ x : α, x ∈ elems
goal: Type u_4

full_name: Fintype.elems
code: /-- `Fintype α` means that `α` is finite, i.e. there are only
  finitely many distinct elements of type `α`. The evidence of this
  is a finset `elems` (a list up to permutation without duplicates),
  together with a proof that everything of type `α` is in the list. -/
class Fintype (α : Type*) where
  /-- The `Finset` containing all elements of a `Fintype` -/
  elems : Finset α
  /-- A proof that `elems` contains every element of the type -/
  complete : ∀ x : α, x ∈ elems
goal: Finset α

full_name: Finset.univ
code: /-- `univ` is the universal finite set of type `Finset α` implied from
  the assumption `Fintype α`. -/
def univ : Finset α 
goal: Finset α

full_name: Finset.mem_univ
code: @[simp]
theorem mem_univ (x : α) : x ∈ (univ : Finset α) 
goal: x ∈ Finset.univ

full_name: Finset.mem_univ_val
code: theorem mem_univ_val : ∀ x, x ∈ (univ : Finset α).1 
goal: x ∈ Finset.univ.val

full_name: Finset.eq_univ_iff_forall
code: theorem eq_univ_iff_forall : s = univ ↔ ∀ x, x ∈ s 
goal: s = Finset.univ ↔ ∀ (x : α), x ∈ s

full_name: Finset.eq_univ_of_forall
code: theorem eq_univ_of_forall : (∀ x, x ∈ s) → s = univ 
goal: (∀ (x : α), x ∈ s) → s = Finset.univ

full_name: Finset.coe_univ
code: @[simp, norm_cast]
theorem coe_univ : ↑(univ : Finset α) = (Set.univ : Set α) 
goal: ↑Finset.univ = Set.univ

full_name: Finset.coe_eq_univ
code: @[simp, norm_cast]
theorem coe_eq_univ : (s : Set α) = Set.univ ↔ s = univ 
goal: ↑s = Set.univ ↔ s = Finset.univ

full_name: Finset.Nonempty.eq_univ
code: theorem Nonempty.eq_univ [Subsingleton α] : s.Nonempty → s = univ 
goal: s.Nonempty → s = Finset.univ

full_name: Finset.univ_nonempty_iff
code: theorem univ_nonempty_iff : (univ : Finset α).Nonempty ↔ Nonempty α 
goal: Finset.univ.Nonempty ↔ Nonempty α

full_name: Finset.univ_nonempty
code: @[aesop unsafe apply (rule_sets := [finsetNonempty])]
theorem univ_nonempty [Nonempty α] : (univ : Finset α).Nonempty 
goal: Finset.univ.Nonempty

full_name: Finset.univ_eq_empty_iff
code: theorem univ_eq_empty_iff : (univ : Finset α) = ∅ ↔ IsEmpty α 
goal: Finset.univ = ∅ ↔ IsEmpty α

full_name: Finset.univ_nontrivial_iff
code: theorem univ_nontrivial_iff :
    (Finset.univ : Finset α).Nontrivial ↔ Nontrivial α 
goal: Finset.univ.Nontrivial ↔ Nontrivial α

full_name: Finset.univ_nontrivial
code: theorem univ_nontrivial [h : Nontrivial α] :
    (Finset.univ : Finset α).Nontrivial 
goal: Finset.univ.Nontrivial

full_name: Finset.univ_eq_empty
code: @[simp]
theorem univ_eq_empty [IsEmpty α] : (univ : Finset α) = ∅ 
goal: Finset.univ = ∅

full_name: Finset.univ_unique
code: @[simp]
theorem univ_unique [Unique α] : (univ : Finset α) = {default} 
goal: Finset.univ = {default}

full_name: Finset.subset_univ
code: @[simp]
theorem subset_univ (s : Finset α) : s ⊆ univ 
goal: s ⊆ Finset.univ

full_name: Finset.boundedOrder
code: instance boundedOrder : BoundedOrder (Finset α) 
goal: BoundedOrder (Finset α)

full_name: Finset.top_eq_univ
code: @[simp]
theorem top_eq_univ : (⊤ : Finset α) = univ 
goal: ⊤ = Finset.univ

full_name: Finset.ssubset_univ_iff
code: theorem ssubset_univ_iff {s : Finset α} : s ⊂ univ ↔ s ≠ univ 
goal: s ⊂ Finset.univ ↔ s ≠ Finset.univ

full_name: Finset.univ_subset_iff
code: @[simp]
theorem univ_subset_iff {s : Finset α} : univ ⊆ s ↔ s = univ 
goal: Finset.univ ⊆ s ↔ s = Finset.univ

full_name: Finset.codisjoint_left
code: theorem codisjoint_left : Codisjoint s t ↔ ∀ ⦃a⦄, a ∉ s → a ∈ t 
goal: Codisjoint s t ↔ ∀ ⦃a : α⦄, a ∉ s → a ∈ t

full_name: Finset.codisjoint_right
code: theorem codisjoint_right : Codisjoint s t ↔ ∀ ⦃a⦄, a ∉ t → a ∈ s 
goal: Codisjoint s t ↔ ∀ ⦃a : α⦄, a ∉ t → a ∈ s

full_name: Finset.booleanAlgebra
code: instance booleanAlgebra : BooleanAlgebra (Finset α) 
goal: BooleanAlgebra (Finset α)

full_name: Finset.sdiff_eq_inter_compl
code: theorem sdiff_eq_inter_compl (s t : Finset α) : s \ t = s ∩ tᶜ 
goal: s \ t = s ∩ tᶜ

full_name: Finset.compl_eq_univ_sdiff
code: theorem compl_eq_univ_sdiff (s : Finset α) : sᶜ = univ \ s 
goal: sᶜ = Finset.univ \ s

full_name: Finset.mem_compl
code: @[simp]
theorem mem_compl : a ∈ sᶜ ↔ a ∉ s 
goal: a ∈ sᶜ ↔ a ∉ s

full_name: Finset.not_mem_compl
code: theorem not_mem_compl : a ∉ sᶜ ↔ a ∈ s 
goal: a ∉ sᶜ ↔ a ∈ s

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

full_name: Finset.compl_subset_compl
code: @[simp] lemma compl_subset_compl : sᶜ ⊆ tᶜ ↔ t ⊆ s 
goal: sᶜ ⊆ tᶜ ↔ t ⊆ s

full_name: Finset.compl_ssubset_compl
code: @[simp] lemma compl_ssubset_compl : sᶜ ⊂ tᶜ ↔ t ⊂ s 
goal: sᶜ ⊂ tᶜ ↔ t ⊂ s

full_name: Finset.subset_compl_comm
code: lemma subset_compl_comm : s ⊆ tᶜ ↔ t ⊆ sᶜ 
goal: s ⊆ tᶜ ↔ t ⊆ sᶜ

full_name: Finset.subset_compl_singleton
code: @[simp] lemma subset_compl_singleton : s ⊆ {a}ᶜ ↔ a ∉ s 
goal: s ⊆ {a}ᶜ ↔ a ∉ s

full_name: Finset.compl_empty
code: @[simp]
theorem compl_empty : (∅ : Finset α)ᶜ = univ 
goal: ∅ᶜ = Finset.univ

full_name: Finset.compl_univ
code: @[simp]
theorem compl_univ : (univ : Finset α)ᶜ = ∅ 
goal: Finset.univᶜ = ∅

full_name: Finset.compl_eq_empty_iff
code: @[simp]
theorem compl_eq_empty_iff (s : Finset α) : sᶜ = ∅ ↔ s = univ 
goal: sᶜ = ∅ ↔ s = Finset.univ

full_name: Finset.compl_eq_univ_iff
code: @[simp]
theorem compl_eq_univ_iff (s : Finset α) : sᶜ = univ ↔ s = ∅ 
goal: sᶜ = Finset.univ ↔ s = ∅

full_name: Finset.union_compl
code: @[simp]
theorem union_compl (s : Finset α) : s ∪ sᶜ = univ 
goal: s ∪ sᶜ = Finset.univ

full_name: Finset.inter_compl
code: @[simp]
theorem inter_compl (s : Finset α) : s ∩ sᶜ = ∅ 
goal: s ∩ sᶜ = ∅

full_name: Finset.compl_union
code: @[simp]
theorem compl_union (s t : Finset α) : (s ∪ t)ᶜ = sᶜ ∩ tᶜ 
goal: (s ∪ t)ᶜ = sᶜ ∩ tᶜ

full_name: Finset.compl_inter
code: @[simp]
theorem compl_inter (s t : Finset α) : (s ∩ t)ᶜ = sᶜ ∪ tᶜ 
goal: (s ∩ t)ᶜ = sᶜ ∪ tᶜ

full_name: Finset.compl_erase
code: @[simp]
theorem compl_erase : (s.erase a)ᶜ = insert a sᶜ 
goal: (s.erase a)ᶜ = insert a sᶜ

full_name: Finset.compl_insert
code: @[simp]
theorem compl_insert : (insert a s)ᶜ = sᶜ.erase a 
goal: (insert a s)ᶜ = sᶜ.erase a

full_name: Finset.insert_compl_insert
code: theorem insert_compl_insert (ha : a ∉ s) : insert a (insert a s)ᶜ = sᶜ 
goal: insert a (insert a s)ᶜ = sᶜ

full_name: Finset.insert_compl_self
code: @[simp]
theorem insert_compl_self (x : α) : insert x ({x}ᶜ : Finset α) = univ 
goal: insert x {x}ᶜ = Finset.univ

full_name: Finset.compl_filter
code: @[simp]
theorem compl_filter (p : α → Prop) [DecidablePred p] [∀ x, Decidable ¬p x] :
    (univ.filter p)ᶜ = univ.filter fun x => ¬p x 
goal: (Finset.filter p Finset.univ)ᶜ = Finset.filter (fun x => ¬p x) Finset.univ

full_name: Finset.compl_ne_univ_iff_nonempty
code: theorem compl_ne_univ_iff_nonempty (s : Finset α) : sᶜ ≠ univ ↔ s.Nonempty 
goal: sᶜ ≠ Finset.univ ↔ s.Nonempty

full_name: Finset.compl_singleton
code: theorem compl_singleton (a : α) : ({a} : Finset α)ᶜ = univ.erase a 
goal: {a}ᶜ = Finset.univ.erase a

full_name: Finset.insert_inj_on'
code: theorem insert_inj_on' (s : Finset α) : Set.InjOn (fun a => insert a s) (sᶜ : Finset α) 
goal: Set.InjOn (fun a => insert a s) ↑sᶜ

full_name: Finset.image_univ_of_surjective
code: theorem image_univ_of_surjective [Fintype β] {f : β → α} (hf : Surjective f) :
    univ.image f = univ 
goal: Finset.image f Finset.univ = Finset.univ

full_name: Finset.image_univ_equiv
code: @[simp]
theorem image_univ_equiv [Fintype β] (f : β ≃ α) : univ.image f = univ 
goal: Finset.image (⇑f) Finset.univ = Finset.univ

full_name: Finset.univ_inter
code: @[simp] lemma univ_inter (s : Finset α) : univ ∩ s = s 
goal: Finset.univ ∩ s = s

full_name: Finset.inter_univ
code: @[simp] lemma inter_univ (s : Finset α) : s ∩ univ = s 
goal: s ∩ Finset.univ = s

full_name: Finset.inter_eq_univ
code: @[simp] lemma inter_eq_univ : s ∩ t = univ ↔ s = univ ∧ t = univ 
goal: s ∩ t = Finset.univ ↔ s = Finset.univ ∧ t = Finset.univ

full_name: Finset.singleton_eq_univ
code: lemma singleton_eq_univ [Subsingleton α] (a : α) : ({a} : Finset α) = univ 
goal: {a} = Finset.univ

full_name: Finset.map_univ_of_surjective
code: theorem map_univ_of_surjective [Fintype β] {f : β ↪ α} (hf : Surjective f) : univ.map f = univ 
goal: Finset.map f Finset.univ = Finset.univ

full_name: Finset.map_univ_equiv
code: @[simp]
theorem map_univ_equiv [Fintype β] (f : β ≃ α) : univ.map f.toEmbedding = univ 
goal: Finset.map f.toEmbedding Finset.univ = Finset.univ

full_name: Finset.univ_map_equiv_to_embedding
code: theorem univ_map_equiv_to_embedding {α β : Type*} [Fintype α] [Fintype β] (e : α ≃ β) :
    univ.map e.toEmbedding = univ 
goal: Finset.map e.toEmbedding Finset.univ = Finset.univ

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

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

full_name: Finset.coe_filter_univ
code: theorem coe_filter_univ (p : α → Prop) [DecidablePred p] :
    (univ.filter p : Set α) = { x | p x } 
goal: ↑(Finset.filter p Finset.univ) = {x | p x}

full_name: Finset.subtype_eq_univ
code: @[simp] lemma subtype_eq_univ {p : α → Prop} [DecidablePred p] [Fintype {a // p a}] :
    s.subtype p = univ ↔ ∀ ⦃a⦄, p a → a ∈ s 
goal: Finset.subtype p s = Finset.univ ↔ ∀ ⦃a : α⦄, p a → a ∈ s

full_name: Finset.subtype_univ
code: @[simp] lemma subtype_univ [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
    univ.subtype p = univ 
goal: Finset.subtype p Finset.univ = Finset.univ

full_name: Finset.univ_map_subtype
code: lemma univ_map_subtype [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
    univ.map (Function.Embedding.subtype p) = univ.filter p 
goal: Finset.map (Function.Embedding.subtype p) Finset.univ = Finset.filter p Finset.univ

full_name: Finset.univ_val_map_subtype_val
code: lemma univ_val_map_subtype_val [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
    univ.val.map ((↑) : { a // p a } → α) = (univ.filter p).val 
goal: Multiset.map Subtype.val Finset.univ.val = (Finset.filter p Finset.univ).val

full_name: Finset.univ_val_map_subtype_restrict
code: lemma univ_val_map_subtype_restrict [Fintype α] (f : α → β)
    (p : α → Prop) [DecidablePred p] [Fintype {a // p a}] :
    univ.val.map (Subtype.restrict p f) = (univ.filter p).val.map f 
goal: Multiset.map (Subtype.restrict p f) Finset.univ.val = Multiset.map f (Finset.filter p Finset.univ).val

full_name: Fintype.decidablePiFintype
code: instance decidablePiFintype {α} {β : α → Type*} [∀ a, DecidableEq (β a)] [Fintype α] :
    DecidableEq (∀ a, β a) 
goal: DecidableEq ((a : α) → β a)

full_name: Fintype.decidableForallFintype
code: instance decidableForallFintype {p : α → Prop} [DecidablePred p] [Fintype α] :
    Decidable (∀ a, p a) 
goal: Decidable (∀ (a : α), p a)

full_name: Fintype.decidableExistsFintype
code: instance decidableExistsFintype {p : α → Prop} [DecidablePred p] [Fintype α] :
    Decidable (∃ a, p a) 
goal: Decidable (∃ a, p a)

full_name: Fintype.decidableMemRangeFintype
code: instance decidableMemRangeFintype [Fintype α] [DecidableEq β] (f : α → β) :
    DecidablePred (· ∈ Set.range f) 
goal: DecidablePred fun x => x ∈ Set.range f

full_name: Fintype.decidableSubsingleton
code: instance decidableSubsingleton [Fintype α] [DecidableEq α] {s : Set α} [DecidablePred (· ∈ s)] :
    Decidable s.Subsingleton 
goal: Decidable s.Subsingleton

full_name: Fintype.decidableEqEquivFintype
code: instance decidableEqEquivFintype [DecidableEq β] [Fintype α] : DecidableEq (α ≃ β) 
goal: DecidableEq (α ≃ β)

full_name: Fintype.decidableEqEmbeddingFintype
code: instance decidableEqEmbeddingFintype [DecidableEq β] [Fintype α] : DecidableEq (α ↪ β) 
goal: DecidableEq (α ↪ β)

full_name: Fintype.decidableInjectiveFintype
code: instance decidableInjectiveFintype [DecidableEq α] [DecidableEq β] [Fintype α] :
    DecidablePred (Injective : (α → β) → Prop) 
goal: DecidablePred Function.Injective

full_name: Fintype.decidableSurjectiveFintype
code: instance decidableSurjectiveFintype [DecidableEq β] [Fintype α] [Fintype β] :
    DecidablePred (Surjective : (α → β) → Prop) 
goal: DecidablePred Function.Surjective

full_name: Fintype.decidableBijectiveFintype
code: instance decidableBijectiveFintype [DecidableEq α] [DecidableEq β] [Fintype α] [Fintype β] :
    DecidablePred (Bijective : (α → β) → Prop) 
goal: DecidablePred Function.Bijective

full_name: Fintype.decidableRightInverseFintype
code: instance decidableRightInverseFintype [DecidableEq α] [Fintype α] (f : α → β) (g : β → α) :
    Decidable (Function.RightInverse f g) 
goal: Decidable (Function.RightInverse f g)

full_name: Fintype.decidableLeftInverseFintype
code: instance decidableLeftInverseFintype [DecidableEq β] [Fintype β] (f : α → β) (g : β → α) :
    Decidable (Function.LeftInverse f g) 
goal: Decidable (Function.LeftInverse f g)

full_name: Fintype.ofMultiset
code: /-- Construct a proof of `Fintype α` from a universal multiset -/
def ofMultiset [DecidableEq α] (s : Multiset α) (H : ∀ x : α, x ∈ s) : Fintype α 
goal: Fintype α

full_name: Fintype.ofList
code: /-- Construct a proof of `Fintype α` from a universal list -/
def ofList [DecidableEq α] (l : List α) (H : ∀ x : α, x ∈ l) : Fintype α 
goal: Fintype α

full_name: Fintype.subsingleton
code: instance subsingleton (α : Type*) : Subsingleton (Fintype α) 
goal: Subsingleton (Fintype α)

full_name: Fintype.instFastSubsingleton
code: instance (α : Type*) : Lean.Meta.FastSubsingleton (Fintype α) 
goal: Lean.Meta.FastSubsingleton (Fintype α)

full_name: Fintype.subtype
code: /-- Given a predicate that can be represented by a finset, the subtype
associated to the predicate is a fintype. -/
protected def subtype {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) :
    Fintype { x // p x } 
goal: Fintype { x // p x }

full_name: Fintype.ofFinset
code: /-- Construct a fintype from a finset with the same elements. -/
def ofFinset {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) : Fintype p 
goal: Fintype ↑p

full_name: Fintype.ofBijective
code: /-- If `f : α → β` is a bijection and `α` is a fintype, then `β` is also a fintype. -/
def ofBijective [Fintype α] (f : α → β) (H : Function.Bijective f) : Fintype β 
goal: Fintype β

full_name: Fintype.ofSurjective
code: /-- If `f : α → β` is a surjection and `α` is a fintype, then `β` is also a fintype. -/
def ofSurjective [DecidableEq β] [Fintype α] (f : α → β) (H : Function.Surjective f) : Fintype β 
goal: Fintype β

full_name: Finset.filter_univ_mem
code: @[simp]
lemma filter_univ_mem (s : Finset α) : univ.filter (· ∈ s) = s 
goal: Finset.filter (fun x => x ∈ s) Finset.univ = s

full_name: Finset.decidableCodisjoint
code: instance decidableCodisjoint : Decidable (Codisjoint s t) 
goal: Decidable (Codisjoint s t)

full_name: Finset.decidableIsCompl
code: instance decidableIsCompl : Decidable (IsCompl s t) 
goal: Decidable (IsCompl s t)

full_name: Function.Injective.invOfMemRange
code: /-- The inverse of an `hf : injective` function `f : α → β`, of the type `↥(Set.range f) → α`.
This is the computable version of `Function.invFun` that requires `Fintype α` and `DecidableEq β`,
or the function version of applying `(Equiv.ofInjective f hf).symm`.
This function should not usually be used for actual computation because for most cases,
an explicit inverse can be stated that has better computational properties.
This function computes by checking all terms `a : α` to find the `f a = b`, so it is O(N) where
`N = Fintype.card α`.
-/
def invOfMemRange : Set.range f → α 
goal: ↑(Set.range f) → α

full_name: Function.Injective.left_inv_of_invOfMemRange
code: theorem left_inv_of_invOfMemRange (b : Set.range f) : f (hf.invOfMemRange b) = b 
goal: f (hf.invOfMemRange b) = ↑b

full_name: Function.Injective.right_inv_of_invOfMemRange
code: @[simp]
theorem right_inv_of_invOfMemRange (a : α) : hf.invOfMemRange ⟨f a, Set.mem_range_self a⟩ = a 
goal: hf.invOfMemRange ⟨f a, ⋯⟩ = a

full_name: Function.Injective.invFun_restrict
code: theorem invFun_restrict [Nonempty α] : (Set.range f).restrict (invFun f) = hf.invOfMemRange 
goal: (Set.range f).restrict (Function.invFun f) = hf.invOfMemRange

full_name: Function.Injective.invOfMemRange_surjective
code: theorem invOfMemRange_surjective : Function.Surjective hf.invOfMemRange 
goal: Function.Surjective hf.invOfMemRange

full_name: Function.Embedding.invOfMemRange
code: /-- The inverse of an embedding `f : α ↪ β`, of the type `↥(Set.range f) → α`.
This is the computable version of `Function.invFun` that requires `Fintype α` and `DecidableEq β`,
or the function version of applying `(Equiv.ofInjective f f.injective).symm`.
This function should not usually be used for actual computation because for most cases,
an explicit inverse can be stated that has better computational properties.
This function computes by checking all terms `a : α` to find the `f a = b`, so it is O(N) where
`N = Fintype.card α`.
-/
def invOfMemRange : α 
goal: α

full_name: Function.Embedding.left_inv_of_invOfMemRange
code: @[simp]
theorem left_inv_of_invOfMemRange : f (f.invOfMemRange b) = b 
goal: f (f.invOfMemRange b) = ↑b

full_name: Function.Embedding.right_inv_of_invOfMemRange
code: @[simp]
theorem right_inv_of_invOfMemRange (a : α) : f.invOfMemRange ⟨f a, Set.mem_range_self a⟩ = a 
goal: f.invOfMemRange ⟨f a, ⋯⟩ = a

full_name: Function.Embedding.invFun_restrict
code: theorem invFun_restrict [Nonempty α] : (Set.range f).restrict (invFun f) = f.invOfMemRange 
goal: (Set.range ⇑f).restrict (Function.invFun ⇑f) = f.invOfMemRange

full_name: Function.Embedding.invOfMemRange_surjective
code: theorem invOfMemRange_surjective : Function.Surjective f.invOfMemRange 
goal: Function.Surjective f.invOfMemRange

full_name: Fintype.ofInjective
code: /-- Given an injective function to a fintype, the domain is also a
fintype. This is noncomputable because injectivity alone cannot be
used to construct preimages. -/
noncomputable def ofInjective [Fintype β] (f : α → β) (H : Function.Injective f) : Fintype α 
goal: Fintype α

full_name: Fintype.ofEquiv
code: /-- If `f : α ≃ β` and `α` is a fintype, then `β` is also a fintype. -/
def ofEquiv (α : Type*) [Fintype α] (f : α ≃ β) : Fintype β 
goal: Fintype β

full_name: Fintype.ofSubsingleton
code: /-- Any subsingleton type with a witness is a fintype (with one term). -/
def ofSubsingleton (a : α) [Subsingleton α] : Fintype α 
goal: Fintype α

full_name: Fintype.univ_ofSubsingleton
code: theorem univ_ofSubsingleton (a : α) [Subsingleton α] : @univ _ (ofSubsingleton a) = {a} 
goal: Finset.univ = {a}

full_name: Fintype.ofIsEmpty
code: /-- An empty type is a fintype. Not registered as an instance, to make sure that there aren't two
conflicting `Fintype ι` instances around when casing over whether a fintype `ι` is empty or not. -/
def ofIsEmpty [IsEmpty α] : Fintype α 
goal: Fintype α

full_name: Fintype.univ_ofIsEmpty
code: /-- Note: this lemma is specifically about `Fintype.ofIsEmpty`. For a statement about
arbitrary `Fintype` instances, use `Finset.univ_eq_empty`. -/
theorem univ_ofIsEmpty [IsEmpty α] : @univ α Fintype.ofIsEmpty = ∅ 
goal: Finset.univ = ∅

full_name: Fintype.instEmpty
code: instance : Fintype Empty 
goal: Fintype Empty

full_name: Fintype.instPEmpty
code: instance : Fintype PEmpty 
goal: Fintype PEmpty.{u_4 + 1}

full_name: Set.toFinset
code: /-- Construct a finset enumerating a set `s`, given a `Fintype` instance.  -/
def toFinset (s : Set α) [Fintype s] : Finset α 
goal: Finset α

full_name: Set.toFinset_congr
code: @[congr]
theorem toFinset_congr {s t : Set α} [Fintype s] [Fintype t] (h : s = t) :
    toFinset s = toFinset t 
goal: s.toFinset = t.toFinset

full_name: Set.mem_toFinset
code: @[simp]
theorem mem_toFinset {s : Set α} [Fintype s] {a : α} : a ∈ s.toFinset ↔ a ∈ s 
goal: a ∈ s.toFinset ↔ a ∈ s

full_name: Set.toFinset_ofFinset
code: /-- Many `Fintype` instances for sets are defined using an extensionally equal `Finset`.
Rewriting `s.toFinset` with `Set.toFinset_ofFinset` replaces the term with such a `Finset`. -/
theorem toFinset_ofFinset {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) :
    @Set.toFinset _ p (Fintype.ofFinset s H) = s 
goal: p.toFinset = s

full_name: Set.decidableMemOfFintype
code: /-- Membership of a set with a `Fintype` instance is decidable.

Using this as an instance leads to potential loops with `Subtype.fintype` under certain decidability
assumptions, so it should only be declared a local instance. -/
def decidableMemOfFintype [DecidableEq α] (s : Set α) [Fintype s] (a) : Decidable (a ∈ s) 
goal: Decidable (a ∈ s)

full_name: Set.coe_toFinset
code: @[simp]
theorem coe_toFinset (s : Set α) [Fintype s] : (↑s.toFinset : Set α) = s 
goal: ↑s.toFinset = s

full_name: Set.toFinset_nonempty
code: @[simp, aesop safe apply (rule_sets := [finsetNonempty])]
theorem toFinset_nonempty {s : Set α} [Fintype s] : s.toFinset.Nonempty ↔ s.Nonempty 
goal: s.toFinset.Nonempty ↔ s.Nonempty

full_name: Set.toFinset_inj
code: @[simp]
theorem toFinset_inj {s t : Set α} [Fintype s] [Fintype t] : s.toFinset = t.toFinset ↔ s = t 
goal: s.toFinset = t.toFinset ↔ s = t

full_name: Set.toFinset_subset_toFinset
code: @[mono]
theorem toFinset_subset_toFinset [Fintype s] [Fintype t] : s.toFinset ⊆ t.toFinset ↔ s ⊆ t 
goal: s.toFinset ⊆ t.toFinset ↔ s ⊆ t

full_name: Set.toFinset_ssubset
code: @[simp]
theorem toFinset_ssubset [Fintype s] {t : Finset α} : s.toFinset ⊂ t ↔ s ⊂ t 
goal: s.toFinset ⊂ t ↔ s ⊂ ↑t

full_name: Set.subset_toFinset
code: @[simp]
theorem subset_toFinset {s : Finset α} [Fintype t] : s ⊆ t.toFinset ↔ ↑s ⊆ t 
goal: s ⊆ t.toFinset ↔ ↑s ⊆ t

full_name: Set.ssubset_toFinset
code: @[simp]
theorem ssubset_toFinset {s : Finset α} [Fintype t] : s ⊂ t.toFinset ↔ ↑s ⊂ t 
goal: s ⊂ t.toFinset ↔ ↑s ⊂ t

full_name: Set.toFinset_ssubset_toFinset
code: @[mono]
theorem toFinset_ssubset_toFinset [Fintype s] [Fintype t] : s.toFinset ⊂ t.toFinset ↔ s ⊂ t 
goal: s.toFinset ⊂ t.toFinset ↔ s ⊂ t

full_name: Set.toFinset_subset
code: @[simp]
theorem toFinset_subset [Fintype s] {t : Finset α} : s.toFinset ⊆ t ↔ s ⊆ t 
goal: s.toFinset ⊆ t ↔ s ⊆ ↑t

full_name: Set.disjoint_toFinset
code: @[simp]
theorem disjoint_toFinset [Fintype s] [Fintype t] :
    Disjoint s.toFinset t.toFinset ↔ Disjoint s t 
goal: Disjoint s.toFinset t.toFinset ↔ Disjoint s t

full_name: Set.toFinset_inter
code: @[simp]
theorem toFinset_inter [Fintype (s ∩ t : Set _)] : (s ∩ t).toFinset = s.toFinset ∩ t.toFinset 
goal: (s ∩ t).toFinset = s.toFinset ∩ t.toFinset

full_name: Set.toFinset_union
code: @[simp]
theorem toFinset_union [Fintype (s ∪ t : Set _)] : (s ∪ t).toFinset = s.toFinset ∪ t.toFinset 
goal: (s ∪ t).toFinset = s.toFinset ∪ t.toFinset

full_name: Set.toFinset_diff
code: @[simp]
theorem toFinset_diff [Fintype (s \ t : Set _)] : (s \ t).toFinset = s.toFinset \ t.toFinset 
goal: (s \ t).toFinset = s.toFinset \ t.toFinset

full_name: Set.toFinset_symmDiff
code: @[simp]
theorem toFinset_symmDiff [Fintype (s ∆ t : Set _)] :
    (s ∆ t).toFinset = s.toFinset ∆ t.toFinset 
goal: (symmDiff s t).toFinset = symmDiff s.toFinset t.toFinset

full_name: Set.toFinset_compl
code: @[simp]
theorem toFinset_compl [Fintype α] [Fintype (sᶜ : Set _)] : sᶜ.toFinset = s.toFinsetᶜ 
goal: sᶜ.toFinset = s.toFinsetᶜ

full_name: Set.toFinset_empty
code: @[simp]
theorem toFinset_empty [Fintype (∅ : Set α)] : (∅ : Set α).toFinset = ∅ 
goal: ∅.toFinset = ∅

full_name: Set.toFinset_univ
code: @[simp]
theorem toFinset_univ [Fintype α] [Fintype (Set.univ : Set α)] :
    (Set.univ : Set α).toFinset = Finset.univ 
goal: Set.univ.toFinset = Finset.univ

full_name: Set.toFinset_eq_empty
code: @[simp]
theorem toFinset_eq_empty [Fintype s] : s.toFinset = ∅ ↔ s = ∅ 
goal: s.toFinset = ∅ ↔ s = ∅

full_name: Set.toFinset_eq_univ
code: @[simp]
theorem toFinset_eq_univ [Fintype α] [Fintype s] : s.toFinset = Finset.univ ↔ s = univ 
goal: s.toFinset = Finset.univ ↔ s = Set.univ

full_name: Set.toFinset_setOf
code: @[simp]
theorem toFinset_setOf [Fintype α] (p : α → Prop) [DecidablePred p] [Fintype { x | p x }] :
    { x | p x }.toFinset = Finset.univ.filter p 
goal: {x | p x}.toFinset = Finset.filter p Finset.univ

full_name: Set.toFinset_ssubset_univ
code: theorem toFinset_ssubset_univ [Fintype α] {s : Set α} [Fintype s] :
    s.toFinset ⊂ Finset.univ ↔ s ⊂ univ 
goal: s.toFinset ⊂ Finset.univ ↔ s ⊂ Set.univ

full_name: Set.toFinset_image
code: @[simp]
theorem toFinset_image [DecidableEq β] (f : α → β) (s : Set α) [Fintype s] [Fintype (f '' s)] :
    (f '' s).toFinset = s.toFinset.image f 
goal: (f '' s).toFinset = Finset.image f s.toFinset

full_name: Set.toFinset_range
code: @[simp]
theorem toFinset_range [DecidableEq α] [Fintype β] (f : β → α) [Fintype (Set.range f)] :
    (Set.range f).toFinset = Finset.univ.image f 
goal: (Set.range f).toFinset = Finset.image f Finset.univ

full_name: Set.toFinset_singleton
code: @[simp] -- Porting note: new attribute
theorem toFinset_singleton (a : α) [Fintype ({a} : Set α)] : ({a} : Set α).toFinset = {a} 
goal: {a}.toFinset = {a}

full_name: Set.toFinset_insert
code: @[simp]
theorem toFinset_insert [DecidableEq α] {a : α} {s : Set α} [Fintype (insert a s : Set α)]
    [Fintype s] : (insert a s).toFinset = insert a s.toFinset 
goal: (insert a s).toFinset = insert a s.toFinset

full_name: Set.filter_mem_univ_eq_toFinset
code: theorem filter_mem_univ_eq_toFinset [Fintype α] (s : Set α) [Fintype s] [DecidablePred (· ∈ s)] :
    Finset.univ.filter (· ∈ s) = s.toFinset 
goal: Finset.filter (fun x => x ∈ s) Finset.univ = s.toFinset

full_name: Finset.toFinset_coe
code: @[simp]
theorem Finset.toFinset_coe (s : Finset α) [Fintype (s : Set α)] : (s : Set α).toFinset = s 
goal: (↑s).toFinset = s

full_name: Fin.fintype
code: instance Fin.fintype (n : ℕ) : Fintype (Fin n) 
goal: Fintype (Fin n)

full_name: Fin.univ_def
code: theorem Fin.univ_def (n : ℕ) : (univ : Finset (Fin n)) = ⟨List.finRange n, List.nodup_finRange n⟩ 
goal: Finset.univ = { val := ↑(List.finRange n), nodup := ⋯ }

full_name: List.toFinset_finRange
code: @[simp] theorem List.toFinset_finRange (n : ℕ) : (List.finRange n).toFinset = Finset.univ 
goal: (List.finRange n).toFinset = Finset.univ

full_name: Fin.univ_val_map
code: @[simp] theorem Fin.univ_val_map {n : ℕ} (f : Fin n → α) :
    Finset.univ.val.map f = List.ofFn f 
goal: Multiset.map f Finset.univ.val = ↑(List.ofFn f)

full_name: Fin.univ_image_def
code: theorem Fin.univ_image_def {n : ℕ} [DecidableEq α] (f : Fin n → α) :
    Finset.univ.image f = (List.ofFn f).toFinset 
goal: Finset.image f Finset.univ = (List.ofFn f).toFinset

full_name: Fin.univ_map_def
code: theorem Fin.univ_map_def {n : ℕ} (f : Fin n ↪ α) :
    Finset.univ.map f = ⟨List.ofFn f, List.nodup_ofFn.mpr f.injective⟩ 
goal: Finset.map f Finset.univ = { val := ↑(List.ofFn ⇑f), nodup := ⋯ }

full_name: Fin.image_succAbove_univ
code: @[simp]
theorem Fin.image_succAbove_univ {n : ℕ} (i : Fin (n + 1)) : univ.image i.succAbove = {i}ᶜ 
goal: Finset.image i.succAbove Finset.univ = {i}ᶜ

full_name: Fin.image_succ_univ
code: @[simp]
theorem Fin.image_succ_univ (n : ℕ) : (univ : Finset (Fin n)).image Fin.succ = {0}ᶜ 
goal: Finset.image Fin.succ Finset.univ = {0}ᶜ

full_name: Fin.image_castSucc
code: @[simp]
theorem Fin.image_castSucc (n : ℕ) :
    (univ : Finset (Fin n)).image Fin.castSucc = {Fin.last n}ᶜ 
goal: Finset.image Fin.castSucc Finset.univ = {Fin.last n}ᶜ

full_name: Fin.univ_succ
code: /-- Embed `Fin n` into `Fin (n + 1)` by prepending zero to the `univ` -/
theorem Fin.univ_succ (n : ℕ) :
    (univ : Finset (Fin (n + 1))) =
      Finset.cons 0 (univ.map ⟨Fin.succ, Fin.succ_injective _⟩) (by simp [map_eq_image]) 
goal: Finset.univ = Finset.cons 0 (Finset.map { toFun := Fin.succ, inj' := ⋯ } Finset.univ) ⋯

full_name: Fin.univ_castSuccEmb
code: /-- Embed `Fin n` into `Fin (n + 1)` by appending a new `Fin.last n` to the `univ` -/
theorem Fin.univ_castSuccEmb (n : ℕ) :
    (univ : Finset (Fin (n + 1))) =
      Finset.cons (Fin.last n) (univ.map Fin.castSuccEmb) (by simp [map_eq_image]) 
goal: Finset.univ = Finset.cons (Fin.last n) (Finset.map Fin.castSuccEmb Finset.univ) ⋯

full_name: Fin.univ_succAbove
code: /-- Embed `Fin n` into `Fin (n + 1)` by inserting
around a specified pivot `p : Fin (n + 1)` into the `univ` -/
theorem Fin.univ_succAbove (n : ℕ) (p : Fin (n + 1)) :
    (univ : Finset (Fin (n + 1))) = Finset.cons p (univ.map <| Fin.succAboveEmb p) (by simp) 
goal: Finset.univ = Finset.cons p (Finset.map p.succAboveEmb Finset.univ) ⋯

full_name: Fin.univ_image_get
code: @[simp] theorem Fin.univ_image_get [DecidableEq α] (l : List α) :
    Finset.univ.image l.get = l.toFinset 
goal: Finset.image l.get Finset.univ = l.toFinset

full_name: Fin.univ_image_getElem'
code: @[simp] theorem Fin.univ_image_getElem' [DecidableEq β] (l : List α) (f : α → β) :
    Finset.univ.image (fun i : Fin l.length => f <| l[(i : Nat)]) = (l.map f).toFinset 
goal: Finset.image (fun i => f l[↑i]) Finset.univ = (List.map f l).toFinset

full_name: Fin.univ_image_get'
code: theorem Fin.univ_image_get' [DecidableEq β] (l : List α) (f : α → β) :
    Finset.univ.image (f <| l.get ·) = (l.map f).toFinset 
goal: Finset.image (fun x => f (l.get x)) Finset.univ = (List.map f l).toFinset

full_name: Unique.fintype
code: @[instance]
def Unique.fintype {α : Type*} [Unique α] : Fintype α 
goal: Fintype α

full_name: Fintype.subtypeEq
code: /-- Short-circuit instance to decrease search for `Unique.fintype`,
since that relies on a subsingleton elimination for `Unique`. -/
instance Fintype.subtypeEq (y : α) : Fintype { x // x = y } 
goal: Fintype { x // x = y }

full_name: Fintype.subtypeEq'
code: /-- Short-circuit instance to decrease search for `Unique.fintype`,
since that relies on a subsingleton elimination for `Unique`. -/
instance Fintype.subtypeEq' (y : α) : Fintype { x // y = x } 
goal: Fintype { x // y = x }

full_name: Fintype.univ_empty
code: theorem Fintype.univ_empty : @univ Empty _ = ∅ 
goal: Finset.univ = ∅

full_name: Fintype.univ_pempty
code: theorem Fintype.univ_pempty : @univ PEmpty _ = ∅ 
goal: Finset.univ = ∅

full_name: Unit.fintype
code: instance Unit.fintype : Fintype Unit 
goal: Fintype Unit

full_name: Fintype.univ_unit
code: theorem Fintype.univ_unit : @univ Unit _ = {()} 
goal: Finset.univ = {()}

full_name: PUnit.fintype
code: instance PUnit.fintype : Fintype PUnit 
goal: Fintype PUnit.{u_4 + 1}

full_name: Fintype.univ_punit
code: theorem Fintype.univ_punit : @univ PUnit _ = {PUnit.unit} 
goal: Finset.univ = {PUnit.unit}

full_name: Bool.fintype
code: instance Bool.fintype : Fintype Bool 
goal: Fintype Bool

full_name: Fintype.univ_bool
code: @[simp]
theorem Fintype.univ_bool : @univ Bool _ = {true, false} 
goal: Finset.univ = {true, false}

full_name: Additive.fintype
code: instance Additive.fintype : ∀ [Fintype α], Fintype (Additive α) 
goal: Fintype (Additive α)

full_name: Multiplicative.fintype
code: instance Multiplicative.fintype : ∀ [Fintype α], Fintype (Multiplicative α) 
goal: Fintype (Multiplicative α)

full_name: Fintype.prodLeft
code: /-- Given that `α × β` is a fintype, `α` is also a fintype. -/
def Fintype.prodLeft {α β} [DecidableEq α] [Fintype (α × β)] [Nonempty β] : Fintype α 
goal: Fintype α

full_name: Fintype.prodRight
code: /-- Given that `α × β` is a fintype, `β` is also a fintype. -/
def Fintype.prodRight {α β} [DecidableEq β] [Fintype (α × β)] [Nonempty α] : Fintype β 
goal: Fintype β

full_name: ULift.fintype
code: instance ULift.fintype (α : Type*) [Fintype α] : Fintype (ULift α) 
goal: Fintype (ULift.{u_5, u_4} α)

full_name: PLift.fintype
code: instance PLift.fintype (α : Type*) [Fintype α] : Fintype (PLift α) 
goal: Fintype (PLift α)

full_name: OrderDual.fintype
code: instance OrderDual.fintype (α : Type*) [Fintype α] : Fintype αᵒᵈ 
goal: Fintype αᵒᵈ

full_name: OrderDual.finite
code: instance OrderDual.finite (α : Type*) [Finite α] : Finite αᵒᵈ 
goal: Finite αᵒᵈ

full_name: Lex.fintype
code: instance Lex.fintype (α : Type*) [Fintype α] : Fintype (Lex α) 
goal: Fintype (Lex α)

full_name: Finset.fintypeCoeSort
code: instance Finset.fintypeCoeSort {α : Type u} (s : Finset α) : Fintype s 
goal: Fintype { x // x ∈ s }

full_name: Finset.univ_eq_attach
code: @[simp]
theorem Finset.univ_eq_attach {α : Type u} (s : Finset α) : (univ : Finset s) = s.attach 
goal: Finset.univ = s.attach

full_name: Fintype.coe_image_univ
code: theorem Fintype.coe_image_univ [Fintype α] [DecidableEq β] {f : α → β} :
    ↑(Finset.image f Finset.univ) = Set.range f 
goal: ↑(Finset.image f Finset.univ) = Set.range f

full_name: List.Subtype.fintype
code: instance List.Subtype.fintype [DecidableEq α] (l : List α) : Fintype { x // x ∈ l } 
goal: Fintype { x // x ∈ l }

full_name: Multiset.Subtype.fintype
code: instance Multiset.Subtype.fintype [DecidableEq α] (s : Multiset α) : Fintype { x // x ∈ s } 
goal: Fintype { x // x ∈ s }

full_name: Finset.Subtype.fintype
code: instance Finset.Subtype.fintype (s : Finset α) : Fintype { x // x ∈ s } 
goal: Fintype { x // x ∈ s }

full_name: FinsetCoe.fintype
code: instance FinsetCoe.fintype (s : Finset α) : Fintype (↑s : Set α) 
goal: Fintype ↑↑s

full_name: Finset.attach_eq_univ
code: theorem Finset.attach_eq_univ {s : Finset α} : s.attach = Finset.univ 
goal: s.attach = Finset.univ

full_name: PLift.fintypeProp
code: instance PLift.fintypeProp (p : Prop) [Decidable p] : Fintype (PLift p) 
goal: Fintype (PLift p)

full_name: Prop.fintype
code: instance Prop.fintype : Fintype Prop 
goal: Fintype Prop

full_name: Fintype.univ_Prop
code: @[simp]
theorem Fintype.univ_Prop : (Finset.univ : Finset Prop) = {True, False} 
goal: Finset.univ = {True, False}

full_name: Subtype.fintype
code: instance Subtype.fintype (p : α → Prop) [DecidablePred p] [Fintype α] : Fintype { x // p x } 
goal: Fintype { x // p x }

full_name: setFintype
code: /-- A set on a fintype, when coerced to a type, is a fintype. -/
def setFintype [Fintype α] (s : Set α) [DecidablePred (· ∈ s)] : Fintype s 
goal: Fintype ↑s

full_name: Fintype.finsetEquivSet
code: /-- Given `Fintype α`, `finsetEquivSet` is the equiv between `Finset α` and `Set α`. (All
sets on a finite type are finite.) -/
noncomputable def finsetEquivSet : Finset α ≃ Set α 
goal: Finset α ≃ Set α

full_name: Fintype.coe_finsetEquivSet
code: @[simp, norm_cast] lemma coe_finsetEquivSet : ⇑finsetEquivSet = ((↑) : Finset α → Set α) 
goal: ⇑Fintype.finsetEquivSet = Finset.toSet

full_name: Fintype.finsetEquivSet_apply
code: @[simp] lemma finsetEquivSet_apply (s : Finset α) : finsetEquivSet s = s 
goal: Fintype.finsetEquivSet s = ↑s

full_name: Fintype.finsetEquivSet_symm_apply
code: @[simp] lemma finsetEquivSet_symm_apply (s : Set α) [Fintype s] :
    finsetEquivSet.symm s = s.toFinset 
goal: Fintype.finsetEquivSet.symm s = s.toFinset

full_name: Fintype.finsetOrderIsoSet
code: /-- Given a fintype `α`, `finsetOrderIsoSet` is the order isomorphism between `Finset α` and `Set α`
(all sets on a finite type are finite). -/
@[simps toEquiv]
noncomputable def finsetOrderIsoSet : Finset α ≃o Set α 
goal: Finset α ≃o Set α

full_name: Fintype.finsetOrderIsoSet_toEquiv
code: /-- Given a fintype `α`, `finsetOrderIsoSet` is the order isomorphism between `Finset α` and `Set α`
(all sets on a finite type are finite). -/
@[simps toEquiv]
noncomputable def finsetOrderIsoSet : Finset α ≃o Set α 
goal: Fintype.finsetOrderIsoSet.toEquiv = Fintype.finsetEquivSet

full_name: Fintype.coe_finsetOrderIsoSet
code: @[simp, norm_cast]
lemma coe_finsetOrderIsoSet : ⇑finsetOrderIsoSet = ((↑) : Finset α → Set α) 
goal: ⇑Fintype.finsetOrderIsoSet = Finset.toSet

full_name: Fintype.coe_finsetOrderIsoSet_symm
code: @[simp] lemma coe_finsetOrderIsoSet_symm :
    ⇑(finsetOrderIsoSet : Finset α ≃o Set α).symm = ⇑finsetEquivSet.symm 
goal: ⇑Fintype.finsetOrderIsoSet.symm = ⇑Fintype.finsetEquivSet.symm

full_name: Quotient.fintype
code: instance Quotient.fintype [Fintype α] (s : Setoid α) [DecidableRel ((· ≈ ·) : α → α → Prop)] :
    Fintype (Quotient s) 
goal: Fintype (Quotient s)

full_name: PSigma.fintypePropLeft
code: instance PSigma.fintypePropLeft {α : Prop} {β : α → Type*} [Decidable α] [∀ a, Fintype (β a)] :
    Fintype (Σ'a, β a) 
goal: Fintype ((a : α) ×' β a)

full_name: PSigma.fintypePropRight
code: instance PSigma.fintypePropRight {α : Type*} {β : α → Prop} [∀ a, Decidable (β a)] [Fintype α] :
    Fintype (Σ'a, β a) 
goal: Fintype ((a : α) ×' β a)

full_name: PSigma.fintypePropProp
code: instance PSigma.fintypePropProp {α : Prop} {β : α → Prop} [Decidable α] [∀ a, Decidable (β a)] :
    Fintype (Σ'a, β a) 
goal: Fintype ((a : α) ×' β a)

full_name: pfunFintype
code: instance pfunFintype (p : Prop) [Decidable p] (α : p → Type*) [∀ hp, Fintype (α hp)] :
    Fintype (∀ hp : p, α hp) 
goal: Fintype ((hp : p) → α hp)

full_name: mem_image_univ_iff_mem_range
code: theorem mem_image_univ_iff_mem_range {α β : Type*} [Fintype α] [DecidableEq β] {f : α → β}
    {b : β} : b ∈ univ.image f ↔ b ∈ Set.range f 
goal: b ∈ Finset.image f Finset.univ ↔ b ∈ Set.range f

full_name: Fintype.chooseX
code: /-- Given a fintype `α` and a predicate `p`, associate to a proof that there is a unique element of
`α` satisfying `p` this unique element, as an element of the corresponding subtype. -/
def chooseX (hp : ∃! a : α, p a) : { a // p a } 
goal: { a // p a }

full_name: Fintype.choose
code: /-- Given a fintype `α` and a predicate `p`, associate to a proof that there is a unique element of
`α` satisfying `p` this unique element, as an element of `α`. -/
def choose (hp : ∃! a, p a) : α 
goal: α

full_name: Fintype.choose_spec
code: theorem choose_spec (hp : ∃! a, p a) : p (choose p hp) 
goal: p (Fintype.choose p hp)

full_name: Fintype.choose_subtype_eq
code: theorem choose_subtype_eq {α : Type*} (p : α → Prop) [Fintype { a : α // p a }] [DecidableEq α]
    (x : { a : α // p a })
    (h : ∃! a : { a // p a }, (a : α) = x :=
      ⟨x, rfl, fun y hy => by simpa [Subtype.ext_iff] using hy⟩) :
    Fintype.choose (fun y : { a : α // p a } => (y : α) = x) h = x 
goal: Fintype.choose (fun y => ↑y = ↑x) h = x

full_name: Fintype.bijInv
code: /-- `bijInv f` is the unique inverse to a bijection `f`. This acts
  as a computable alternative to `Function.invFun`. -/
def bijInv (f_bij : Bijective f) (b : β) : α 
goal: α

full_name: Fintype.leftInverse_bijInv
code: theorem leftInverse_bijInv (f_bij : Bijective f) : LeftInverse (bijInv f_bij) f 
goal: Function.LeftInverse (Fintype.bijInv f_bij) f

full_name: Fintype.rightInverse_bijInv
code: theorem rightInverse_bijInv (f_bij : Bijective f) : RightInverse (bijInv f_bij) f 
goal: Function.RightInverse (Fintype.bijInv f_bij) f

full_name: Fintype.bijective_bijInv
code: theorem bijective_bijInv (f_bij : Bijective f) : Bijective (bijInv f_bij) 
goal: Function.Bijective (Fintype.bijInv f_bij)

full_name: truncOfMultisetExistsMem
code: /-- For `s : Multiset α`, we can lift the existential statement that `∃ x, x ∈ s` to a `Trunc α`.
-/
def truncOfMultisetExistsMem {α} (s : Multiset α) : (∃ x, x ∈ s) → Trunc α 
goal: (∃ x, x ∈ s) → Trunc α

full_name: truncOfNonemptyFintype
code: /-- A `Nonempty` `Fintype` constructively contains an element.
-/
def truncOfNonemptyFintype (α) [Nonempty α] [Fintype α] : Trunc α 
goal: Trunc α

full_name: truncSigmaOfExists
code: /-- By iterating over the elements of a fintype, we can lift an existential statement `∃ a, P a`
to `Trunc (Σ' a, P a)`, containing data.
-/
def truncSigmaOfExists {α} [Fintype α] {P : α → Prop} [DecidablePred P] (h : ∃ a, P a) :
    Trunc (Σ'a, P a) 
goal: Trunc ((a : α) ×' P a)

full_name: Multiset.count_univ
code: @[simp]
theorem count_univ [DecidableEq α] (a : α) : count a Finset.univ.val = 1 
goal: Multiset.count a Finset.univ.val = 1

full_name: Multiset.map_univ_val_equiv
code: @[simp]
theorem map_univ_val_equiv (e : α ≃ β) :
    map e univ.val = univ.val 
goal: Multiset.map (⇑e) Finset.univ.val = Finset.univ.val

full_name: Multiset.bijective_iff_map_univ_eq_univ
code: /-- For functions on finite sets, they are bijections iff they map universes into universes. -/
@[simp]
theorem bijective_iff_map_univ_eq_univ (f : α → β) :
    f.Bijective ↔ map f (Finset.univ : Finset α).val = univ.val 
goal: Function.Bijective f ↔ Multiset.map f Finset.univ.val = Finset.univ.val

full_name: seqOfForallFinsetExistsAux
code: /-- Auxiliary definition to show `exists_seq_of_forall_finset_exists`. -/
noncomputable def seqOfForallFinsetExistsAux {α : Type*} [DecidableEq α] (P : α → Prop)
    (r : α → α → Prop) (h : ∀ s : Finset α, ∃ y, (∀ x ∈ s, P x) → P y ∧ ∀ x ∈ s, r x y) : ℕ → α
  
goal: ℕ → α

full_name: exists_seq_of_forall_finset_exists
code: /-- Induction principle to build a sequence, by adding one point at a time satisfying a given
relation with respect to all the previously chosen points.

More precisely, Assume that, for any finite set `s`, one can find another point satisfying
some relation `r` with respect to all the points in `s`. Then one may construct a
function `f : ℕ → α` such that `r (f m) (f n)` holds whenever `m < n`.
We also ensure that all constructed points satisfy a given predicate `P`. -/
theorem exists_seq_of_forall_finset_exists {α : Type*} (P : α → Prop) (r : α → α → Prop)
    (h : ∀ s : Finset α, (∀ x ∈ s, P x) → ∃ y, P y ∧ ∀ x ∈ s, r x y) :
    ∃ f : ℕ → α, (∀ n, P (f n)) ∧ ∀ m n, m < n → r (f m) (f n) 
goal: ∃ f, (∀ (n : ℕ), P (f n)) ∧ ∀ (m n : ℕ), m < n → r (f m) (f n)

full_name: exists_seq_of_forall_finset_exists'
code: /-- Induction principle to build a sequence, by adding one point at a time satisfying a given
symmetric relation with respect to all the previously chosen points.

More precisely, Assume that, for any finite set `s`, one can find another point satisfying
some relation `r` with respect to all the points in `s`. Then one may construct a
function `f : ℕ → α` such that `r (f m) (f n)` holds whenever `m ≠ n`.
We also ensure that all constructed points satisfy a given predicate `P`. -/
theorem exists_seq_of_forall_finset_exists' {α : Type*} (P : α → Prop) (r : α → α → Prop)
    [IsSymm α r] (h : ∀ s : Finset α, (∀ x ∈ s, P x) → ∃ y, P y ∧ ∀ x ∈ s, r x y) :
    ∃ f : ℕ → α, (∀ n, P (f n)) ∧ Pairwise fun m n => r (f m) (f n) 
goal: ∃ f, (∀ (n : ℕ), P (f n)) ∧ Pairwise fun m n => r (f m) (f n)

full_name: _aux_Mathlib_Data_Fintype_Basic___elabRules_finsetStx_1
code: /-- `finset% t` elaborates `t` as a `Finset`.
If `t` is a `Set`, then inserts `Set.toFinset`.
Does not make use of the expected type; useful for big operators over finsets.
```
#check finset% Finset.range 2 -- Finset Nat
#check finset% (Set.univ : Set Bool) -- Finset Bool
```
-/
elab (name := finsetStx) "finset% " t:term : term => do
  let u ← mkFreshLevelMVar
  let ty ← mkFreshExprMVar (mkSort (.succ u))
  let x ← Elab.Term.elabTerm t (mkApp (.const ``Finset [u]) ty)
  let xty ← whnfR (← inferType x)
  if xty.isAppOfArity ``Set 1 then
    Elab.Term.elabAppArgs (.const ``Set.toFinset [u]) #[] #[.expr x] none false false
  else
    return x
goal: Lean.Elab.Term.TermElab

full_name: finsetStx
code: /-- `finset% t` elaborates `t` as a `Finset`.
If `t` is a `Set`, then inserts `Set.toFinset`.
Does not make use of the expected type; useful for big operators over finsets.
```
#check finset% Finset.range 2 -- Finset Nat
#check finset% (Set.univ : Set Bool) -- Finset Bool
```
-/
elab (name := finsetStx) "finset% " t:term : term => do
  let u ← mkFreshLevelMVar
  let ty ← mkFreshExprMVar (mkSort (.succ u))
  let x ← Elab.Term.elabTerm t (mkApp (.const ``Finset [u]) ty)
  let xty ← whnfR (← inferType x)
  if xty.isAppOfArity ``Set 1 then
    Elab.Term.elabAppArgs (.const ``Set.toFinset [u]) #[] #[.expr x] none false false
  else
    return x
goal: Lean.ParserDescr

full_name: precheckFinsetStx
code: /-- `quot_precheck` for the `finset%` syntax. -/
@[quot_precheck finsetStx] def precheckFinsetStx : Precheck
  
goal: Lean.Elab.Term.Quotation.Precheck