2

I´m having trouble proving that two sets have the same cardinality. All the following sets are finite.

First let´s assume we have set (M::b set) and a function foo :: "b set ⇒ b set ⇒ bool"
such that (foo A C = foo B C ⟷ A = B) and for every A in M there is in fact a C, such that foo A C.

I´m trying to show that card {S. ∃A∈M. (S = {C. foo A C}) } = card M. The informal proof for this is obvious, but I can´t seem to find an efficient proof in Isabelle; neither for the ≤ nor the ≥ part.

RichiePoor
  • 53
  • 2

1 Answers1

3

Okay so the first step is that you should write this set comprehension {S. ∃A∈M. (S = {C. foo A C}) } in a more convenient way. A first step would be {{C. foo A C} |A. A ∈ M}, but I would suggest using the ‘set image’ operator:

lemma "{S. ∃A∈M. (S = {C. foo A C})} = (λA. {C. foo A C}) ` M" by blast

Then you can simply use the fact that (λA. {C. foo A C}) is injective and the rule card_image, which says that the cardinality of the image of a set under an injective function is the same as that of the original set:

lemma
  assumes "⋀A B C. A ∈ M ⟹ B ∈ M ⟹ foo A C = foo B C ⟷ A = B"
  shows   "card {S. ∃A∈M. (S = {C. foo A C})} = card M"
proof -
  have "{S. ∃A∈M. (S = {C. foo A C})} = (λA. {C. foo A C}) ` M"
    by blast
  also have "inj_on (λA. {C. foo A C}) M"
    using assms by (auto simp: inj_on_def)
  hence "card ((λA. {C. foo A C}) ` M) = card M"
    by (rule card_image)
  finally show ?thesis .
qed
Manuel Eberl
  • 7,858
  • 15
  • 24