Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 3,613 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
let le_lem = prove_by_refinement(
 `(!y. y <= Y ==> P y) ==>
  (!y. y < Y ==> P y) /\
  (!y. (y = Y) ==> P y)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;
]);;
(* }}} *)


let lt_int_lem = prove_by_refinement(
 `(!y. y < Y ==> P y) ==> X < Y ==>
  (!y. X < y /\ y < Y ==> P y)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  FIRST_ASSUM MATCH_ACCEPT_TAC;
]);;
(* }}} *)

let ge_lem = prove_by_refinement(
 `(!y. Y <= y ==> P y) ==>
  (!y. Y < y ==> P y) /\
  (!y. (y = Y) ==> P y)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  POP_ASSUM MP_TAC THEN REAL_ARITH_TAC;
]);;
(* }}} *)

let gt_int_lem = prove_by_refinement(
 `(!y. Y < y ==> P y) ==> Y < X ==>
  (!y. Y < y /\ y < X ==> P y)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  FIRST_ASSUM MATCH_ACCEPT_TAC;
]);;
(* }}} *)

let rest_lt_lem = prove_by_refinement(
  `Y < X ==> (!x. x < X ==> P x) ==> (!x. x < Y ==> P x)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_MESON_TAC[REAL_LT_TRANS;real_gt];
]);;
(* }}} *)

let rest_gt_lem = prove_by_refinement(
  `X < Y ==> (!x. X < x ==> P x) ==> (!x. Y < x ==> P x)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_MESON_TAC[REAL_LT_TRANS;real_gt];
]);;
(* }}} *)

let rest_eq_lt_lem = prove_by_refinement(
  `Y < X ==> (!x. x < X ==> P x) ==> (!x. (x = Y) ==> P x)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_MESON_TAC[REAL_LT_TRANS];
]);;
(* }}} *)

let rest_eq_gt_lem = prove_by_refinement(
  `X < Y ==> (!x. X < x ==> P x) ==> (!x. (x = Y) ==> P x)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_MESON_TAC[REAL_LT_TRANS];
]);;
(* }}} *)

let rest_int_lt_lem = prove_by_refinement(
  `Y < X ==> (!x. x < X ==> P x) ==> (!x. Y < x /\ x < X ==> P x)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_MESON_TAC[REAL_LT_TRANS];
]);;
(* }}} *)

let rest_int_gt_lem = prove_by_refinement(
  `X < Y ==> (!x. X < x ==> P x) ==> (!x. X < x /\ x < Y ==> P x)`,
(* {{{ Proof *)
[
  REPEAT STRIP_TAC;
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_MESON_TAC[REAL_LT_TRANS];
]);;
(* }}} *)


let INTERPSIGN_SUBSET = prove_by_refinement(
  `!P Q p s. interpsign P p s  /\ Q SUBSET P ==> interpsign Q p s`,
(* {{{ Proof *)
[
  REWRITE_TAC[SUBSET;IN];
  REPEAT_N 4 STRIP_TAC;
  STRUCT_CASES_TAC (ISPEC `s:sign` SIGN_CASES) THEN
  REWRITE_TAC[interpsign] THEN MESON_TAC[];
]);;
(* }}} *)

let INTERPSIGNS_SUBSET = prove_by_refinement(
  `!P Q ps ss. interpsigns ps P ss  /\ Q SUBSET P ==> interpsigns ps Q ss`,
(* {{{ Proof *)
[
  REWRITE_TAC[SUBSET;IN];
  REPEAT_N 2 STRIP_TAC;
  LIST_INDUCT_TAC;
  LIST_INDUCT_TAC;
  REWRITE_TAC[ALL2;interpsigns;interpsign];
  REWRITE_TAC[ALL2;interpsigns;interpsign];
  LIST_INDUCT_TAC;
  REWRITE_TAC[ALL2;interpsigns;interpsign];
  REWRITE_TAC[ALL2;interpsigns;interpsign];
  (* save *)
  REPEAT STRIP_TAC;
  MATCH_MP_TAC INTERPSIGN_SUBSET;
  ASM_MESON_TAC[SUBSET;IN];
  REWRITE_ASSUMS[ALL2;interpsigns;interpsign];
  FIRST_ASSUM MATCH_MP_TAC;
  ASM_REWRITE_TAC[];
]);;
(* }}} *)

let NOPOINT_LEM = prove_by_refinement(
  `!pl sl. interpsigns pl (\x. T) sl  ==>
   (interpsigns pl (\x. x < &0) sl  /\
    interpsigns pl (\x. x = &0) sl  /\
    interpsigns pl (\x. &0 < x) sl)`,
(* {{{ Proof *)

[
  REPEAT STRIP_TAC THEN MATCH_MP_TAC INTERPSIGNS_SUBSET THEN ASM_MESON_TAC[SUBSET;IN]
]);;

(* }}} *)