Skip to content
Snippets Groups Projects
Commit bdafed6b authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Put fmap sorting lemmas in a section.

parent 5e6e9a20
No related branches found
No related tags found
No related merge requests found
...@@ -96,20 +96,22 @@ Section sorted. ...@@ -96,20 +96,22 @@ Section sorted.
end); clear go; abstract first [by constructor | by inversion 1]. end); clear go; abstract first [by constructor | by inversion 1].
Defined. Defined.
Context {B} (f : A B). Section fmap.
Lemma HdRel_fmap (R1 : relation A) (R2 : relation B) x l : Context {B} (f : A B).
( y, R1 x y R2 (f x) (f y)) HdRel R1 x l HdRel R2 (f x) (f <$> l). Lemma HdRel_fmap (R1 : relation A) (R2 : relation B) x l :
Proof. destruct 2; constructor; auto. Qed. ( y, R1 x y R2 (f x) (f y)) HdRel R1 x l HdRel R2 (f x) (f <$> l).
Lemma Sorted_fmap (R1 : relation A) (R2 : relation B) l : Proof. destruct 2; constructor; auto. Qed.
( x y, R1 x y R2 (f x) (f y)) Sorted R1 l Sorted R2 (f <$> l). Lemma Sorted_fmap (R1 : relation A) (R2 : relation B) l :
Proof. induction 2; simpl; constructor; eauto using HdRel_fmap. Qed. ( x y, R1 x y R2 (f x) (f y)) Sorted R1 l Sorted R2 (f <$> l).
Lemma StronglySorted_fmap (R1 : relation A) (R2 : relation B) l : Proof. induction 2; simpl; constructor; eauto using HdRel_fmap. Qed.
( x y, R1 x y R2 (f x) (f y)) Lemma StronglySorted_fmap (R1 : relation A) (R2 : relation B) l :
StronglySorted R1 l StronglySorted R2 (f <$> l). ( x y, R1 x y R2 (f x) (f y))
Proof. StronglySorted R1 l StronglySorted R2 (f <$> l).
induction 2; csimpl; constructor; Proof.
rewrite ?Forall_fmap; eauto using Forall_impl. induction 2; csimpl; constructor;
Qed. rewrite ?Forall_fmap; eauto using Forall_impl.
Qed.
End fmap.
End sorted. End sorted.
(** ** Correctness of merge sort *) (** ** Correctness of merge sort *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment