1 needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs-compiled.hl";;
2 needs "../formal_lp/hypermap/ineqs/lp_ineqs_proofs2-compiled.hl";;
3 needs "../formal_lp/hypermap/ineqs/lp_main_estimate-compiled.hl";;
4 needs "../formal_lp/hypermap/ineqs/lp_ineqs.hl";;
5 needs "../formal_lp/hypermap/ineqs/lp_body_ineqs_data.hl";;
7 module Lp_body_ineqs = struct
10 open Lp_ineqs_proofs2;;
11 open Lp_main_estimate;;
17 let r = add_lp_hyp true in
19 "ineq71", (r ineq71, TRUTH);
20 "ineq72", (r ineq72, TRUTH);
21 "ineq73", (r ineq73, TRUTH);
22 "ineq74", (r ineq74, TRUTH);
23 "ineq77", (r ineq77, r ineq77_std);
24 "ineq89", (r ineq89, r ineq89_std);
25 "ineq90", (r ineq90, r ineq90_std);
26 "ineq104", (r ineq104, r ineq104_std);
27 "ineq105", (r ineq105, r ineq105_std);
28 "ineq106", (r ineq106, r ineq106_std);
29 "ineq118", (r ineq_tau4_diag3, r ineq_tau4_diag3_std);
30 "ineq119", (r ineq119, r ineq119_std);
31 "ineq120", (r ineq120, r ineq120_std);
32 "ineq121", (r ineq121, r ineq121_std);
33 "ineq122", (r ineq122, r ineq122_std);
36 (**********************)
38 let DECIMAL_EQ = ARITH_RULE `#2.0 = &2 /\ #2.00 = &2 /\ #2 = &2 /\ #3.0 = &3`;;
40 let REAL_GT_IMP_GE = ARITH_RULE `a > b ==> a >= b:real`;;
42 let dih2_y_eq_dih3_y = prove(`dih2_y y1 y2 y3 y4 y5 y6 = dih3_y y1 y3 y2 y4 y6 y5`,
43 REWRITE_TAC[dih2_y; dih3_y]);;
45 let dih3_y_eq_dih2_y = prove(`dih3_y y1 y2 y3 y4 y5 y6 = dih2_y y1 y3 y2 y4 y6 y5`,
46 REWRITE_TAC[dih2_y; dih3_y]);;
48 let rhazim2_eq_rhazim3 = prove(`rhazim2 y1 y2 y3 y4 y5 y6 = rhazim3 y1 y3 y2 y4 y6 y5`,
49 REWRITE_TAC[rhazim2; rhazim3; node2_y; node3_y; rhazim; Nonlinear_lemma.dih_y_sym]);;
52 let rhazim3_eq_rhazim2 = prove(`rhazim3 y1 y2 y3 y4 y5 y6 = rhazim2 y1 y3 y2 y4 y6 y5`,
53 REWRITE_TAC[rhazim2; rhazim3; node2_y; node3_y; rhazim; Nonlinear_lemma.dih_y_sym]);;
57 `y1_fan d`, `y1:real`;
58 `y2_fan d`, `y2:real`;
59 `y3_fan (V,E) d`, `y3:real`;
60 `y4'_fan (V,E) d`, `y4:real`;
61 `y5_fan (V,E) d`, `y5:real`;
62 `y6_fan d`, `y6:real`;
63 `y7_fan (V,E) d`, `y7:real`;
64 `y8_fan (V,E) d`, `y8:real`;
65 `y9_fan (V,E) d`, `y9:real`;
70 `y1_fan d`, `y1:real`;
71 `y3_fan (V,E) d`, `y2:real`;
72 `y2_fan d`, `y3:real`;
73 `y4'_fan (V,E) d`, `y4:real`;
74 `y6_fan d`, `y5:real`;
75 `y5_fan (V,E) d`, `y6:real`;
79 let r = UNDISCH o SPEC_ALL o add_lp_hyp true;;
81 GSYM azim_fan_eq_dih_y;
82 GSYM rhazim_fan_eq_rhazim;
87 GSYM dart3_azim2_fan_eq_dih2_y;
88 GSYM dart3_azim3_fan_eq_dih3_y;
89 GSYM dart3_rhazim2_fan_eq_rhazim2;
90 GSYM dart3_rhazim3_fan_eq_rhazim3;
91 GSYM dart3_sol_fan_eq_sol;
92 GSYM dart3_tau_fan_eq_taum;
96 GSYM dart4_tau_fan_eq_tauq;
100 let bounds_gen_ths = map r [
101 y1_lo; y2_lo; y3_lo; y4_lo; y5_lo; y6_lo; y8_lo; y9_lo;
103 y4'_lo; y7_lo; y7_hi;
106 let bounds_std_ths = map r [
107 y4_hi_std; y5_hi_std; y6_hi_std; y8_hi_std; y9_hi_std;
108 y4_hi_std2; y5_hi_std2; y6_hi_std2;
111 let mk_darts_k_subset_th k =
112 let eq_th = add_lp_hyp false Hypermap_and_fan.COMPONENTS_HYPERMAP_OF_FAN in
113 (UNDISCH_ALL o REWRITE_RULE[eq_th] o SPEC_ALL o ISPECL[`hypermap_of_fan (V,E)`; mk_small_numeral k])
114 Lp_gen_theory.darts_k_subset;;
122 let mk_lp_data (tm, eq_ths, in_th) =
123 {d_in_tm = tm; eq_ths = eq_ths; in_th = in_th};;
126 "dart", mk_lp_data (`(d:real^3#real^3) IN dart_of_fan (V,E)`, eq_ths, TRUTH);
127 "dart3", mk_lp_data (`(d:real^3#real^3) IN darts_k 3 (hypermap_of_fan (V,E))`, eq3_ths, mk_darts_k_subset_th 3);
128 "dart4", mk_lp_data (`(d:real^3#real^3) IN darts_k 4 (hypermap_of_fan (V,E))`, eq4_ths, mk_darts_k_subset_th 4);
135 if is_binary "real_gt" (concl th) then
136 MATCH_MP REAL_GT_IMP_GE th
137 else if is_binary "real_lt" (concl th) then
138 MATCH_MP REAL_LT_IMP_LE th
142 if is_imp (concl th) then
143 let p_tm, _ = dest_imp (concl th) in
144 let th2 = normalize (UNDISCH th) in
149 let finalize_th data th =
150 let th1 = PROVE_HYP data.in_th th in
151 let th2 = normalize_ineq th1 in
152 let th3 = (PURE_REWRITE_RULE[GSYM IMP_IMP] o GEN `d:real^3#real^3` o DISCH data.d_in_tm) th2 in
153 add_lp_ineqs_hyp th3;;
156 (* set name, (set definitional theorem, corresponding lp set, generate std flag *)
158 "apex_std3_hll", (Ineq.apex_std3_hll, "dart3", true);
159 "apex_flat_h", (Ineq.apex_flat_h, "dart3", false);
160 "apex_flat_l", (Ineq.apex_flat_l, "dart3", false);
161 "apex_flat_hll", (Ineq.apex_flat_hll, "dart3", false);
162 "apex_flat", (Ineq.apex_flat, "dart3", false);
163 "apex_std3_lhh", (Ineq.apex_std3_lhh, "dart3", true);
164 "apex_sup_flat", (Ineq.apex_sup_flat, "dart3", false);
165 "dart_mll_n", (Ineq.dart_mll_n, "dart3", true);
166 "dart_mll_w", (Ineq.dart_mll_w, "dart3", true);
167 "apex_std3_lll_wxx", (Ineq.apex_std3_lll_wxx, "dart3", true);
168 "apex_std3_lll_xww", (Ineq.apex_std3_lll_xww, "dart3", true);
169 "apex_std3_small_hll", (Ineq.apex_std3_small_hll, "dart3", true);
170 "dart_std3_mini", (Ineq.dart_std3_mini, "dart3", true);
171 "dart_std3_lw", (Ineq.dart_std3_lw, "dart3", true);
172 "dart_std3", (Ineq.dart_std3, "dart3", true);
173 "dart_Hll_w", (Ineq.dart_Hll_w, "dart3", true);
174 "dart_Hll_n", (Ineq.dart_Hll_n, "dart3", true);
175 "apexfA", (Ineq.apexfA, "dart3", false);
176 "apexffA", (Ineq.apexffA, "dart3", false);
177 "apex_A", (Ineq.apex_A, "dart3", false);
178 "dart_std3_big_200_218", (Ineq.dart_std3_big_200_218, "dart3", true);
179 "dart_std3_big", (REWRITE_RULE[GSYM Ineq.dart_std3_big] Ineq.dart_std3, "dart3", true);
180 "dart_std3_small", (Ineq.dart_std3_small, "dart3", true);
181 "dart4_diag3", (Ineq.dart4_diag3, "dart4", true);
182 "dartY", (Ineq.dartY, "dart", false);
183 "dartX", (Ineq.dartX, "dart", false);
187 let gen_body_ineq_ths sym_flag ineq_id set_name =
188 let ineq_domain_th, lp_set, std_flag = assoc set_name ineq_sets in
189 let data = assoc lp_set lp_data in
191 let ineq = (hd o Ineq.getexact) ineq_id in
192 let th0 = (SPEC_ALL o ASSUME) (ineq.ineq) in
195 let t1 = INST inst_sym_list th0 in
196 ONCE_REWRITE_RULE[Nonlinear_lemma.dih_y_sym; dih2_y_eq_dih3_y; dih3_y_eq_dih2_y; rhazim2_eq_rhazim3; rhazim3_eq_rhazim2] t1
198 INST inst_list th0 in
200 let th2 = REWRITE_RULE data.eq_ths th1 in
201 let th3 = REWRITE_RULE[ALL; INEQ_ALT; ineq_domain_th; DECIMAL_EQ] th2 in
203 let gen_th1 = REWRITE_RULE bounds_gen_ths th3 in
204 let gen_th = finalize_th data gen_th1 in
207 let std_th1 = REWRITE_RULE bounds_std_ths gen_th1 in
208 finalize_th data std_th1
216 (*********************)
219 let add_body_ineqs () =
220 let test (name, _, _) = true in
221 let data = filter test Lp_body_ineqs_data.data in
222 let sym_data = filter test Lp_body_ineqs_data.sym_data in
225 Format.print_string s; Format.print_newline(); Format.print_flush() in
226 let counter = ref 0 and
227 total = length data + length sym_data in
229 let add sym_flag (lp_name, ineq_id, set_name) =
230 let _ = counter := !counter + 1 in
231 let _ = report (sprintf "Adding %s (%d / %d)" lp_name !counter total) in
233 try assoc lp_name special_list
234 with Failure _ -> gen_body_ineq_ths sym_flag ineq_id set_name in
235 let _ = add_lp_ineq_th (lp_name, false, gen_th) in
236 let _ = if std_th <> TRUTH then add_lp_ineq_th (lp_name, true, std_th) else () in
239 let _ = map (add false) data in
240 let _ = map (add true) sym_data in