Created
September 21, 2018 18:35
-
-
Save palmskog/6ca495b89d5f3bb9fb60b6403eff7544 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 List. | |
Import ListNotations. | |
Section dedup. | |
Variable A : Type. | |
Hypothesis A_eq_dec : forall x y : A, {x = y} + {x <> y}. | |
Fixpoint dedup (xs : list A) : list A := | |
match xs with | |
| [] => [] | |
| x :: xs => let tail := dedup xs in | |
if in_dec A_eq_dec x xs then | |
tail | |
else | |
x :: tail | |
end. | |
Lemma dedup_In : forall (x : A) xs, | |
In x xs -> | |
In x (dedup xs). | |
Proof using. | |
induction xs; intros; simpl in *. | |
- intuition. | |
- case in_dec; intuition; subst; simpl; auto. | |
Qed. | |
End dedup. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment