walther@59944
|
1 |
(* Title: "Specify/o-model.sml"
|
walther@59944
|
2 |
Author: Walther Neuper
|
walther@59944
|
3 |
(c) due to copyright terms
|
walther@59944
|
4 |
*)
|
walther@59944
|
5 |
|
walther@59944
|
6 |
"-----------------------------------------------------------------------------------------------";
|
walther@59944
|
7 |
"table of contents -----------------------------------------------------------------------------";
|
walther@59944
|
8 |
"-----------------------------------------------------------------------------------------------";
|
walther@59944
|
9 |
"----------- initialise O_Model.T --------------------------------------------------------------";
|
Walther@60475
|
10 |
"----------- fun partition_variants ------------------------------------------------------------";
|
Walther@60475
|
11 |
"----------- fun O_Model.collect_variants ------------------------------------------------------";
|
Walther@60475
|
12 |
"----------- fun partition_variants ------------------------------------------------------------";
|
Walther@60469
|
13 |
"----------- fun add_enumerate -----------------------------------------------------------------";
|
walther@59996
|
14 |
"----------- fun filter_vat --------------------------------------------------------------------";
|
walther@59996
|
15 |
"----------- regression test fun O_Model.is_copy_named -----------------------------------------";
|
Walther@60469
|
16 |
"----------- .. CONTINUED regr.test fun O_Model.copy_name --------------------------------------";
|
walther@59944
|
17 |
"-----------------------------------------------------------------------------------------------";
|
walther@59944
|
18 |
"-----------------------------------------------------------------------------------------------";
|
walther@59944
|
19 |
"-----------------------------------------------------------------------------------------------";
|
walther@59944
|
20 |
|
Walther@60427
|
21 |
"----------- fun init for O_Model.T ------------------------------------------------------------";
|
Walther@60427
|
22 |
"----------- fun init for O_Model.T ------------------------------------------------------------";
|
Walther@60427
|
23 |
"----------- fun init for O_Model.T ------------------------------------------------------------";
|
walther@59952
|
24 |
open O_Model;
|
walther@59997
|
25 |
val f_model = ["Traegerlaenge L", "Streckenlast q_0", "Biegelinie y",
|
walther@59944
|
26 |
"Randbedingungen [y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]",
|
walther@59944
|
27 |
"FunktionsVariable x", "GleichungsVariablen [c, c_2, c_3, c_4]",
|
walther@59944
|
28 |
"AbleitungBiegelinie dy"];
|
walther@59944
|
29 |
val f_spec = ("Biegelinie", ["Biegelinien"], ["IntegrierenUndKonstanteBestimmen2"]);
|
walther@59944
|
30 |
(*[], Pbl*)val (p,_,f,nxt,_,pt) = CalcTreeTEST [(f_model, f_spec)]; (*\<rightarrow>Model_Problem*)
|
walther@59944
|
31 |
|
walther@59944
|
32 |
"~~~~~ fun CalcTreeTEST , args:"; val [(fmz, sp)] = [(f_model, f_spec)];
|
walther@59944
|
33 |
|
walther@59944
|
34 |
(* val ((pt, p), tacis) =*)
|
Walther@60558
|
35 |
Step_Specify.nxt_specify_init_calc ctxt (fmz, sp);
|
walther@59944
|
36 |
"~~~~~ fun nxt_specify_init_calc , args:"; val (fmz, (dI, pI, mI)) = (fmz, sp);
|
Walther@60556
|
37 |
(*val (_, hdl, (dI, pI, mI), pors, pctxt) = *)
|
Walther@60559
|
38 |
Step_Specify.initialise (fmz, (dI, pI, mI));
|
Walther@60559
|
39 |
"~~~~~ fun initialise , args:"; val (fmz, (dI, pI, mI)) = (fmz, sp);
|
Walther@60556
|
40 |
val thy = ThyC.get_theory dI
|
Walther@60556
|
41 |
val ctxt = Proof_Context.init_global thy;
|
walther@59944
|
42 |
(*if*) mI = ["no_met"] (*else*);
|
Walther@60559
|
43 |
val pors = Problem.from_store ctxt pI |> #ppc |> O_Model.init thy fmz; (*..TermC.parseNEW'*)
|
Walther@60559
|
44 |
(*+*)Problem.from_store ctxt pI: Problem.T;
|
Walther@60559
|
45 |
(*+*)(Problem.from_store ctxt pI |> #ppc): Model_Pattern.T;
|
walther@59944
|
46 |
|
Walther@60559
|
47 |
(*+*)val o_model = (Problem.from_store ctxt pI |> #ppc |>
|
Walther@60470
|
48 |
O_Model.init thy fmz);
|
Walther@60559
|
49 |
"~~~~~ fun init , args:"; val (fmz, thy, pbt) = (fmz, thy, Problem.from_store ctxt pI |> #ppc);
|
walther@59952
|
50 |
val ori = (map (fn str => str
|
walther@59952
|
51 |
|> TermC.parseNEW'' thy
|
walther@59953
|
52 |
|> Input_Descript.split
|
walther@59952
|
53 |
|> add_field thy pbt) fmz)
|
walther@59952
|
54 |
|> add_variants;
|
walther@59952
|
55 |
|
walther@59952
|
56 |
(*+ decompose..*)
|
walther@60336
|
57 |
(*+*)val aaa as Const (\<^const_name>\<open>Traegerlaenge\<close>, _) $ Free ("L", _) = (nth 1 fmz) |> TermC.parseNEW'' thy;
|
walther@60336
|
58 |
(*+*)val bbb as (Const (\<^const_name>\<open>Traegerlaenge\<close>, _), [Free ("L", _)]) = aaa |> Input_Descript.split;
|
walther@60336
|
59 |
(*+*)val ccc as ("#Given", Const (\<^const_name>\<open>Traegerlaenge\<close>, _), [Free ("L", _)]) = bbb |> add_field thy pbt;
|
walther@59952
|
60 |
(*+ WHY IS THE LIST IN "#Relate" NOT DECOMPOSED?...*)
|
walther@60336
|
61 |
(*+*)val ddd as [("#Given", Const (\<^const_name>\<open>Traegerlaenge\<close>, _), [Free ("L", _)]),
|
walther@60336
|
62 |
("#Given", Const (\<^const_name>\<open>Streckenlast\<close>, _), [Free ("q_0", _)]),
|
walther@60336
|
63 |
("#Find", Const (\<^const_name>\<open>Biegelinie\<close>, _), [Free ("y", _)]),
|
walther@60336
|
64 |
("#Relate", Const (\<^const_name>\<open>Randbedingungen\<close>, _),
|
walther@60336
|
65 |
[Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ (Free ("y", _) $ _(*"0"*)) $ _(*"0"*)) $
|
walther@60336
|
66 |
Const (\<^const_name>\<open>Nil\<close>, _),
|
walther@60336
|
67 |
Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ (Free ("y", _) $ _(**)) $ _(*"0"*)) $
|
walther@60336
|
68 |
Const (\<^const_name>\<open>Nil\<close>, _),
|
walther@60336
|
69 |
Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ (Const (\<^const_name>\<open>Biegelinie.M_b\<close>, _) $ _(*"0"*)) $ _(*"0"*)) $
|
walther@60336
|
70 |
Const (\<^const_name>\<open>Nil\<close>, _),
|
walther@60336
|
71 |
Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ (Const (\<^const_name>\<open>Biegelinie.M_b\<close>, _) $ Free ("L", _)) $ _(*"0"*)) $
|
walther@60336
|
72 |
Const (\<^const_name>\<open>Nil\<close>, _)]),
|
walther@60336
|
73 |
("#undef", Const (\<^const_name>\<open>FunktionsVariable\<close>, _), [Free ("x", _)]),
|
walther@59952
|
74 |
_, _] =
|
walther@59952
|
75 |
(map (fn str => str
|
walther@59952
|
76 |
|> TermC.parseNEW'' thy
|
walther@59953
|
77 |
|> Input_Descript.split
|
walther@59952
|
78 |
|> add_field thy pbt) fmz);
|
walther@60336
|
79 |
(*+*)val eee as [(0, ("#Given", Const (\<^const_name>\<open>Traegerlaenge\<close>, _), [Free ("L", _)])),
|
walther@59952
|
80 |
_, _, _, _, _, _] = add_variants ddd;
|
walther@59952
|
81 |
|
Walther@60476
|
82 |
val maxv = map fst ori |> max_variant;
|
walther@59944
|
83 |
val maxv = if maxv = 0 then 1 else maxv;
|
walther@59952
|
84 |
val oris = ori
|
Walther@60475
|
85 |
|> O_Model.collect_variants
|
walther@59944
|
86 |
|> map (replace_0 maxv |> apfst)
|
Walther@60472
|
87 |
|> add_enumerate
|
walther@59944
|
88 |
|> map flattup;
|
walther@59944
|
89 |
|
walther@59952
|
90 |
(*+ decompose..*)
|
Walther@60475
|
91 |
(*+*)val fff as [([0], ("#Given", _, _)), _, _, _, _, _, _] = ori |> O_Model.collect_variants;
|
walther@59952
|
92 |
(*+*)val ggg as [([1], ("#Given", _, _)), _, _, _, _, _, _] = fff |> map (replace_0 maxv |> apfst);
|
Walther@60472
|
93 |
(*+*)val hhh as [(1, ([1], ("#Given", _, _))), (2, ([1], ("#Given", _, _))), _, _, _, _, _] = ggg |> add_enumerate;
|
walther@59952
|
94 |
(*+*)val iii = hhh |> map flattup;
|
walther@59952
|
95 |
(*+*)val iii as [(1, [1], "#Given", _, _), (2, [1], "#Given", _, _), _, _, _, _, _] = hhh |> map flattup;
|
walther@59952
|
96 |
|
walther@59952
|
97 |
(oris, ctxt) (*return from O_Model.init*);
|
walther@59952
|
98 |
"~~~~~ from fun O_Model.init \<longrightarrow>fun nxt_specify_init_calc , return:"; val (pors, pctxt) = (oris, ctxt);
|
walther@59944
|
99 |
|
walther@59944
|
100 |
(* final test ...*)
|
walther@59944
|
101 |
(*+*)if O_Model.to_string pors = "[\n" ^
|
walther@59997
|
102 |
"(1, [\"1\"], #Given, Traegerlaenge, [\"L\"]), \n" ^
|
walther@59997
|
103 |
"(2, [\"1\"], #Given, Streckenlast, [\"q_0\"]), \n" ^
|
walther@59997
|
104 |
"(3, [\"1\"], #Find, Biegelinie, [\"y\"]), \n" ^
|
walther@59997
|
105 |
"(4, [\"1\"], #Relate, Randbedingungen, [\"[y 0 = 0]\", \"[y L = 0]\", \"[M_b 0 = 0]\", \"[M_b L = 0]\"]), \n" ^
|
walther@59997
|
106 |
"(5, [\"1\"], #undef, FunktionsVariable, [\"x\"]), \n" ^
|
walther@59997
|
107 |
"(6, [\"1\"], #undef, GleichungsVariablen, [\"[c]\", \"[c_2]\", \"[c_3]\", \"[c_4]\"]), \n" ^
|
walther@59997
|
108 |
"(7, [\"1\"], #undef, AbleitungBiegelinie, [\"dy\"])]"
|
walther@59944
|
109 |
then () else error "O_Model.init CHANGED";
|
walther@59952
|
110 |
|
walther@59952
|
111 |
|
walther@59952
|
112 |
"----------- ..CONTIUNED: initialise ctxt ------------------------------------------------------";
|
walther@59952
|
113 |
"----------- ..CONTIUNED: initialise ctxt ------------------------------------------------------";
|
walther@59952
|
114 |
"----------- ..CONTIUNED: initialise ctxt ------------------------------------------------------";
|
walther@59952
|
115 |
val ctxt = ContextC.initialise' thy f_model;
|
walther@59952
|
116 |
case parseNEW ctxt "L" of
|
wenzelm@60309
|
117 |
SOME (Free ("L", Type (\<^type_name>\<open>real\<close>, []))) => ()
|
walther@59952
|
118 |
| _ => error "ContextC.initialise' CHANGED";
|
walther@59996
|
119 |
|
Walther@60475
|
120 |
"----------- fun partition_variants ------------------------------------------------------------";
|
Walther@60475
|
121 |
"----------- fun partition_variants ------------------------------------------------------------";
|
Walther@60475
|
122 |
"----------- fun partition_variants ------------------------------------------------------------";
|
walther@59996
|
123 |
val xs = [1,1,1,2,4,4,5];
|
Walther@60475
|
124 |
val xxx = partition_variants (op=) xs;
|
walther@59996
|
125 |
if xxx = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)]
|
Walther@60475
|
126 |
then () else error "fun partition_variants CHANGED";
|
walther@59996
|
127 |
|
Walther@60475
|
128 |
"----------- fun O_Model.collect_variants -----------------------------------------------------------------";
|
Walther@60475
|
129 |
"----------- fun O_Model.collect_variants -----------------------------------------------------------------";
|
Walther@60475
|
130 |
"----------- fun O_Model.collect_variants -----------------------------------------------------------------";
|
walther@59996
|
131 |
val xs = [(1,1),(2,1),(3,1),(0,2),(1,4),(2,4),(0,5)];
|
walther@59996
|
132 |
|
Walther@60475
|
133 |
if O_Model.collect_variants xs = [([1, 2, 3], 1), ([0], 2), ([1, 2], 4), ([0], 5)]
|
Walther@60475
|
134 |
then () else error "fun O_Model.collect_variants CHANGED";
|
Walther@60475
|
135 |
|
Walther@60475
|
136 |
(**** fun O_Model.partition_variants #################################################### ****)
|
Walther@60475
|
137 |
"----------- fun partition_variants ------------------------------------------------------------";
|
Walther@60475
|
138 |
"----------- fun partition_variants ------------------------------------------------------------";
|
Walther@60475
|
139 |
if partition_variants op= ["a", "b", "c"] = [(0, "a"), (0, "b"), (0, "c")]
|
Walther@60475
|
140 |
then () else error "O_Model.partition_variants CHANGED 1";
|
Walther@60475
|
141 |
|
Walther@60475
|
142 |
if partition_variants op= ["a", "b", "b", "b", "c"] = [
|
Walther@60475
|
143 |
(0, "a"),
|
Walther@60475
|
144 |
(1, "b"), (2, "b"), (3, "b"),
|
Walther@60475
|
145 |
(0, "c")] then () else error "O_Model.partition_variants CHANGED 2";
|
Walther@60475
|
146 |
|
Walther@60475
|
147 |
if partition_variants op= ["a", "b", "b", "b", "c", "c"] = [
|
Walther@60475
|
148 |
(0, "a"),
|
Walther@60475
|
149 |
(1, "b"), (2, "b"), (3, "b"),
|
Walther@60475
|
150 |
(1, "c"), (2, "c")] then () else error "O_Model.partition_variants CHANGED 3";
|
Walther@60475
|
151 |
|
walther@59996
|
152 |
|
Walther@60469
|
153 |
"----------- fun add_enumerate -----------------------------------------------------------------";
|
Walther@60469
|
154 |
"----------- fun add_enumerate -----------------------------------------------------------------";
|
Walther@60469
|
155 |
"----------- fun add_enumerate -----------------------------------------------------------------";
|
walther@59996
|
156 |
val xs = [([1,2,3],1),([0],2),([1,2],4),([0],5)];
|
Walther@60472
|
157 |
val xxx = add_enumerate xs;
|
walther@59996
|
158 |
|
Walther@60472
|
159 |
if add_enumerate xs = [(1, ([1, 2, 3], 1)), (2, ([0], 2)), (3, ([1, 2], 4)), (4, ([0], 5))]
|
Walther@60472
|
160 |
then () else error "fun add_enumerate CHANGED";
|
walther@59996
|
161 |
|
walther@59996
|
162 |
|
walther@59996
|
163 |
"----------- fun filter_vat --------------------------------------------------------------------";
|
walther@59996
|
164 |
"----------- fun filter_vat --------------------------------------------------------------------";
|
walther@59996
|
165 |
"----------- fun filter_vat --------------------------------------------------------------------";
|
walther@59996
|
166 |
val formalise = [
|
walther@59997
|
167 |
"fixedValues [r=Arbfix]", "maximum A", "valuesFor [a,b]",
|
walther@59996
|
168 |
"relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
|
walther@59996
|
169 |
"relations [A=a*b, (a/2)^2 + (b/2)^2 = r^2]",
|
walther@59996
|
170 |
"relations [A=a*b, a/2=r*sin alpha, b/2=r*cos (alpha::real)]",
|
walther@60242
|
171 |
(* \<up> these are the elements for the root-problem (in variants)*)
|
walther@59996
|
172 |
(*vvv these are elements required for subproblems*)
|
walther@59997
|
173 |
"boundVariable a", "boundVariable b", "boundVariable alpha",
|
walther@59996
|
174 |
"interval {x::real. 0 <= x & x <= 2*r}",
|
walther@59996
|
175 |
"interval {x::real. 0 <= x & x <= 2*r}",
|
walther@59996
|
176 |
"interval {x::real. 0 <= x & x <= pi}",
|
walther@59996
|
177 |
"errorBound (eps=(0::real))"]
|
walther@59996
|
178 |
val pbt as {ppc = ppc,...} =
|
Walther@60559
|
179 |
Problem.from_store @{context} ["maximum_of", "function"];
|
Walther@60470
|
180 |
val o_model = O_Model.init @{theory} formalise ppc;
|
walther@59996
|
181 |
|
walther@59996
|
182 |
case o_model of
|
walther@59996
|
183 |
[
|
walther@60336
|
184 |
(1, [1, 2, 3], "#Given", Const (\<^const_name>\<open>Input_Descript.fixedValues\<close>, _), [Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("r", _) $ Const (\<^const_name>\<open>Program.Arbfix\<close>, _)) $ _]),
|
walther@60336
|
185 |
(2, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.maximum\<close>, _), [Free ("A", _)]),
|
walther@60336
|
186 |
(3, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.valuesFor\<close>, _), [_ $ Free ("a", _) $ _, Const (\<^const_name>\<open>Cons\<close>, _) $ Free ("b", _) $ _]),
|
walther@60336
|
187 |
(4, [1, 2], "#Relate", Const (\<^const_name>\<open>Input_Descript.relations\<close>, _), _),
|
walther@60336
|
188 |
(5, [3], "#Relate", Const (\<^const_name>\<open>Input_Descript.relations\<close>, _), _),
|
walther@60336
|
189 |
(6, [1], "#undef", Const (\<^const_name>\<open>Input_Descript.boundVariable\<close>, _), [Free ("a", _)]),
|
walther@60336
|
190 |
(7, [2], "#undef", Const (\<^const_name>\<open>Input_Descript.boundVariable\<close>, _), [Free ("b", _)]),
|
walther@60336
|
191 |
(8, [3], "#undef", Const (\<^const_name>\<open>Input_Descript.boundVariable\<close>, _), [Free ("alpha", _)]),
|
walther@60336
|
192 |
(9, [1, 2], "#undef", Const (\<^const_name>\<open>Input_Descript.interval\<close>, _), [Const (\<^const_name>\<open>Collect\<close>, _) $ Abs ("x", _, Const (\<^const_name>\<open>conj\<close>, _) $ _ $ _)]),
|
walther@60336
|
193 |
(10, [3], "#undef", Const (\<^const_name>\<open>Input_Descript.interval\<close>, _), _),
|
walther@60336
|
194 |
(11, [1, 2, 3], "#undef", Const (\<^const_name>\<open>Input_Descript.errorBound\<close>, _), [Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("eps", _) $ _(*"0"*)])
|
walther@59996
|
195 |
] => ()
|
walther@59996
|
196 |
| _ => error "fun O_Model.init CHANGED";
|
walther@59996
|
197 |
|
walther@59996
|
198 |
(*/------- unused code -----------------------------------------------------------------------\*)
|
walther@59996
|
199 |
fun filter_vat oris i = filter ((member_swap op = i) o (#2 : O_Model.single -> int list)) oris;
|
walther@59996
|
200 |
filter_vat : O_Model.T -> int -> O_Model.T;
|
walther@59996
|
201 |
(*\------- unused code -----------------------------------------------------------------------/*)
|
walther@59996
|
202 |
|
walther@59996
|
203 |
val filtered = map (filter_vat o_model) [1,2,3];
|
walther@60242
|
204 |
(*DIFFERENT ARGUMENT HERE \<up> \<up> ^ DOES not CHANGE ANYTHING .. ?error?*)
|
walther@59996
|
205 |
|
walther@59996
|
206 |
case filtered of
|
walther@59996
|
207 |
[[
|
walther@60336
|
208 |
(1, [1, 2, 3], "#Given", Const (\<^const_name>\<open>Input_Descript.fixedValues\<close>, _), [Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("r", _) $ Const (\<^const_name>\<open>Program.Arbfix\<close>, _)) $ _]),
|
walther@60336
|
209 |
(2, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.maximum\<close>, _), [Free ("A", _)]),
|
walther@60336
|
210 |
(3, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.valuesFor\<close>, _), [_ $ Free ("a", _) $ _, Const (\<^const_name>\<open>Cons\<close>, _) $ Free ("b", _) $ _]),
|
walther@60336
|
211 |
(4, [1, 2], "#Relate", Const (\<^const_name>\<open>Input_Descript.relations\<close>, _), _),
|
walther@60336
|
212 |
(6, [1], "#undef", Const (\<^const_name>\<open>Input_Descript.boundVariable\<close>, _), [Free ("a", _)]),
|
walther@60336
|
213 |
(9, [1, 2], "#undef", Const (\<^const_name>\<open>Input_Descript.interval\<close>, _), [Const (\<^const_name>\<open>Collect\<close>, _) $ Abs ("x", _, Const (\<^const_name>\<open>conj\<close>, _) $ _ $ _)]),
|
walther@60336
|
214 |
(11, [1, 2, 3], "#undef", Const (\<^const_name>\<open>Input_Descript.errorBound\<close>, _), [Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("eps", _) $ _(*"0"*)])
|
walther@59996
|
215 |
], [
|
walther@60336
|
216 |
(1, [1, 2, 3], "#Given", Const (\<^const_name>\<open>Input_Descript.fixedValues\<close>, _), [Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("r", _) $ Const (\<^const_name>\<open>Program.Arbfix\<close>, _)) $ _]),
|
walther@60336
|
217 |
(2, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.maximum\<close>, _), [Free ("A", _)]),
|
walther@60336
|
218 |
(3, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.valuesFor\<close>, _), [_ $ Free ("a", _) $ _, Const (\<^const_name>\<open>Cons\<close>, _) $ Free ("b", _) $ _]),
|
walther@60336
|
219 |
(4, [1, 2], "#Relate", Const (\<^const_name>\<open>Input_Descript.relations\<close>, _), _),
|
walther@60336
|
220 |
(7, [2], "#undef", Const (\<^const_name>\<open>Input_Descript.boundVariable\<close>, _), [Free ("b", _)]),
|
walther@60336
|
221 |
(9, [1, 2], "#undef", Const (\<^const_name>\<open>Input_Descript.interval\<close>, _), [Const (\<^const_name>\<open>Collect\<close>, _) $ Abs ("x", _, Const (\<^const_name>\<open>conj\<close>, _) $ _ $ _)]),
|
walther@60336
|
222 |
(11, [1, 2, 3], "#undef", Const (\<^const_name>\<open>Input_Descript.errorBound\<close>, _), [Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("eps", _) $ _(*"0"*)])
|
walther@59996
|
223 |
], [
|
walther@60336
|
224 |
(1, [1, 2, 3], "#Given", Const (\<^const_name>\<open>Input_Descript.fixedValues\<close>, _), [Const (\<^const_name>\<open>Cons\<close>, _) $ (Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("r", _) $ Const (\<^const_name>\<open>Program.Arbfix\<close>, _)) $ _]),
|
walther@60336
|
225 |
(2, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.maximum\<close>, _), [Free ("A", _)]),
|
walther@60336
|
226 |
(3, [1, 2, 3], "#Find", Const (\<^const_name>\<open>Input_Descript.valuesFor\<close>, _), [_ $ Free ("a", _) $ _, Const (\<^const_name>\<open>Cons\<close>, _) $ Free ("b", _) $ _]),
|
walther@60336
|
227 |
(5, [3], "#Relate", Const (\<^const_name>\<open>Input_Descript.relations\<close>, _), _),
|
walther@60336
|
228 |
(8, [3], "#undef", Const (\<^const_name>\<open>Input_Descript.boundVariable\<close>, _), [Free ("alpha", _)]),
|
walther@60336
|
229 |
(10, [3], "#undef", Const (\<^const_name>\<open>Input_Descript.interval\<close>, _), _),
|
walther@60336
|
230 |
(11, [1, 2, 3], "#undef", Const (\<^const_name>\<open>Input_Descript.errorBound\<close>, _), [Const (\<^const_name>\<open>HOL.eq\<close>, _) $ Free ("eps", _) $ _(*"0"*)])
|
walther@59996
|
231 |
]] => ()
|
walther@59996
|
232 |
| _ => error "fun O_Model.filter_vat CHANGED";
|
walther@59996
|
233 |
|
walther@59996
|
234 |
|
walther@59996
|
235 |
"----------- regression test fun O_Model.is_copy_named -----------------------------------------";
|
walther@59996
|
236 |
"----------- regression test fun O_Model.is_copy_named -----------------------------------------";
|
walther@59996
|
237 |
"----------- regression test fun O_Model.is_copy_named -----------------------------------------";
|
walther@59996
|
238 |
val trm = ("1", (TermC.empty, @{term "v'i'"}));
|
walther@59996
|
239 |
if O_Model.is_copy_named trm then () else error "regr. O_Model.is_copy_named 1";
|
walther@59996
|
240 |
val trm = ("1", (TermC.empty, @{term "e_e"}));
|
walther@59996
|
241 |
if O_Model.is_copy_named trm then error "regr. O_Model.is_copy_named 2" else ();
|
walther@59996
|
242 |
val trm = ("1", (TermC.empty, @{term "L'''"}));
|
walther@59996
|
243 |
if O_Model.is_copy_named trm then () else error "regr. O_Model.is_copy_named 3";
|
walther@59996
|
244 |
|
walther@59996
|
245 |
(* out-comment 'structure CalcHead'...
|
walther@59996
|
246 |
val trm = (1, (2, @{term "v'i'"}));
|
walther@59996
|
247 |
if is_copy_named_generating trm then () else error "regr. O_Model.is_copy_named";
|
walther@59996
|
248 |
val trm = (1, (2, @{term "L'''"}));
|
walther@59996
|
249 |
if is_copy_named_generating trm then error "regr. O_Model.is_copy_named" else ();
|
walther@59996
|
250 |
*)
|
walther@59996
|
251 |
|
Walther@60469
|
252 |
"----------- .. CONTINUED regr.test fun O_Model.copy_name -------------------=------------------";
|
Walther@60469
|
253 |
"----------- .. CONTINUED regr.test fun O_Model.copy_name --------------------------------------";
|
Walther@60469
|
254 |
"----------- .. CONTINUED regr.test fun O_Model.copy_name --------------------------------------";
|
Walther@60473
|
255 |
(*data from above - M_Match.arguments, is_cp, O_Model.copy_name +with EqSystem (!)-:*)
|
walther@59996
|
256 |
(*the model-pattern, O_Model.is_copy_named are filter_out*)
|
walther@59996
|
257 |
val pbt = [("#Given", (@{term "equality"}, @{term "e_e :: bool"})),
|
walther@59996
|
258 |
("#Given", (@{term "solveFor"}, @{term "v_v :: real"} ))];
|
walther@59996
|
259 |
(*the model specific for an example*)
|
Walther@60565
|
260 |
val oris = [([1], "#Given", @{term "equality"} , [TermC.parse_test @{context} "x+1= 2"]),
|
walther@59996
|
261 |
([1], "#Given", @{term "solveFor"} , [@{term "x :: real"} ])];
|
walther@59996
|
262 |
val cy = [("#Find", (@{term "solutions"}, @{term "v_v'i' :: bool list"}))];
|
walther@59996
|
263 |
(*...all must be true*)
|
walther@59996
|
264 |
|
Walther@60473
|
265 |
case O_Model.copy_name pbt oris (hd cy) of
|
walther@60336
|
266 |
([1], "#Find", Const (\<^const_name>\<open>Input_Descript.solutions\<close>, _), [Free ("x_i", _)]) => ()
|
Walther@60473
|
267 |
| _ => error "calchead.sml regr.test O_Model.copy_name-1-";
|
walther@59996
|
268 |
|
Walther@60473
|
269 |
(*new data: O_Model.copy_name without changing the name*)
|
walther@59996
|
270 |
@{term "equalities"}; type_of @{term "[x_1+1=2,x_2=0]"};
|
walther@59996
|
271 |
@{term "solveForVars"}; type_of @{term "[x_1,x_2]::real list"};
|
walther@59996
|
272 |
@{term "solution"}; type_of @{term "ss''' :: bool list"};
|
walther@59996
|
273 |
(*the model-pattern for ["LINEAR", "system"], O_Model.is_copy_named are filter_out*)
|
walther@59996
|
274 |
val pbt = [("#Given", (@{term "equalities"}, @{term "e_s :: bool list"})),
|
walther@59996
|
275 |
("#Given", (@{term "solveForVars v_s"}, @{term "v_s :: bool list"} ))];
|
walther@59996
|
276 |
(*the model specific for an example*)
|
Walther@60565
|
277 |
val oris = [([1], "#Given", @{term "equalities"} ,[TermC.parse_test @{context} "[x_1+1=2,x_2=0]"]),
|
walther@59996
|
278 |
([1], "#Given", @{term "solveForVars"} , [@{term "[x_1,x_2]::real list"}])];
|
walther@59996
|
279 |
val cy = [("#Find", (@{term "solution"}, @{term "ss''' :: bool list"}))
|
walther@59996
|
280 |
(*could be more than 1*)];
|
walther@59996
|
281 |
|
Walther@60473
|
282 |
case O_Model.copy_name pbt oris (hd cy) of
|
walther@60336
|
283 |
([1], "#Find", Const (\<^const_name>\<open>EqSystem.solution\<close>, _), [Free ("ss'''", _)]) => ()
|
Walther@60473
|
284 |
| _ => error "calchead.sml regr.test O_Model.copy_name-2-";
|