Skip to content

Commit

Permalink
chore(data/fintype/basic): add card_unique and a warning note to `c…
Browse files Browse the repository at this point in the history
…ard_of_subsingleton` (#7008)
  • Loading branch information
eric-wieser committed Apr 6, 2021
1 parent 975f533 commit 4192612
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/data/fintype/basic.lean
Expand Up @@ -375,9 +375,16 @@ def of_subsingleton (a : α) [subsingleton α] : fintype α :=
@[simp] theorem univ_of_subsingleton (a : α) [subsingleton α] :
@univ _ (of_subsingleton a) = {a} := rfl

/-- Note: this lemma is specifically about `fintype.of_subsingleton`. For a statement about
arbitrary `fintype` instances, use either `fintype.card_le_one_iff_subsingleton` or
`fintype.card_unique`. -/
@[simp] theorem card_of_subsingleton (a : α) [subsingleton α] :
@fintype.card _ (of_subsingleton a) = 1 := rfl

@[simp] theorem card_unique [unique α] [h : fintype α] :
fintype.card α = 1 :=
subsingleton.elim (of_subsingleton $ default α) h ▸ card_of_subsingleton _

open_locale classical
variables (α)

Expand Down

0 comments on commit 4192612

Please sign in to comment.