Simplification in proof of append_union

This commit is contained in:
Niels van der Weide 2017-09-28 14:45:54 +02:00
parent 72a44c71f9
commit 38a64bae76
1 changed files with 22 additions and 8 deletions

View File

@ -77,17 +77,31 @@ Section ListToSet.
nr {|a|}.
Lemma append_union (l1 l2 : list A) :
list_to_set A (union l1 l2) = (list_to_set A l1) (list_to_set A l2).
list_to_set A (list_union _ l1 l2) = (list_to_set A l1) (list_to_set A l2).
Proof.
induction l1 ; induction l2 ; cbn.
induction l1 ; simpl.
- apply (nl _)^.
- apply (nl _)^.
- rewrite IHl1.
apply assoc.
- rewrite IHl1.
cbn.
apply assoc.
- rewrite IHl1, assoc.
reflexivity.
Defined.
Fixpoint reverse (l : list A) : list A :=
match l with
| nil => nil
| cons a l => list_union _ (reverse l) {|a|}
end.
Lemma reverse_set (l : list A) :
list_to_set A l = list_to_set A (reverse l).
Proof.
induction l ; simpl.
- reflexivity.
- rewrite append_union, ?IHl.
simpl.
rewrite nr.
apply comm.
Defined.
End ListToSet.
Section lists_are_sets.