Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. Require Import Coq.Strings.String.
  2. Require Import Coq.Strings.Ascii.
  3.  
  4. Fixpoint denote (xs : list ascii) : string :=
  5. match xs with
  6. | nil => EmptyString
  7. | cons x xs => String x (denote xs)
  8. end.
  9.  
  10. Fixpoint reify (xs : string) : list ascii :=
  11. match xs with
  12. | EmptyString => nil
  13. | String x xs => cons x (reify xs)
  14. end.
  15.  
  16. Lemma denote_reify : forall x, denote (reify x) = x.
  17. Admitted.
  18.  
  19. Lemma denote_sound :
  20. forall (P : string -> Prop) x,
  21. P (denote (reify x)) <-> P x.
  22. Proof.
  23. intros.
  24. induction x; simpl; split; intros; auto.
  25. rewrite denote_reify in H; auto.
  26. rewrite denote_reify; auto.
  27. Qed.
  28.  
  29. Lemma reify_append : forall x y, reify (x ++ y) = reify x ++ reify y.
  30. Proof.
  31. induction x; simpl; auto; intros.
  32. rewrite IHx.
  33. reflexivity.
  34. Qed.
  35.  
  36. Lemma append_assoc:
  37. forall s t u,
  38. (s ++ (t ++ u)%string)%string = ((s ++ t)%string ++ u)%string.
  39. Proof.
  40. intros.
  41. apply denote_sound.
  42. apply denote_sound with (x:=(s ++ t ++ u)%string).
  43. f_equal.
  44. rewrite !reify_append.
  45. apply app_assoc.
  46. Qed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement