-
-
Save relrod/078228e200e90c4e59a4733068843545 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 Coq.Lists.List. | |
Require Import FunctionalExtensionality. | |
Import ListNotations. | |
Inductive DList (a : Set) := | |
| DL : (list a -> list a) -> DList a. | |
Definition fromList {a : Set} (l : list a) : DList a := | |
DL a (app l). | |
Definition toList {a : Set} (dl : DList a) : list a := | |
match dl with | |
| DL _ f => f [] | |
end. | |
Theorem from_to_id : | |
forall (a : Set) (xs : list a), | |
toList (fromList xs) = xs. | |
Proof. | |
intros. | |
induction xs. | |
- simpl. trivial. | |
- simpl. rewrite app_nil_r. trivial. | |
Qed. | |
Theorem to_from_id : | |
forall (a : Set) (xs : DList a), | |
fromList (toList xs) = xs. | |
Proof. | |
intros. | |
induction xs. | |
simpl. | |
unfold fromList. | |
apply f_equal. | |
extensionality x. | |
induction x. | |
rewrite app_nil_r. | |
reflexivity. | |
(* ??? *) | |
admit. | |
Admitted. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your theorem is false: