Zulip Chat Archive

Stream: Is there code for X?

Topic: Cardinality of a concrete set


Janitha (Mar 04 2025 at 17:52):

How do I prove

{13, 17, 35, 45, 63, 65, 85, 91, 15, 21, 39, 51}.ncard = 12

?

Yaël Dillies (Mar 04 2025 at 17:58):

That would be a good job for a simproc. Unfortunately for you, no one has written that one yet :smile:

Yakov Pechersky (Mar 04 2025 at 18:00):

import Mathlib

example : Set.ncard {13, 17, 35, 45, 63, 65, 85, 91, 15, 21, 39, 51} = 12 := by
  convert Set.ncard_eq_toFinset_card _ _
  · simp
  · repeat first | apply Set.Finite.insert | simp

Bhavik Mehta (Mar 04 2025 at 18:07):

import Mathlib

example : Set.ncard {13, 17, 35, 45, 63, 65, 85, 91, 15, 21, 39, 51} = 12 := by
  rw [Set.ncard_eq_toFinset_card']
  rfl

Bhavik Mehta (Mar 04 2025 at 18:07):

or even more simply,

import Mathlib

example : Set.ncard {13, 17, 35, 45, 63, 65, 85, 91, 15, 21, 39, 51} = 12 := by
  simp [Set.ncard_eq_toFinset_card']

since simp already has all the pieces to do this

Janitha (Mar 04 2025 at 19:02):

Thank you!


Last updated: May 02 2025 at 03:31 UTC