Last active
November 14, 2021 15:12
-
-
Save EarlGray/14172ee8a763e35da845760ecf10af0c to your computer and use it in GitHub Desktop.
Proving X ∪ Y ∪ Z ∩ X ∪ Y ∩ (X \ Z) = X ∪ Y in Coq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import Coq.Sets.Ensembles. | |
Require Import Coq.Sets.Powerset_facts. | |
Require Import Coq.Setoids.Setoid. | |
Section SetExample. | |
Variable U: Type. | |
Definition USet := Ensemble U. | |
Notation "X ∩ Y" := (Intersection U X Y) (at level 41). | |
Notation "X ∪ Y" := (Union U X Y) (at level 42). | |
Notation "X \ Y" := (Setminus U X Y) (at level 40). | |
Lemma Union_elimination: | |
forall (X Y: USet), X ∪ (X ∩ Y) = X. | |
Proof. | |
intros. | |
apply Union_absorbs. | |
apply Intersection_decreases_l. | |
Qed. | |
Example ex1: forall (X Y Z: USet), | |
X ∪ Y ∪ Z ∩ X ∪ Y ∩ (X \ Z) = X ∪ Y. | |
Proof. | |
intros. | |
rewrite (Union_commutative U X Y). | |
rewrite (Union_associative U Y X (Z ∩ X)). | |
rewrite (Intersection_commutative U Z X). | |
rewrite Union_elimination. | |
rewrite (Union_commutative U Y X). | |
rewrite Union_associative. | |
rewrite Union_elimination. | |
reflexivity. | |
Qed. | |
End SetExample. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment