-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDPSS_Primitives.v
58 lines (52 loc) · 1.7 KB
/
DPSS_Primitives.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Require Import QArith.
Inductive Direction : Type :=
| dLeft : Direction
| dRight : Direction.
Definition changeDirection : Direction -> Direction :=
fun d => match d with dLeft => dRight | dRight => dLeft end.
Inductive directionFromSourceToTarget : Q -> Q -> Direction -> Prop :=
| ltDir :
forall source target,
source < target ->
directionFromSourceToTarget source target dLeft
| gtDir :
forall source target,
target < source ->
directionFromSourceToTarget source target dRight.
Lemma Direction_eq_dec :
forall d1 d2 : Direction, {d1 = d2} + {d1 <> d2}.
Proof.
intros. destruct d1, d2; firstorder.
Qed.
Definition locationAfterTime : Q -> Direction -> Q -> Q -> Q :=
fun location d speed time =>
match d with
| dLeft => location - (speed * time)
| dRight => location + (speed * time)
end.
Add Parametric Morphism : locationAfterTime with
signature Qeq ==> eq ==> Qeq ==> Qeq ==> Qeq as locationAfterTime_mor.
Proof.
intros. unfold locationAfterTime.
destruct y0; rewrite H1, H0, H; reflexivity.
Qed.
(*
Lemma locationAfterTime_monotone_time_dLeft :
forall location speed time1 time2,
0 < speed ->
time2 < time1 ->
locationAfterTime location dLeft speed time1 <
locationAfterTime location dLeft speed time2.
Proof.
intros. simpl locationAfterTime.
apply Qlt_minus_iff.
setoid_replace (_-_ location (speed * time2) + - _-_ location (speed * time1))
with (speed * (time1 - time2)); try nsatz.
apply Qle_lt_trans with (y := 0 * speed).
apply Qle_lteq. right. nsatz.
setoid_replace (_*_ speed (time1 - time2)) with
(_*_ (time1 + - time2) speed); try nsatz.
apply Qmult_lt_compat_r; auto.
rewrite <- Qlt_minus_iff. auto.
Qed.
*)