-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRGroundTac.v
87 lines (84 loc) · 2.18 KB
/
RGroundTac.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Require Import Qcanon Qreals.
Require Import Reals.
Require Import PolAux.
Ltac RCst0 t :=
match t with
| R0 => constr:(0)
| R1 => constr:(1)
| Rplus ?e1 ?e2 =>
match (RCst0 e1) with
| ?e3 =>
match (RCst0 e2) with
| ?e4 => constr:(Qplus e3 e4)
end
end
| Rminus ?e1 ?e2 =>
match (RCst0 e1) with
| ?e3 =>
match (RCst0 e2) with
| ?e4 => constr:(Qminus e3 e4)
end
end
| Rmult ?e1 ?e2 =>
match (RCst0 e1) with
| ?e3 =>
match (RCst0 e2) with
| ?e4 => constr:(Qmult e3 e4)
end
end
| Ropp ?e1 =>
match (RCst0 e1) with
| ?e3 => constr:(Qopp e3)
end
| Rinv ?e1 =>
match (RCst0 e1) with
| ?e3 => constr:(Qinv e3)
end
| Rdiv ?e1 ?e2 =>
match (RCst0 e1) with
| ?e3 =>
match (RCst0 e2) with
| ?e4 => constr:(Qdiv e3 e4)
end
end
| IZR ?e1 =>
match (ZCst e1) with
| ?e3 => constr: (inject_Z e3)
end
| _ => constr:(0%Q)
end.
Ltac rground_tac :=
match goal with
| |- (?X1 <= ?X2)%R =>
let r1 := RCst0 X1 in
let r2 := RCst0 X2 in
replace X1 with (Q2R r1) by (compute; field);
replace X2 with (Q2R r2) by (compute; field);
apply Qle_Rle;
red; apply refl_equal || intros; discriminate
| |- (?X1 < ?X2)%R =>
let r1 := RCst0 X1 in
let r2 := RCst0 X2 in
replace X1 with (Q2R r1) by (compute; field);
replace X2 with (Q2R r2) by (compute; field);
apply Qlt_Rlt;
red; apply refl_equal || intros; discriminate
| |- (?X1 >= ?X2)%R =>
let r1 := RCst0 X1 in
let r2 := RCst0 X2 in
replace X1 with (Q2R r1) by (compute; field);
replace X2 with (Q2R r2) by (compute; field);
apply Qle_Rle;
red; apply refl_equal || intros; discriminate
| |- (?X1 > ?X2)%R =>
let r1 := RCst0 X1 in
let r2 := RCst0 X2 in
replace X1 with (Q2R r1) by (compute; field);
replace X2 with (Q2R r2) by (compute; field);
apply Qlt_Rlt;
red; apply refl_equal || intros; discriminate
end.
Global Hint Extern 4 (_ <= _)%R => rground_tac: real.
Global Hint Extern 4 (_ < _)%R => rground_tac: real.
Global Hint Extern 4 (_ >= _)%R => rground_tac: real.
Global Hint Extern 4 (_ > _)%R => rground_tac: real.