proposition: Lemma cardinal_ternary_union A B C : # (A ∪ B ∪ C) = # A + # B + # C - # (A ∩ B) - #(B ∩ C) - # (C ∩ A) + #(A ∩ B ∩ C).
proof: Proof. rewrite cardinal_binary_union. Rewrite ((A ∪ B) ∩ C == (A ∩ C) ∪ (B ∩ C)). rewrite cardinal_binary_union. rewrite cardinal_binary_union. Rewrite ((A ∩ C) ∩ (B ∩ C) == (A ∩ B) ∩ C). Rewrite (C ∩ A == A ∩ C). ring. Qed.
imports: Lists.List ZArith Setoid Coq.Classes.Morphisms Lia