Walther@60578
|
1 |
(* Title: "Minisubpbl/150a-add-given-Maximum.sml"
|
Walther@60578
|
2 |
Author: Walther Neuper 1105
|
Walther@60578
|
3 |
(c) copyright due to lincense terms.
|
Walther@60578
|
4 |
|
Walther@60729
|
5 |
COMPARE Specify/specify.sml --- specify-phase: low level functions ---
|
Walther@60729
|
6 |
|
Walther@60705
|
7 |
ATTENTION: the file creates buffer overflow if copied in one piece !
|
Walther@60705
|
8 |
|
Walther@60659
|
9 |
Note: This test --- steps into me --- more than once, to a somewhat extreme extent;
|
Walther@60578
|
10 |
in order not to get lost while working in Test_Some etc,
|
Walther@60578
|
11 |
re-introduce ML (*--- step into XXXXX ---*) and Co.
|
Walther@60578
|
12 |
and use Sidekick for orientation.
|
Walther@60659
|
13 |
Nesting is indicated by /--- //-- ///- at the left margin of the comments.
|
Walther@60578
|
14 |
*)
|
Walther@60578
|
15 |
|
Walther@60763
|
16 |
open Model_Def
|
Walther@60728
|
17 |
open ME_Misc
|
Walther@60733
|
18 |
open Pre_Conds;
|
Walther@60578
|
19 |
|
Walther@60578
|
20 |
val (_(*example text*),
|
Walther@60578
|
21 |
(model as ("Constants [r = (7::real)]" :: "Maximum A" :: "AdditionalValues [u, v]" ::
|
Walther@60578
|
22 |
"Extremum (A = 2 * u * v - u \<up> 2)" ::
|
Walther@60578
|
23 |
"SideConditions [((u::real) / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]" ::
|
Walther@60578
|
24 |
"SideConditions [((u::real) / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]" ::
|
Walther@60728
|
25 |
"SideConditions [(u::real) / 2 = r * sin \<alpha>, 2 / v = r * cos \<alpha>]" ::
|
Walther@60728
|
26 |
(*---------------------------------------------,(v::real) / 2 = r * cos \<alpha>]" --- ERROR in example*)
|
Walther@60578
|
27 |
"FunctionVariable a" :: "FunctionVariable b" :: "FunctionVariable \<alpha>" ::
|
Walther@60578
|
28 |
"Domain {0 <..< r}" :: "Domain {0 <..< r}" :: "Domain {0 <..< \<pi> / 2}" ::
|
Walther@60578
|
29 |
"ErrorBound (\<epsilon> = (0::real))" :: []),
|
Walther@60578
|
30 |
refs as ("Diff_App",
|
Walther@60578
|
31 |
["univariate_calculus", "Optimisation"],
|
Walther@60578
|
32 |
["Optimisation", "by_univariate_calculus"])))
|
Walther@60588
|
33 |
= Store.get (Know_Store.get_expls @{theory}) ["Diff_App-No.123a"] ["Diff_App-No.123a"];
|
Walther@60578
|
34 |
|
Walther@60578
|
35 |
val c = [];
|
Walther@60728
|
36 |
val return_init_calc =
|
Walther@60728
|
37 |
Test_Code.init_calc @{context} [(model, refs)]; (*val Model_Problem = nxt;*)
|
Walther@60728
|
38 |
(*/------------------- step into init_calc -------------------------------------------------\\*)
|
Walther@60728
|
39 |
"~~~~~ fun init_calc , args:"; val (ctxt, [(model, refs as (thy_id, _, _))]) =
|
Walther@60728
|
40 |
(@{context}, [(model, refs)]);
|
Walther@60728
|
41 |
val thy = thy_id |> ThyC.get_theory ctxt
|
Walther@60728
|
42 |
val ((pt, p), tacis) = Step_Specify.initialise' thy (model, refs)
|
Walther@60728
|
43 |
val tac = case tacis of [] => Tactic.Empty_Tac | _ => (#1 o hd) tacis
|
Walther@60728
|
44 |
val f =
|
Walther@60728
|
45 |
TESTg_form ctxt (pt,p);
|
Walther@60728
|
46 |
"~~~~~ fun TESTg_form , args:"; val (ctxt, ptp) = (ctxt, (pt,p));
|
Walther@60728
|
47 |
val (form, _, _) =
|
Walther@60728
|
48 |
ME_Misc.pt_extract ctxt ptp;
|
Walther@60728
|
49 |
"~~~~~ fun pt_extract , args:"; val (ctxt, (pt, (p, p_ as Pbl(*Frm,Pbl*)))) = (ctxt, ptp);
|
Walther@60728
|
50 |
val ppobj = Ctree.get_obj I pt p
|
Walther@60728
|
51 |
val f = if Ctree.is_pblobj ppobj then pt_model ppobj p_ else Ctree.get_obj pt_form pt p;
|
Walther@60728
|
52 |
(*if*) Ctree.is_pblobj ppobj (*then*);
|
Walther@60728
|
53 |
pt_model ppobj p_ ;
|
Walther@60728
|
54 |
"~~~~~ fun pt_model , args:"; val ((Ctree.PblObj {probl, spec, origin = (_, spec', hdl), ctxt, ...}), Pbl_) =
|
Walther@60728
|
55 |
(ppobj, p_);
|
Walther@60728
|
56 |
val (_, pI, _) = Ctree.get_somespec' spec spec';
|
Walther@60728
|
57 |
(* val where_ = if pI = Problem.id_empty then []*)
|
Walther@60728
|
58 |
(*if*) pI = Problem.id_empty (*else*);
|
Walther@60728
|
59 |
val {where_rls, where_, model, ...} = Problem.from_store ctxt pI
|
Walther@60728
|
60 |
val (_, where_) =
|
Walther@60741
|
61 |
Pre_Conds.check ctxt where_rls where_
|
Walther@60771
|
62 |
(model, I_Model.OLD_to_POS probl);
|
Walther@60741
|
63 |
"~~~~~ fun check , args:"; val (ctxt, where_rls, pres, (model_patt, i_model)) =
|
Walther@60771
|
64 |
(ctxt, where_rls, where_, (model, I_Model.OLD_to_POS probl));
|
Walther@60758
|
65 |
val (env_model, (env_subst, env_eval)) =
|
Walther@60758
|
66 |
make_environments model_patt i_model;
|
Walther@60758
|
67 |
"~~~~~ fun make_environments , args:"; val (_, []) = (model_patt, i_model);
|
Walther@60728
|
68 |
(*\------------------- step into init_calc -------------------------------------------------//*)
|
Walther@60763
|
69 |
val (p,_,f,nxt,_,pt) = return_init_calc; val Model_Problem = nxt
|
Walther@60763
|
70 |
val (p, _, f, nxt, _, pt) = me nxt p c pt; val Add_Given "Constants [r = 7]" = nxt
|
Walther@60763
|
71 |
val return_me_add_find_Constants =
|
Walther@60763
|
72 |
me nxt p c pt; val Add_Find "Maximum A" = #4 return_me_add_find_Constants;
|
Walther@60728
|
73 |
(*/------------------- step into me_add_find_Constants -------------------------------------\\*)
|
Walther@60728
|
74 |
"~~~~~ fun me , args:"; val (tac as Add_Given "Constants [r = 7]", p, _(*NEW remove*), pt) =
|
Walther@60728
|
75 |
(nxt, p, c, pt);
|
Walther@60728
|
76 |
val ctxt = Ctree.get_ctxt pt p
|
Walther@60728
|
77 |
(*+*)val PblObj {probl = (1, [1, 2, 3], false, "#Given", Inc
|
Walther@60728
|
78 |
((Const ("Input_Descript.Constants", _), []), _)) :: _, ...} = get_obj I pt (fst p)
|
Walther@60728
|
79 |
(*-------------------------------------------^^--*)
|
Walther@60728
|
80 |
val return_step_by_tactic = (*case*)
|
Walther@60728
|
81 |
Step.by_tactic tac (pt, p) (*of*);
|
Walther@60728
|
82 |
(*//------------------ step into Step.by_tactic --------------------------------------------\\*)
|
Walther@60728
|
83 |
"~~~~~ fun by_tactic , args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, p));
|
Walther@60728
|
84 |
val Applicable.Yes tac' =
|
Walther@60741
|
85 |
(*case*) Specify_Step.check tac (pt, p) (*of*);
|
Walther@60728
|
86 |
(*if*) Tactic.for_specify' tac' (*then*);
|
Walther@60763
|
87 |
|
Walther@60763
|
88 |
(** )val return_step_by_tactic =( **)
|
Walther@60763
|
89 |
(**)val return_step_specify_by_tactic =(**)
|
Walther@60728
|
90 |
Step_Specify.by_tactic tac' ptp;
|
Walther@60763
|
91 |
(*///----------------- step into Step_Specify.by_tactic ------------------------------------\\*)
|
Walther@60728
|
92 |
"~~~~~ fun by_tactic , args:"; val ((Tactic.Add_Given' (ct, _)), (pt, p)) = (tac', ptp);
|
Walther@60728
|
93 |
|
Walther@60763
|
94 |
(** )val calling_code =( **)
|
Walther@60763
|
95 |
(**)val return_by_Add_ =(**)
|
Walther@60728
|
96 |
Specify.by_Add_ "#Given" ct (pt, p);
|
Walther@60763
|
97 |
(*////---------------- step by_Add_ --------------------------------------------------------\\*)
|
Walther@60728
|
98 |
"~~~~~ fun by_Add_ , args:"; val (m_field, ct, (pt, pos as (_, p_))) = ("#Given", ct, (pt, p));
|
Walther@60728
|
99 |
val (met, oris, (_, pI', mI'), pbl, (_, pI, mI), ctxt) = SpecificationC.get_data (pt, pos);
|
Walther@60763
|
100 |
|
Walther@60763
|
101 |
val false =
|
Walther@60728
|
102 |
(*if*) p_ = Pos.Met (*else*);
|
Walther@60763
|
103 |
val (i_model, m_patt) =
|
Walther@60728
|
104 |
(pbl,
|
Walther@60728
|
105 |
(if pI = Problem.id_empty then pI' else pI) |> Problem.from_store ctxt |> #model)
|
Walther@60728
|
106 |
val I_Model.Add i_single =
|
Walther@60778
|
107 |
(*case*) I_Model.check_single ctxt m_field oris i_model m_patt ct;
|
Walther@60728
|
108 |
|
Walther@60763
|
109 |
(** )val i_model' =( **)
|
Walther@60763
|
110 |
(**)val return_add_single =(**)
|
Walther@60773
|
111 |
I_Model.add_single (Proof_Context.theory_of ctxt) i_single i_model;
|
Walther@60763
|
112 |
(*/////--------------- step add_single -----------------------------------------------------\\*)
|
Walther@60728
|
113 |
"~~~~~ fun add_single , args:"; val (thy, itm, model) =
|
Walther@60773
|
114 |
((Proof_Context.theory_of ctxt), i_single, i_model);
|
Walther@60773
|
115 |
fun eq_untouched d (0, _, _, _, (itm_, _)) = (d = descriptor_POS itm_)
|
Walther@60728
|
116 |
| eq_untouched _ _ = false
|
Walther@60728
|
117 |
val model' = case I_Model.seek_ppc (#1 itm) model of
|
Walther@60728
|
118 |
SOME _ => overwrite_ppc thy itm model (*itm updated in is_notyet_input WN.11.03*)
|
Walther@60763
|
119 |
(*\\\\\--------------- step add_single -----------------------------------------------------//*)
|
Walther@60773
|
120 |
|
Walther@60763
|
121 |
(*|||||--------------- step by_Add_ ----------------------------------------------------------*)
|
Walther@60763
|
122 |
val i_model' = return_add_single
|
Walther@60773
|
123 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], false ,#Find, (Inc_POS Maximum __, Position.T)), \n(3, [1, 2, 3], false ,#Find, (Inc_POS AdditionalValues [] [__, __], Position.T)), \n(4, [1, 2, 3], false ,#Relate, (Inc_POS Extremum (__=__), Position.T)), \n(5, [1, 2], false ,#Relate, (Inc_POS SideConditions [] [__=__, __=__], Position.T))]"
|
Walther@60773
|
124 |
= i_model' |> I_Model.to_string_POS ctxt
|
Walther@60773
|
125 |
|
Walther@60774
|
126 |
val tac' = I_Model.make_tactic m_field (ct, i_model')
|
Walther@60778
|
127 |
val (_, _, _, pt') = Specify_Step.add tac' (Istate_Def.Uistate, ctxt) (pt, pos)
|
Walther@60763
|
128 |
val return_by_Add_step =
|
Walther@60763
|
129 |
("ok", ([(Tactic.input_from_T ctxt tac', tac', (pos, (Istate_Def.Uistate, ctxt)))],
|
Walther@60763
|
130 |
[], (pt', pos)))
|
Walther@60763
|
131 |
(*+++*)val {probl, ...} = Calc.specify_data (pt', pos);
|
Walther@60778
|
132 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], false ,#Find, (Inc_POS Maximum __, Position.T)), \n(3, [1, 2, 3], false ,#Find, (Inc_POS AdditionalValues [] [__, __], Position.T)), \n(4, [1, 2, 3], false ,#Relate, (Inc_POS Extremum (__=__), Position.T)), \n(5, [1, 2], false ,#Relate, (Inc_POS SideConditions [] [__=__, __=__], Position.T))]"
|
Walther@60778
|
133 |
= probl |> I_Model.OLD_to_POS |> I_Model.to_string_POS ctxt
|
Walther@60763
|
134 |
(*\\\\---------------- step into by_Add_ ---------------------------------------------------//*)
|
Walther@60763
|
135 |
val return_by_tactic_step = return_by_Add_
|
Walther@60763
|
136 |
(*\\\----------------- step into Step_Specify.by_tactic ------------------------------------//*)
|
Walther@60763
|
137 |
(*vvv--- this means, the return value of *)
|
Walther@60763
|
138 |
val return_step_by_tactic_STEP = return_step_specify_by_tactic
|
Walther@60728
|
139 |
(*\\------------------ step into Step.by_tactic --------------------------------------------//*)
|
Walther@60728
|
140 |
val ("ok", (_, _, ptp)) = return_step_by_tactic;
|
Walther@60728
|
141 |
|
Walther@60763
|
142 |
(*+++*)val (pt, p) = ptp
|
Walther@60763
|
143 |
(*+++*)val {probl, ...} = Calc.specify_data (pt, p);
|
Walther@60778
|
144 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], false ,#Find, (Inc_POS Maximum __, Position.T)), \n(3, [1, 2, 3], false ,#Find, (Inc_POS AdditionalValues [] [__, __], Position.T)), \n(4, [1, 2, 3], false ,#Relate, (Inc_POS Extremum (__=__), Position.T)), \n(5, [1, 2], false ,#Relate, (Inc_POS SideConditions [] [__=__, __=__], Position.T))]"
|
Walther@60778
|
145 |
= probl |> I_Model.OLD_to_POS |> I_Model.to_string_POS ctxt;
|
Walther@60763
|
146 |
|
Walther@60763
|
147 |
val (pt, p) = ptp; (*case*)
|
Walther@60728
|
148 |
Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
|
Walther@60728
|
149 |
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) =
|
Walther@60728
|
150 |
(p, ((pt, Pos.e_pos'), []));
|
Walther@60763
|
151 |
val false =
|
Walther@60728
|
152 |
(*if*) Pos.on_calc_end ip (*else*);
|
Walther@60728
|
153 |
val (_, probl_id, _) = Calc.references (pt, p);
|
Walther@60728
|
154 |
val _ =
|
Walther@60728
|
155 |
(*case*) tacis (*of*);
|
Walther@60763
|
156 |
val false =
|
Walther@60728
|
157 |
(*if*) probl_id = Problem.id_empty (*else*);
|
Walther@60728
|
158 |
|
Walther@60763
|
159 |
|
Walther@60763
|
160 |
val ("ok", ([(Add_Find "Maximum A", _, _)], [], _)) =
|
Walther@60728
|
161 |
switch_specify_solve p_ (pt, ip);
|
Walther@60728
|
162 |
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
|
Walther@60728
|
163 |
(*if*) Pos.on_specification ([], state_pos) (*then*);
|
Walther@60728
|
164 |
|
Walther@60763
|
165 |
val ("ok", ([(Add_Find "Maximum A", _, _)], [], _)) =
|
Walther@60728
|
166 |
specify_do_next (pt, input_pos);
|
Walther@60728
|
167 |
"~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos);
|
Walther@60728
|
168 |
val (_, (p_', tac)) =
|
Walther@60728
|
169 |
Specify.find_next_step ptp;
|
Walther@60728
|
170 |
"~~~~~ fun find_next_step , args:"; val (pt, pos as (_, p_)) = (ptp);
|
Walther@60728
|
171 |
val {meth = met, origin = origin as (oris, o_refs as (_, pI', mI'), _), probl = pbl,
|
Walther@60728
|
172 |
spec = refs, ...} = Calc.specify_data (pt, pos);
|
Walther@60728
|
173 |
val ctxt = Ctree.get_ctxt pt pos;
|
Walther@60778
|
174 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], false ,#Find, (Inc_POS Maximum __, Position.T)), \n(3, [1, 2, 3], false ,#Find, (Inc_POS AdditionalValues [] [__, __], Position.T)), \n(4, [1, 2, 3], false ,#Relate, (Inc_POS Extremum (__=__), Position.T)), \n(5, [1, 2], false ,#Relate, (Inc_POS SideConditions [] [__=__, __=__], Position.T))]"
|
Walther@60778
|
175 |
= pbl |> I_Model.OLD_to_POS |> I_Model.to_string_POS ctxt(*+*)
|
Walther@60728
|
176 |
|
Walther@60763
|
177 |
val false =
|
Walther@60728
|
178 |
(*if*) Ctree.just_created (pt, pos) andalso origin <> Ctree.e_origin (*else*);
|
Walther@60763
|
179 |
val true =
|
Walther@60728
|
180 |
(*if*) p_ = Pos.Pbl (*then*);
|
Walther@60728
|
181 |
|
Walther@60763
|
182 |
(** )val ("dummy", (Pbl, Add_Find "Maximum A")) =( **)
|
Walther@60763
|
183 |
(**)val return_for_problem as ("dummy", (Pbl, Add_Find "Maximum A"))=(**)
|
Walther@60776
|
184 |
for_problem ctxt oris (o_refs, refs) (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met);
|
Walther@60763
|
185 |
(*//------------------ step into for_problem -----------------------------------------------\\*)
|
Walther@60728
|
186 |
"~~~~~ fun for_problem , args:"; val (ctxt, oris, ((dI', pI', mI'), (dI, pI, mI)), (pbl, met)) =
|
Walther@60776
|
187 |
(ctxt, oris, (o_refs, refs), (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met));
|
Walther@60728
|
188 |
val cpI = if pI = Problem.id_empty then pI' else pI;
|
Walther@60728
|
189 |
val cmI = if mI = MethodC.id_empty then mI' else mI;
|
Walther@60728
|
190 |
val {model = pbt, where_rls, where_, ...} = Problem.from_store ctxt cpI;
|
Walther@60728
|
191 |
val {model = mpc, ...} = MethodC.from_store ctxt cmI
|
Walther@60728
|
192 |
|
Walther@60763
|
193 |
(** )val (preok, _) =( **)
|
Walther@60763
|
194 |
(**)val return_check =(**)
|
Walther@60776
|
195 |
Pre_Conds.check ctxt where_rls where_ (pbt, pbl);
|
Walther@60763
|
196 |
(*///----------------- step into Pre_Conds.check -------------------------------------------\\*)
|
Walther@60741
|
197 |
"~~~~~ fun check , args:"; val (ctxt, where_rls, pres, (model_patt, i_model)) =
|
Walther@60776
|
198 |
(ctxt, where_rls, where_, (pbt, pbl));
|
Walther@60728
|
199 |
|
Walther@60763
|
200 |
(** )val (_, (env_subst, env_eval)) =( **)
|
Walther@60763
|
201 |
(**)val return_make_environments =(**)
|
Walther@60763
|
202 |
Pre_Conds.make_environments model_patt i_model;
|
Walther@60763
|
203 |
(*////---------------- step into make_environments -----------------------------------------\\*)
|
Walther@60763
|
204 |
"~~~~~ fun make_environments , args:"; val (model_patt, i_model) = (model_patt, i_model);
|
Walther@60763
|
205 |
val equal_descr_pairs = map (get_equal_descr i_model) model_patt
|
Walther@60763
|
206 |
|> flat
|
Walther@60763
|
207 |
|
Walther@60728
|
208 |
val env_model = make_env_model equal_descr_pairs
|
Walther@60763
|
209 |
(** )val env_model =( **)
|
Walther@60763
|
210 |
(**)val return_make_env_model =(**)
|
Walther@60763
|
211 |
make_env_model equal_descr_pairs;
|
Walther@60763
|
212 |
(*/////--------------- step into make_env_model --------------------------------------------\\*)
|
Walther@60763
|
213 |
"~~~~~ fun make_env_model , args:"; val (equal_descr_pairs) = (equal_descr_pairs);
|
Walther@60763
|
214 |
val return_make_env_model_step =
|
Walther@60763
|
215 |
map (fn ((_, (_, id)), (_, _, _, _, (feedb, _)))
|
Walther@60763
|
216 |
=> (mk_env_model id feedb)) equal_descr_pairs
|
Walther@60763
|
217 |
|> flat
|
Walther@60763
|
218 |
(*map:*)val ((_, (_, id)), (_, _, _, _, (feedb, _))) = (nth 2 equal_descr_pairs);
|
Walther@60763
|
219 |
|
Walther@60763
|
220 |
(*///// /------------- step into mk_env_model ----------------------------------------------\\*)
|
Walther@60771
|
221 |
"~~~~~ fun mk_env_model , args:"; val (_, (Model_Def.Inc_POS (_, []))) = (id, feedb);
|
Walther@60763
|
222 |
(*+*)val (patt, imod) = nth 2 equal_descr_pairs
|
Walther@60769
|
223 |
(*+*)val "(#Find, (Maximum, maxx))" = patt |> Model_Pattern.single_to_string ctxt
|
Walther@60771
|
224 |
(*+*)val "(2, [1, 2, 3], false ,#Find, (Inc_POS Maximum __, Position.T))" = imod |> I_Model.single_to_string_POS ctxt
|
Walther@60763
|
225 |
|
Walther@60763
|
226 |
val return_mk_env_model_2_step = []
|
Walther@60763
|
227 |
(*\\\\\ \------------- step into mk_env_model ----------------------------------------------//*)
|
Walther@60763
|
228 |
(*\\\\\--------------- step into make_env_model --------------------------------------------//*)
|
Walther@60763
|
229 |
val env_model = return_make_env_model;
|
Walther@60763
|
230 |
|
Walther@60763
|
231 |
(*||||---------------- contine.. make_environments -------------------------------------------*)
|
Walther@60728
|
232 |
val equal_givens = filter (fn ((m_field, _), _) => m_field = "#Given") equal_descr_pairs
|
Walther@60728
|
233 |
|
Walther@60763
|
234 |
(** )val subst_eval_list =( **)
|
Walther@60763
|
235 |
(**)val return_make_envs_preconds =(**)
|
Walther@60763
|
236 |
make_envs_preconds equal_givens;
|
Walther@60763
|
237 |
(*/////--------------- step into make_envs_preconds ----------------------------------------\\*)
|
Walther@60728
|
238 |
"~~~~~ fun make_envs_preconds , args:"; val (equal_givens) = (equal_givens);
|
Walther@60763
|
239 |
val return_make_envs_preconds_step =
|
Walther@60763
|
240 |
map (fn ((_, (_, id)), (_, _, _, _, (feedb, _))) => discern_feedback id feedb) equal_givens
|
Walther@60763
|
241 |
|> flat
|
Walther@60728
|
242 |
|
Walther@60763
|
243 |
|
Walther@60763
|
244 |
val ((_, (_, id)), (_, _, _, _, (feedb, _))) = nth 1 equal_givens
|
Walther@60763
|
245 |
(*\\\\\--------------- step into make_envs_preconds ----------------------------------------//*)
|
Walther@60763
|
246 |
val subst_eval_list = return_make_envs_preconds;
|
Walther@60763
|
247 |
val (env_subst, env_eval) = split_list subst_eval_list
|
Walther@60763
|
248 |
|
Walther@60763
|
249 |
val return_make_environments_step = (env_model, (env_subst, env_eval));
|
Walther@60763
|
250 |
(*+*)if return_make_environments_step = return_make_environments
|
Walther@60763
|
251 |
then () else error "return_make_environments_step <> return_make_environments";
|
Walther@60763
|
252 |
(*\\\\---------------- step into make_environments -----------------------------------------//*)
|
Walther@60763
|
253 |
(*|||----------------- contine.. Pre_Conds.check ---------------------------------------------*)
|
Walther@60763
|
254 |
val (env_model, (env_subst, env_eval)) = return_make_environments
|
Walther@60763
|
255 |
val pres_subst = map (TermC.subst_atomic_all env_subst) where_;
|
Walther@60763
|
256 |
val pres_subst_other = map (TermC.subst_atomic_all env_model) (map #2 pres_subst);
|
Walther@60763
|
257 |
val full_subst = if env_eval = [] then pres_subst_other
|
Walther@60763
|
258 |
else map (TermC.subst_atomic_all env_eval) (map #2 pres_subst_other)
|
Walther@60763
|
259 |
val evals = map (eval ctxt where_rls) full_subst
|
Walther@60763
|
260 |
(*in*)
|
Walther@60763
|
261 |
val return_make_environments_step = (foldl and_ (true, map fst evals), pres_subst_other)
|
Walther@60763
|
262 |
(*\\\----------------- step into Pre_Conds.check -------------------------------------------//*)
|
Walther@60763
|
263 |
(*||------------------ contine.. for_problem -------------------------------------------------*)
|
Walther@60763
|
264 |
val (preok, _) = return_check;
|
Walther@60763
|
265 |
(*in*)
|
Walther@60763
|
266 |
val false =
|
Walther@60763
|
267 |
(*if*) dI' = ThyC.id_empty andalso dI = ThyC.id_empty (*else*);
|
Walther@60763
|
268 |
val false =
|
Walther@60763
|
269 |
(*if*) pI' = Problem.id_empty andalso pI = Problem.id_empty (*else*);
|
Walther@60763
|
270 |
val NONE =
|
Walther@60776
|
271 |
(*case*) find_first (fn (_, _, _, _, (feedb, _)) => I_Model.is_error feedb) pbl (*of*);
|
Walther@60763
|
272 |
|
Walther@60763
|
273 |
val SOME (fd, ct' as "Maximum A") = (*case*)
|
Walther@60776
|
274 |
item_to_add ctxt oris pbl (*of*);
|
Walther@60776
|
275 |
"~~~~~ fun item_to_add , args:"; val (ctxt, o_model, i_model) = (ctxt, oris, pbl);
|
Walther@60763
|
276 |
val max_vnt = last_elem (*this decides, for which variant initially help is given*)
|
Walther@60763
|
277 |
(Model_Def.max_variants o_model i_model)
|
Walther@60763
|
278 |
val o_vnts = filter (fn (_, vnts, _, _, _) => member op= vnts max_vnt) o_model
|
Walther@60763
|
279 |
val i_to_select = i_model
|
Walther@60771
|
280 |
|> filter_out (fn (_, vnts, _, _, (I_Model.Cor_POS _, _)) => member op= vnts max_vnt | _ => false)
|
Walther@60763
|
281 |
|> select_inc_lists
|
Walther@60763
|
282 |
|> hd
|
Walther@60763
|
283 |
(*in*)
|
Walther@60763
|
284 |
|
Walther@60763
|
285 |
val SOME (_, _, _, m_field, (feedb, _)) = (*case*)
|
Walther@60763
|
286 |
I_Model.fill_from_o o_vnts i_to_select (*of*);
|
Walther@60771
|
287 |
(*+*)val "Cor_POS Maximum A , pen2str" = feedb |> I_Model.feedback_POS_to_string ctxt;
|
Walther@60763
|
288 |
|
Walther@60763
|
289 |
"~~~~~ fun fill_from_o , args:"; val (o_model, (i, vnts, bool, m_field, (feedb, pos))) =
|
Walther@60763
|
290 |
(o_vnts, i_to_select);
|
Walther@60763
|
291 |
val (m_field, all_value as [Free ("A", _)]) =
|
Walther@60767
|
292 |
case find_first (fn (_, _, _, descr', _) => Model_Def.descriptor_exists descr' feedb) o_model of
|
Walther@60763
|
293 |
SOME (_, _, m_field, _, ts) => (m_field, ts)
|
Walther@60767
|
294 |
val descr = Model_Def.get_descr feedb (*i_single has been filtered appropriately*)
|
Walther@60763
|
295 |
(*in*)
|
Walther@60763
|
296 |
val false =
|
Walther@60766
|
297 |
(*if*) Model_Def.is_list_descr descr (*else*);
|
Walther@60763
|
298 |
val return_fill_from_o_STEP = SOME (i, vnts, bool, m_field,
|
Walther@60771
|
299 |
(Inc_POS (descr, all_value), pos))
|
Walther@60728
|
300 |
(*\------------------- step into me_add_find_Constants -------------------------------------//*)
|
Walther@60728
|
301 |
val (p,_,f,nxt,_,pt) = return_me_add_find_Constants;
|
Walther@60763
|
302 |
val Add_Find "Maximum A" = nxt
|
Walther@60728
|
303 |
|
Walther@60763
|
304 |
(** )val (p,_,f,nxt,_,pt) =( **)
|
Walther@60763
|
305 |
(**)val return_me_Add_Find_Maximum =(**)
|
Walther@60763
|
306 |
me nxt p c pt; val Add_Find "AdditionalValues [u]" = #4 return_me_Add_Find_Maximum;
|
Walther@60763
|
307 |
(*/------------------- step into me_Add_Find_Maximum ---------------------------------------\\*)
|
Walther@60763
|
308 |
"~~~~~ fun me , args:"; val (tac, p, _(*NEW remove*), pt) = (nxt, p, c, pt);
|
Walther@60763
|
309 |
val ctxt = Ctree.get_ctxt pt p
|
Walther@60763
|
310 |
val (pt, p) =
|
Walther@60763
|
311 |
case Step.by_tactic tac (pt, p) of
|
Walther@60763
|
312 |
("ok", (_, _, ptp)) => ptp;
|
Walther@60763
|
313 |
(*case*)
|
Walther@60763
|
314 |
Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
|
Walther@60763
|
315 |
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) =
|
Walther@60763
|
316 |
(p, ((pt, Pos.e_pos'), []));
|
Walther@60763
|
317 |
val false =
|
Walther@60763
|
318 |
(*if*) Pos.on_calc_end ip (*else*);
|
Walther@60763
|
319 |
val (_, probl_id, _) = Calc.references (pt, p);
|
Walther@60763
|
320 |
(*in*)
|
Walther@60763
|
321 |
val [] =
|
Walther@60763
|
322 |
(*case*) tacis (*of*);
|
Walther@60763
|
323 |
val false =
|
Walther@60763
|
324 |
(*if*) probl_id = Problem.id_empty (*else*);
|
Walther@60763
|
325 |
|
Walther@60763
|
326 |
switch_specify_solve p_ (pt, ip);
|
Walther@60763
|
327 |
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
|
Walther@60763
|
328 |
val true =
|
Walther@60763
|
329 |
(*if*) Pos.on_specification ([], state_pos) (*then*);
|
Walther@60763
|
330 |
|
Walther@60763
|
331 |
specify_do_next (pt, input_pos);
|
Walther@60763
|
332 |
"~~~~~ fun specify_do_next , args:"; val (ptp as (pt, (p, p_))) = (pt, input_pos);
|
Walther@60763
|
333 |
|
Walther@60763
|
334 |
(**)val (_, (p_', tac as Add_Find "AdditionalValues [u]")) =(**)
|
Walther@60763
|
335 |
Specify.find_next_step ptp;
|
Walther@60763
|
336 |
"~~~~~ fun find_next_step , args:"; val (pt, pos as (_, p_)) = (ptp);
|
Walther@60763
|
337 |
val {meth = met, origin = origin as (oris, o_refs as (_, pI', mI'), _), probl = pbl,
|
Walther@60763
|
338 |
spec = refs, ...} = Calc.specify_data (pt, pos);
|
Walther@60763
|
339 |
val ctxt = Ctree.get_ctxt pt pos
|
Walther@60763
|
340 |
(*in*)
|
Walther@60763
|
341 |
val false =
|
Walther@60763
|
342 |
(*if*) Ctree.just_created (pt, pos) andalso origin <> Ctree.e_origin (*else*);
|
Walther@60763
|
343 |
val true =
|
Walther@60763
|
344 |
(*if*) p_ = Pos.Pbl (*then*);
|
Walther@60763
|
345 |
|
Walther@60763
|
346 |
(**)val return_find_next_step_STEP as ("dummy", (Pbl, Add_Find "AdditionalValues [u]")) =(**)
|
Walther@60776
|
347 |
for_problem ctxt oris (o_refs, refs) (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met);
|
Walther@60763
|
348 |
"~~~~~ fun for_problem , args:"; val (ctxt, oris, ((dI', pI', mI'), (dI, pI, mI)), (pbl, met)) =
|
Walther@60776
|
349 |
(ctxt, oris, (o_refs, refs), ( I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met));
|
Walther@60763
|
350 |
val cpI = if pI = Problem.id_empty then pI' else pI;
|
Walther@60763
|
351 |
val cmI = if mI = MethodC.id_empty then mI' else mI;
|
Walther@60763
|
352 |
val {model = pbt, where_rls, where_, ...} = Problem.from_store ctxt cpI;
|
Walther@60763
|
353 |
val {model = mpc, ...} = MethodC.from_store ctxt cmI
|
Walther@60776
|
354 |
val (preok, _) = Pre_Conds.check ctxt where_rls where_ (pbt, pbl);
|
Walther@60763
|
355 |
(*in*)
|
Walther@60763
|
356 |
val false =
|
Walther@60763
|
357 |
(*if*) dI' = ThyC.id_empty andalso dI = ThyC.id_empty (*else*);
|
Walther@60763
|
358 |
val false =
|
Walther@60763
|
359 |
(*if*) pI' = Problem.id_empty andalso pI = Problem.id_empty (*else*);
|
Walther@60763
|
360 |
val NONE =
|
Walther@60776
|
361 |
(*case*) find_first (fn (_, _, _, _, (feedb, _)) => I_Model.is_error feedb) pbl (*of*);
|
Walther@60763
|
362 |
|
Walther@60763
|
363 |
(**)val SOME (fd, ct' as "AdditionalValues [u]") = (*case*)(**)
|
Walther@60776
|
364 |
item_to_add ctxt oris pbl (*of*);
|
Walther@60763
|
365 |
"~~~~~ fun item_to_add , args:"; val (ctxt, o_model, i_model) =
|
Walther@60776
|
366 |
(ctxt, oris, pbl);
|
Walther@60763
|
367 |
val max_vnt = last_elem (*this decides, for which variant initially help is given*)
|
Walther@60763
|
368 |
(Model_Def.max_variants o_model i_model)
|
Walther@60763
|
369 |
val o_vnts = filter (fn (_, vnts, _, _, _) => member op= vnts max_vnt) o_model
|
Walther@60763
|
370 |
val i_to_select = i_model
|
Walther@60771
|
371 |
|> filter_out (fn (_, vnts, _, _, (I_Model.Cor_POS _, _)) => member op= vnts max_vnt | _ => false)
|
Walther@60763
|
372 |
|> select_inc_lists
|
Walther@60771
|
373 |
(*ERROR*)val "[\n(3, [1, 2, 3], false ,#Find, (Inc_POS AdditionalValues [] [__, __], Position.T)), \n(4, [1, 2, 3], false ,#Relate, (Inc_POS Extremum (__=__), Position.T)), \n(5, [1, 2], false ,#Relate, (Inc_POS SideConditions [] [__=__, __=__], Position.T))]"
|
Walther@60771
|
374 |
= i_to_select |> I_Model.to_string_POS ctxt(*ERROR*)
|
Walther@60763
|
375 |
(*in*)
|
Walther@60763
|
376 |
val false =
|
Walther@60763
|
377 |
(*if*) i_to_select = []
|
Walther@60763
|
378 |
|
Walther@60763
|
379 |
val SOME (_, _, _, m_field, (feedb, _)) = (*case*)
|
Walther@60763
|
380 |
I_Model.fill_from_o o_vnts (hd i_to_select) (*of*);
|
Walther@60763
|
381 |
"~~~~~ fun fill_from_o , args:";
|
Walther@60763
|
382 |
(*==================== see test/../i-model.sml --- fun item_to_add ===========================*)
|
Walther@60763
|
383 |
(*\------------------- step into me_Add_Find_Maximum ---------------------------------------//*)
|
Walther@60763
|
384 |
val (p,_,f,nxt,_,pt) = return_me_Add_Find_Maximum;
|
Walther@60763
|
385 |
val Add_Find "AdditionalValues [u]" = nxt
|
Walther@60763
|
386 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Find "AdditionalValues [u, v]" = nxt;(*ERROR after repairing item_to_add, investigate in testcode above*)
|
Walther@60578
|
387 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Relation "Extremum (A = 2 * u * v - u \<up> 2)" = nxt;
|
Walther@60578
|
388 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Relation "SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]" = nxt;
|
Walther@60763
|
389 |
|
Walther@60763
|
390 |
val return_me_Add_Relation_SideConditions as (_, _, _, Specify_Theory "Diff_App", _, _)
|
Walther@60705
|
391 |
= me nxt p c pt;
|
Walther@60705
|
392 |
(*/------------------- step into me Add_Relation_SideConditions ----------------------------\\*)
|
Walther@60705
|
393 |
"~~~~~ fun me , args:"; val (tac, p, _, pt) = (nxt, p, c, pt);
|
Walther@60728
|
394 |
val ctxt = Ctree.get_ctxt pt p;
|
Walther@60728
|
395 |
(**) val (pt, p) = (**)
|
Walther@60728
|
396 |
(**)case(**) Step.by_tactic tac (pt, p) (**)of(**)
|
Walther@60728
|
397 |
(**) ("ok", (_, _, ptp)) => ptp (**) ;
|
Walther@60728
|
398 |
|
Walther@60728
|
399 |
(*case*)
|
Walther@60705
|
400 |
Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
|
Walther@60705
|
401 |
(*//------------------ step into do_next ---------------------------------------------------\\*)
|
Walther@60705
|
402 |
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis))
|
Walther@60705
|
403 |
= (p, ((pt, Pos.e_pos'), [])) (*of*);
|
Walther@60705
|
404 |
(*if*) Pos.on_calc_end ip (*else*);
|
Walther@60705
|
405 |
val (_, probl_id, _) = Calc.references (pt, p);
|
Walther@60705
|
406 |
(*case*) tacis (*of*);
|
Walther@60705
|
407 |
(*if*) probl_id = Problem.id_empty (*else*);
|
Walther@60705
|
408 |
|
Walther@60705
|
409 |
Step.switch_specify_solve p_ (pt, ip);
|
Walther@60705
|
410 |
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
|
Walther@60705
|
411 |
(*if*) Pos.on_specification ([], state_pos) (*then*);
|
Walther@60763
|
412 |
|
Walther@60705
|
413 |
Step.specify_do_next (pt, input_pos);
|
Walther@60705
|
414 |
"~~~~~ fun specify_do_next , args:"; val ((ptp as (pt, (p, p_)))) = (pt, input_pos);
|
Walther@60728
|
415 |
val (_, (p_', tac as Specify_Theory "Diff_App")) =
|
Walther@60728
|
416 |
Specify.find_next_step ptp;
|
Walther@60705
|
417 |
"~~~~~ fun find_next_step , args:"; val (pt, pos as (_, p_)) = (ptp);
|
Walther@60705
|
418 |
val {meth = met, origin = origin as (oris, o_refs as (_, pI', mI'), _), probl = pbl,
|
Walther@60705
|
419 |
spec = refs, ...} = Calc.specify_data (pt, pos);
|
Walther@60705
|
420 |
val ctxt = Ctree.get_ctxt pt pos;
|
Walther@60705
|
421 |
(*if*) Ctree.just_created (pt, pos) andalso origin <> Ctree.e_origin (*else*);
|
Walther@60705
|
422 |
(*if*) p_ = Pos.Pbl (*then*);
|
Walther@60705
|
423 |
|
Walther@60763
|
424 |
(** )val ("dummy", (Pbl, tac as Specify_Theory "Diff_App")) =( **)
|
Walther@60763
|
425 |
(**)val return_for_problem =(**)
|
Walther@60776
|
426 |
for_problem ctxt oris (o_refs, refs) (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met);
|
Walther@60763
|
427 |
(*///// /------------- step into for_problem -----------------------------------------------\\*)
|
Walther@60705
|
428 |
"~~~~~ fun for_problem , args:"; val (ctxt, oris, ((dI', pI', mI'), (dI, pI, mI)), (pbl, met)) =
|
Walther@60776
|
429 |
(ctxt, oris, (o_refs, refs), (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met));
|
Walther@60705
|
430 |
val cpI = if pI = Problem.id_empty then pI' else pI;
|
Walther@60705
|
431 |
val cmI = if mI = MethodC.id_empty then mI' else mI;
|
Walther@60705
|
432 |
val {model = pbt, where_rls, where_, ...} = Problem.from_store ctxt cpI;
|
Walther@60705
|
433 |
val {model = mpc, ...} = MethodC.from_store ctxt cmI
|
Walther@60705
|
434 |
|
Walther@60705
|
435 |
(*+*)val [Const ("Orderings.ord_class.less", _) $ Const ("Groups.zero_class.zero", _) $
|
Walther@60763
|
436 |
Free ("fixes", _)] = where_;
|
Walther@60728
|
437 |
|
Walther@60763
|
438 |
(** )val (preok, _) =( **)
|
Walther@60763
|
439 |
(**)return_check =(**)
|
Walther@60776
|
440 |
Pre_Conds.check ctxt where_rls where_ (pbt, pbl);
|
Walther@60763
|
441 |
(*///// //------------ step into check -------------------------------------------------\\*)
|
Walther@60741
|
442 |
"~~~~~ fun check , args:"; val (ctxt, where_rls, pres, (model_patt, i_model)) =
|
Walther@60776
|
443 |
(ctxt, where_rls, where_, (pbt, pbl));
|
Walther@60763
|
444 |
(*+*)val "[0 < fixes]" = pres |> UnparseC.terms ctxt
|
Walther@60728
|
445 |
(*+*)val "[\"(#Given, (Constants, fixes))\", \"(#Find, (Maximum, maxx))\", \"(#Find, (AdditionalValues, vals))\", \"(#Relate, (Extremum, extr))\", \"(#Relate, (SideConditions, sideconds))\"]"
|
Walther@60763
|
446 |
(*+*) = model_patt |> Model_Pattern.to_string ctxt
|
Walther@60771
|
447 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T))]"
|
Walther@60771
|
448 |
= i_model |> I_Model.to_string_POS ctxt
|
Walther@60728
|
449 |
|
Walther@60758
|
450 |
val return_make_environments as (_, (env_subst, env_eval)) =
|
Walther@60758
|
451 |
Pre_Conds.make_environments model_patt i_model
|
Walther@60728
|
452 |
|
Walther@60728
|
453 |
(*+*)val [(Free ("fixes", T1), Free ("r", T2))] = env_subst (*?!? Const*)
|
Walther@60728
|
454 |
(*+*)val Type ("Real.real", []) = T1
|
Walther@60728
|
455 |
(*+*)val Type ("Real.real", []) = T2
|
Walther@60728
|
456 |
|
Walther@60728
|
457 |
(*+*)val [(Free ("r", T2), Const ("Num.numeral_class.numeral", _) $ _)] = env_eval
|
Walther@60728
|
458 |
(*+*)val Type ("Real.real", []) = T2
|
Walther@60728
|
459 |
|
Walther@60758
|
460 |
val (_, (env_subst, env_eval)) = return_make_environments;
|
Walther@60741
|
461 |
(*|||----------------- contine check -----------------------------------------------------*)
|
Walther@60728
|
462 |
val pres_subst = map (TermC.subst_atomic_all env_subst) pres;
|
Walther@60728
|
463 |
(*+*)val [(true, Const ("Orderings.ord_class.less", _) $
|
Walther@60728
|
464 |
Const ("Groups.zero_class.zero", _) $ Free ("r", _))] = pres_subst
|
Walther@60728
|
465 |
|
Walther@60728
|
466 |
val full_subst = map (fn (bool, t) => (bool, subst_atomic env_eval t)) pres_subst
|
Walther@60728
|
467 |
(*+*)val [(true,
|
Walther@60728
|
468 |
Const ("Orderings.ord_class.less", _) $ Const ("Groups.zero_class.zero", _) $
|
Walther@60728
|
469 |
(Const ("Num.numeral_class.numeral", _) $ _))] = full_subst
|
Walther@60728
|
470 |
|
Walther@60728
|
471 |
val evals = map (eval ctxt where_rls) full_subst
|
Walther@60763
|
472 |
val return_check_STEP = (foldl and_ (true, map fst evals), pres_subst)
|
Walther@60763
|
473 |
(*\\\\\ \\------------ step into check -------------------------------------------------\\*)
|
Walther@60763
|
474 |
val (preok as true, _) = return_check
|
Walther@60728
|
475 |
|
Walther@60763
|
476 |
(*||||| |------------- contine.. for_problem -------------------------------------------------*)
|
Walther@60763
|
477 |
val false =
|
Walther@60763
|
478 |
(*if*) dI' = ThyC.id_empty andalso dI = ThyC.id_empty (*else*);
|
Walther@60763
|
479 |
val false =
|
Walther@60763
|
480 |
(*if*) pI' = Problem.id_empty andalso pI = Problem.id_empty (*else*);
|
Walther@60763
|
481 |
val NONE =
|
Walther@60776
|
482 |
(*case*) find_first (fn (_, _, _, _, (feedb, _)) => I_Model.is_error feedb) pbl (*of*);
|
Walther@60763
|
483 |
|
Walther@60776
|
484 |
(*case*) item_to_add ctxt oris pbl (*of*);
|
Walther@60776
|
485 |
"~~~~~ fun item_to_add , args:"; val (ctxt, o_model, i_model) = (ctxt, oris, pbl);
|
Walther@60763
|
486 |
|
Walther@60763
|
487 |
(*+*)val "[\n(1, [\"1\", \"2\", \"3\"], #Given, Constants, [\"[r = 7]\"]), \n(2, [\"1\", \"2\", \"3\"], #Find, Maximum, [\"A\"]), \n(3, [\"1\", \"2\", \"3\"], #Find, AdditionalValues, [\"[u]\", \"[v]\"]), \n(4, [\"1\", \"2\", \"3\"], #Relate, Extremum, [\"A = 2 * u * v - u \<up> 2\"]), \n(5, [\"1\", \"2\"], #Relate, SideConditions, [\"[(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]\"]), \n(6, [\"3\"], #Relate, SideConditions, [\"[u / 2 = r * sin \<alpha>]\", \"[2 / v = r * cos \<alpha>]\"]), \n(7, [\"1\"], #undef, FunctionVariable, [\"a\"]), \n(8, [\"2\"], #undef, FunctionVariable, [\"b\"]), \n(9, [\"3\"], #undef, FunctionVariable, [\"\<alpha>\"]), \n(10, [\"1\", \"2\"], #undef, Input_Descript.Domain, [\"{0<..<r}\"]), \n(11, [\"3\"], #undef, Input_Descript.Domain, [\"{0<..<\<pi> / 2}\"]), \n(12, [\"1\", \"2\", \"3\"], #undef, ErrorBound, [\"\<epsilon> = 0\"])]"
|
Walther@60763
|
488 |
= o_model |> O_Model.to_string ctxt
|
Walther@60771
|
489 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T))]"
|
Walther@60771
|
490 |
= i_model |> I_Model.to_string_POS ctxt
|
Walther@60763
|
491 |
|
Walther@60763
|
492 |
val max_vnt as 1= last_elem (*this decides, for which variant initially help is given*)
|
Walther@60763
|
493 |
(Model_Def.max_variants o_model i_model)
|
Walther@60763
|
494 |
val o_vnts = filter (fn (_, vnts, _, _, _) => member op= vnts max_vnt) o_model
|
Walther@60763
|
495 |
(*+*)val "[\n(1, [\"1\", \"2\", \"3\"], #Given, Constants, [\"[r = 7]\"]), \n(2, [\"1\", \"2\", \"3\"], #Find, Maximum, [\"A\"]), \n(3, [\"1\", \"2\", \"3\"], #Find, AdditionalValues, [\"[u]\", \"[v]\"]), \n(4, [\"1\", \"2\", \"3\"], #Relate, Extremum, [\"A = 2 * u * v - u \<up> 2\"]), \n(5, [\"1\", \"2\"], #Relate, SideConditions, [\"[(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]\"]), \n(7, [\"1\"], #undef, FunctionVariable, [\"a\"]), \n(10, [\"1\", \"2\"], #undef, Input_Descript.Domain, [\"{0<..<r}\"]), \n(12, [\"1\", \"2\", \"3\"], #undef, ErrorBound, [\"\<epsilon> = 0\"])]"
|
Walther@60763
|
496 |
= o_vnts |> O_Model.to_string ctxt
|
Walther@60763
|
497 |
|
Walther@60763
|
498 |
val i_to_select = i_model
|
Walther@60771
|
499 |
|> filter_out (fn (_, vnts, _, _, (I_Model.Cor_POS _, _)) => member op= vnts max_vnt | _ => false)
|
Walther@60763
|
500 |
|> select_inc_lists
|
Walther@60763
|
501 |
val true =
|
Walther@60763
|
502 |
(*if*) i_to_select = [] (*then*);
|
Walther@60763
|
503 |
|
Walther@60763
|
504 |
val return_for_problem_STEP = NONE
|
Walther@60763
|
505 |
(*\\\\\ \------------- step into for_problem -----------------------------------------------//*)
|
Walther@60763
|
506 |
val calling_code = return_for_problem;
|
Walther@60763
|
507 |
(*-------------------- stopped after ERROR found ---------------------------------------------*)
|
Walther@60763
|
508 |
|
Walther@60728
|
509 |
(*\\------------------ step into do_next ---------------------------------------------------\\*)
|
Walther@60728
|
510 |
(*\------------------- step into me_Add_Relation_SideConditions ----------------------------//*)
|
Walther@60705
|
511 |
val (p, _, f, nxt, _, pt) = return_me_Add_Relation_SideConditions
|
Walther@60705
|
512 |
val Specify_Theory "Diff_App" = nxt;
|
Walther@60705
|
513 |
|
Walther@60659
|
514 |
val return_me_Specify_Theory
|
Walther@60659
|
515 |
= me nxt p c pt; val Specify_Problem ["univariate_calculus", "Optimisation"] = #4 return_me_Specify_Theory;
|
Walther@60763
|
516 |
(*/------------------- step into me_Specify_Theory -----------------------------------------\\*)
|
Walther@60763
|
517 |
"~~~~~ fun me , args:"; val (tac as Specify_Theory "Diff_App", p, _, pt) = (nxt, p, c, pt);
|
Walther@60728
|
518 |
val ctxt = Ctree.get_ctxt pt p;
|
Walther@60728
|
519 |
(* val (pt, p) = *)
|
Walther@60728
|
520 |
(*case*) Step.by_tactic tac (pt, p) (*of*);
|
Walther@60728
|
521 |
(* ("ok", (_, _, ptp)) => ptp *)
|
Walther@60728
|
522 |
val return_Step_by_tactic =
|
Walther@60728
|
523 |
Step.by_tactic tac (pt, p);
|
Walther@60728
|
524 |
(*//------------------ step into Step_by_tactic --------------------------------------------\\*)
|
Walther@60728
|
525 |
"~~~~~ fun by_tactic , args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, p));
|
Walther@60741
|
526 |
(*case*) Specify_Step.check tac (pt, p) (*of*);
|
Walther@60728
|
527 |
|
Walther@60728
|
528 |
(*||------------------ contine Step_by_tactic ------------------------------------------------*)
|
Walther@60728
|
529 |
(*\\------------------ step into Step_by_tactic --------------------------------------------//*)
|
Walther@60728
|
530 |
|
Walther@60728
|
531 |
val ("ok", (_, _, ptp)) = return_Step_by_tactic;
|
Walther@60728
|
532 |
(*|------------------- continue me Specify_Theory --------------------------------------------*)
|
Walther@60578
|
533 |
|
Walther@60578
|
534 |
val ("ok", (ts as (_, _, _) :: _, _, _)) =
|
Walther@60578
|
535 |
(*case*)
|
Walther@60578
|
536 |
Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
|
Walther@60578
|
537 |
(*//------------------ step into do_next ---------------------------------------------------\\*)
|
Walther@60578
|
538 |
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis))
|
Walther@60578
|
539 |
= (p, ((pt, Pos.e_pos'), [])) (*of*);
|
Walther@60578
|
540 |
(*if*) Pos.on_calc_end ip (*else*);
|
Walther@60578
|
541 |
val (_, probl_id, _) = Calc.references (pt, p);
|
Walther@60578
|
542 |
val _ =
|
Walther@60578
|
543 |
(*case*) tacis (*of*);
|
Walther@60578
|
544 |
(*if*) probl_id = Problem.id_empty (*else*);
|
Walther@60578
|
545 |
|
Walther@60578
|
546 |
Step.switch_specify_solve p_ (pt, ip);
|
Walther@60578
|
547 |
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
|
Walther@60578
|
548 |
(*if*) Pos.on_specification ([], state_pos) (*then*);
|
Walther@60578
|
549 |
|
Walther@60578
|
550 |
Step.specify_do_next (pt, input_pos);
|
Walther@60578
|
551 |
"~~~~~ fun specify_do_next , args:"; val ((ptp as (pt, (p, p_)))) = (pt, input_pos);
|
Walther@60578
|
552 |
val (_, (p_', tac)) = Specify.find_next_step ptp
|
Walther@60578
|
553 |
val ist_ctxt = Ctree.get_loc pt (p, p_);
|
Walther@60578
|
554 |
(*case*) tac (*of*);
|
Walther@60578
|
555 |
|
Walther@60728
|
556 |
Step_Specify.by_tactic_input tac (pt, (p, p_'));
|
Walther@60728
|
557 |
(*+*)val Specify_Theory "Diff_App" = tac;
|
Walther@60728
|
558 |
"~~~~~ fun by_tactic_input , args:"; val ((Tactic.Specify_Theory dI), (pt, pos as (_, Pbl)))
|
Walther@60578
|
559 |
= (tac, (pt, (p, p_')));
|
Walther@60578
|
560 |
val (oris, dI, dI', pI', probl, ctxt) = case get_obj I pt p of
|
Walther@60578
|
561 |
PblObj {origin = (oris, (dI,_,_),_), spec = (dI',pI',_), probl, ctxt, ...} =>
|
Walther@60578
|
562 |
(oris, dI, dI', pI', probl, ctxt)
|
Walther@60676
|
563 |
val thy = ThyC.get_theory ctxt (if dI' = ThyC.id_empty then dI else dI');
|
Walther@60585
|
564 |
val {model, where_, where_rls,...} = Problem.from_store (Ctree.get_ctxt pt pos) pI
|
Walther@60659
|
565 |
(*\\------------------ step into do_next ---------------------------------------------------//*)
|
Walther@60763
|
566 |
(*\------------------- step into me_Specify_Theory -----------------------------------------//*)
|
Walther@60659
|
567 |
val (p,_,f,nxt,_,pt) = return_me_Specify_Theory;
|
Walther@60578
|
568 |
|
Walther@60659
|
569 |
val return_me_Specify_Problem (* keep for continuing me *)
|
Walther@60659
|
570 |
= me nxt p c pt; val Specify_Method ["Optimisation", "by_univariate_calculus"] = #4 return_me_Specify_Problem;
|
Walther@60763
|
571 |
(*/------------------- step into me_Specify_Problem ----------------------------------------\\*)
|
Walther@60659
|
572 |
"~~~~~ fun me , args:"; val (tac, p, _, pt) = (nxt, p, c, pt);
|
Walther@60578
|
573 |
val ctxt = Ctree.get_ctxt pt p
|
Walther@60578
|
574 |
|
Walther@60659
|
575 |
(** ) val ("ok", (_, _, ptp as (pt, p))) =( **)
|
Walther@60659
|
576 |
(**) val return_by_tactic =(**) (*case*)
|
Walther@60578
|
577 |
Step.by_tactic tac (pt, p) (*of*);
|
Walther@60659
|
578 |
(*//------------------ step into by_tactic -------------------------------------------------\\*)
|
Walther@60578
|
579 |
"~~~~~ fun by_tactic , args:"; val (tac, (ptp as (pt, p))) = (tac, (pt, p));
|
Walther@60578
|
580 |
|
Walther@60578
|
581 |
(*case*)
|
Walther@60578
|
582 |
Step.check tac (pt, p) (*of*);
|
Walther@60578
|
583 |
"~~~~~ fun check , args:"; val (tac, (ctree, pos)) = (tac, (pt, p));
|
Walther@60578
|
584 |
(*if*) Tactic.for_specify tac (*then*);
|
Walther@60578
|
585 |
|
Walther@60578
|
586 |
Specify_Step.check tac (ctree, pos);
|
Walther@60578
|
587 |
"~~~~~ fun check , args:"; val ((Tactic.Specify_Problem pID), (pt, pos as (p, _)))
|
Walther@60578
|
588 |
= (tac, (ctree, pos));
|
Walther@60578
|
589 |
val (oris, dI, pI, dI', pI', itms) = case Ctree.get_obj I pt p of
|
Walther@60578
|
590 |
Ctree.PblObj {origin = (oris, (dI, pI, _), _), spec = (dI', pI', _), probl = itms, ...}
|
Walther@60578
|
591 |
=> (oris, dI, pI, dI', pI', itms)
|
Walther@60676
|
592 |
val thy = ThyC.get_theory ctxt (if dI' = ThyC.id_empty then dI else dI');
|
Walther@60659
|
593 |
(*\\------------------ step into by_tactic -------------------------------------------------//*)
|
Walther@60659
|
594 |
val ("ok", (_, _, ptp as (pt, p))) = return_by_tactic (* kept for continuing me *);
|
Walther@60578
|
595 |
|
Walther@60578
|
596 |
(*case*)
|
Walther@60578
|
597 |
Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
|
Walther@60578
|
598 |
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = (p, ((pt, Pos.e_pos'), []));
|
Walther@60578
|
599 |
(*if*) Pos.on_calc_end ip (*else*);
|
Walther@60578
|
600 |
val (_, probl_id, _) = Calc.references (pt, p);
|
Walther@60578
|
601 |
val _ =
|
Walther@60578
|
602 |
(*case*) tacis (*of*);
|
Walther@60578
|
603 |
(*if*) probl_id = Problem.id_empty (*else*);
|
Walther@60578
|
604 |
|
Walther@60578
|
605 |
Step.switch_specify_solve p_ (pt, ip);
|
Walther@60578
|
606 |
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
|
Walther@60578
|
607 |
(*if*) Pos.on_specification ([], state_pos) (*then*);
|
Walther@60578
|
608 |
|
Walther@60578
|
609 |
Step.specify_do_next (pt, input_pos);
|
Walther@60578
|
610 |
"~~~~~ fun specify_do_next , args:"; val ((ptp as (pt, (p, p_)))) = ((pt, input_pos));
|
Walther@60578
|
611 |
val (_, (p_', tac)) = Specify.find_next_step ptp
|
Walther@60578
|
612 |
val ist_ctxt = Ctree.get_loc pt (p, p_)
|
Walther@60578
|
613 |
val _ =
|
Walther@60578
|
614 |
(*case*) tac (*of*);
|
Walther@60578
|
615 |
|
Walther@60578
|
616 |
Step_Specify.by_tactic_input tac (pt, (p, p_'));
|
Walther@60578
|
617 |
"~~~~~ fun by_tactic_input , args:"; val ((Tactic.Specify_Method id), (pt, pos))
|
Walther@60578
|
618 |
= (tac, (pt, (p, p_')));
|
Walther@60578
|
619 |
|
Walther@60760
|
620 |
(**)val return_complete_for =(**)
|
Walther@60760
|
621 |
(** ) val (o_model, ctxt, i_model) =( **)
|
Walther@60578
|
622 |
Specify_Step.complete_for id (pt, pos);
|
Walther@60760
|
623 |
(*//------------------ step into complete_for ----------------------------------------------\\*)
|
Walther@60578
|
624 |
"~~~~~ fun complete_for , args:"; val (mID, (ctree, pos)) = (id, (pt, pos));
|
Walther@60763
|
625 |
|
Walther@60763
|
626 |
(*+*)val ["Optimisation", "by_univariate_calculus"] = mID
|
Walther@60763
|
627 |
val {origin = (o_model, o_refs, _), spec = refs, probl = i_prob, meth = met_imod, ctxt,
|
Walther@60578
|
628 |
...} = Calc.specify_data (ctree, pos);
|
Walther@60578
|
629 |
val ctxt = Ctree.get_ctxt ctree pos
|
Walther@60578
|
630 |
val (dI, _, _) = References.select_input o_refs refs;
|
Walther@60586
|
631 |
val {model = m_patt, where_, where_rls, ...} = MethodC.from_store ctxt mID
|
Walther@60578
|
632 |
val {origin = (root_model, _, _), ...} = Calc.specify_data (ctree, ([], Pos.Und))
|
Walther@60578
|
633 |
val (o_model', ctxt') = O_Model.complete_for m_patt root_model (o_model, ctxt)
|
Walther@60760
|
634 |
|
Walther@60760
|
635 |
(**)val return_match_itms_oris = (**)
|
Walther@60760
|
636 |
(** )val (_, (i_model, _)) = ( **)
|
Walther@60771
|
637 |
M_Match.by_i_models ctxt o_model' (I_Model.OLD_to_POS i_prob, I_Model.OLD_to_POS i_prob)
|
Walther@60760
|
638 |
(m_patt, where_, where_rls);
|
Walther@60769
|
639 |
(*///----------------- step into by_i_models -------------------------------------------\\*)
|
Walther@60769
|
640 |
"~~~~~ fun by_i_models, args:"; val (ctxt, o_model, (pbl_imod, met_imod), (m_patt, where_, where_rls)) =
|
Walther@60771
|
641 |
(ctxt, o_model', (I_Model.OLD_to_POS i_prob, I_Model.OLD_to_POS i_prob), (m_patt, where_, where_rls));
|
Walther@60760
|
642 |
|
Walther@60760
|
643 |
(**)val return_fill_method =(**)
|
Walther@60760
|
644 |
(** )val met_imod =( **)
|
Walther@60760
|
645 |
fill_method o_model (pbl_imod, met_imod) m_patt;
|
Walther@60760
|
646 |
(*////--------------- step into fill_method -----------------------------------------------\\*)
|
Walther@60760
|
647 |
"~~~~~ fun fill_method , args:"; val (o_model, (pbl_imod, met_imod), met_patt) =
|
Walther@60760
|
648 |
(o_model, (pbl_imod, met_imod), m_patt);
|
Walther@60760
|
649 |
|
Walther@60771
|
650 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T))]"
|
Walther@60771
|
651 |
= pbl_imod |> I_Model.to_string_POS ctxt
|
Walther@60771
|
652 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T))]"
|
Walther@60771
|
653 |
= met_imod |> I_Model.to_string_POS ctxt
|
Walther@60763
|
654 |
|
Walther@60763
|
655 |
(**)val return_max_variants =(**)
|
Walther@60763
|
656 |
(** )val pbl_max_vnts as [2, 1] =( **)
|
Walther@60763
|
657 |
Model_Def.max_variants o_model pbl_imod;
|
Walther@60763
|
658 |
(*//------------------ step into max_variants ----------------------------------------------\\*)
|
Walther@60763
|
659 |
"~~~~~ fun max_variants , args:"; val (o_model, i_model) = (o_model, pbl_imod);
|
Walther@60763
|
660 |
val all_variants as [1, 2, 3] =
|
Walther@60763
|
661 |
map (fn (_, variants, _, _, _) => variants) i_model
|
Walther@60763
|
662 |
|> flat
|
Walther@60763
|
663 |
|> distinct op =
|
Walther@60763
|
664 |
val variants_separated = map (filter_variants' i_model) all_variants
|
Walther@60771
|
665 |
(*+*)val ["[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T))]",
|
Walther@60771
|
666 |
"[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T))]",
|
Walther@60771
|
667 |
"[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T))]"]
|
Walther@60771
|
668 |
= variants_separated |> map (I_Model.to_string_POS ctxt)
|
Walther@60763
|
669 |
|
Walther@60763
|
670 |
val sums_corr as [5, 5, 4] = map (cnt_corrects) variants_separated
|
Walther@60763
|
671 |
(*----------------#--#--#*)
|
Walther@60763
|
672 |
(*---------------------^-------^-------^*)
|
Walther@60763
|
673 |
val sum_variant_s as [(5, 1), (5, 2), (4, 3)] = arrange_args sums_corr (1, all_variants)
|
Walther@60763
|
674 |
val max_first as [(5, 2), (5, 1), (4, 3)] = rev (sort (fn ((i, _), (j, _)) => int_ord (i, j)) sum_variant_s)
|
Walther@60763
|
675 |
(*----------------##====--##====--//////---------^^^^*)
|
Walther@60763
|
676 |
(*------------^--^-#-------#*)
|
Walther@60763
|
677 |
val maxes as [2, 1] = filter (fn (cnt, _) => curry op = (fst (hd max_first)) cnt) max_first
|
Walther@60763
|
678 |
|> map snd
|
Walther@60763
|
679 |
val return_max_variants = maxes
|
Walther@60763
|
680 |
(*\\------------------ step into max_variants ----------------------------------------------//*)
|
Walther@60763
|
681 |
val pbl_max_vnts as [2, 1] = return_max_variants;
|
Walther@60760
|
682 |
|
Walther@60760
|
683 |
(*probably pbl/met_imod = [], so take met_patt; if empty return Sup*)
|
Walther@60760
|
684 |
val i_from_met = map (fn (_, (descr, _)) => (*order from met_patt*)
|
Walther@60760
|
685 |
Pre_Conds.get_descr_vnt descr pbl_max_vnts met_imod) met_patt (*\<longrightarrow> right order for args*)
|
Walther@60771
|
686 |
(*+MET: Sup..*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60771
|
687 |
= i_from_met |> I_Model.to_string_POS ctxt
|
Walther@60760
|
688 |
|
Walther@60760
|
689 |
val met_max_vnts as [2, 1] = Model_Def.max_variants o_model i_from_met;
|
Walther@60760
|
690 |
val max_vnt as 2 = hd (inter op= pbl_max_vnts met_max_vnts);
|
Walther@60760
|
691 |
(*add items from pbl_imod (without overwriting existing items in met_imod)*)
|
Walther@60760
|
692 |
|
Walther@60763
|
693 |
val return_add_other = map (
|
Walther@60760
|
694 |
add_other max_vnt pbl_imod) i_from_met;
|
Walther@60771
|
695 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60771
|
696 |
= return_add_other |> I_Model.to_string_POS ctxt;
|
Walther@60760
|
697 |
(*/////-------------- step into add_other -------------------------------------------------\\*)
|
Walther@60771
|
698 |
"~~~~~ fun add_other_5 , args:"; val (max_vnt, i1_model, (i2, _, bool2, m_field2, (Sup_POS (descr2, ts2), pos2))) =
|
Walther@60760
|
699 |
(max_vnt, pbl_imod, nth 5 i_from_met);
|
Walther@60763
|
700 |
|
Walther@60760
|
701 |
(*+*)val Const ("Input_Descript.FunctionVariable", _) = descr2;
|
Walther@60760
|
702 |
|
Walther@60771
|
703 |
val (_, vnts1, _, _, (feedb1, _)) = (i2, [], bool2, m_field2, (Sup_POS (descr2, ts2), pos2))
|
Walther@60760
|
704 |
val SOME (descr1 as (Const ("Input_Descript.FunctionVariable", _)) ) =
|
Walther@60767
|
705 |
get_dscr_opt feedb1
|
Walther@60760
|
706 |
val true =
|
Walther@60760
|
707 |
descr1 = descr2
|
Walther@60760
|
708 |
val true =
|
Walther@60760
|
709 |
Model_Def.member_vnt vnts1 max_vnt
|
Walther@60760
|
710 |
val NONE =
|
Walther@60767
|
711 |
find_first (fn (_, vnts1, _, _, (feedb1, _)) => case get_dscr_opt feedb1 of
|
Walther@60760
|
712 |
NONE => false
|
Walther@60760
|
713 |
| SOME descr1 => descr1 = descr2 andalso Model_Def.member_vnt vnts1 max_vnt) i1_model
|
Walther@60760
|
714 |
|
Walther@60771
|
715 |
val return_add_other_1 = (i2, [max_vnt], bool2, m_field2, (Sup_POS (descr2, ts2), pos2))
|
Walther@60760
|
716 |
val check as true = return_add_other_1 = nth 5 return_add_other
|
Walther@60760
|
717 |
(*\\\\\-------------- step into add_other -------------------------------------------------//*)
|
Walther@60760
|
718 |
val i_from_pbl = return_add_other
|
Walther@60760
|
719 |
(*\\\\---------------- step into fill_method -----------------------------------------------//*)
|
Walther@60760
|
720 |
val return_fill_method_step = filter (fn (_, vnts', _, _, _) => member op = vnts' max_vnt) i_from_met
|
Walther@60760
|
721 |
|
Walther@60771
|
722 |
(*+MET: dropped ALL DUE TO is_empty_single_POS*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]" =
|
Walther@60771
|
723 |
return_fill_method_step |> I_Model.to_string_POS ctxt
|
Walther@60771
|
724 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60771
|
725 |
= return_fill_method |> I_Model.to_string_POS ctxt;
|
Walther@60760
|
726 |
return_fill_method_step = return_fill_method; (*latter is correct, did not investigate further*)
|
Walther@60769
|
727 |
(*\\\----------------- step into by_i_models -------------------------------------------//*)
|
Walther@60760
|
728 |
val (_, (i_model, _)) = return_match_itms_oris;
|
Walther@60760
|
729 |
|
Walther@60760
|
730 |
(*||------------------ continue. complete_for ------------------------------------------------*)
|
Walther@60760
|
731 |
val (o_model, ctxt, i_model) = return_complete_for
|
Walther@60771
|
732 |
(*+isa*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60771
|
733 |
= i_model |> I_Model.to_string_POS ctxt(*+isa*)
|
Walther@60760
|
734 |
(*+isa2:MET.Mis* ) val "[\n(1 ,[1, 2, 3] ,true ,#Given ,Cor Constants [r = 7] , pen2str), \n(2 ,[1, 2, 3] ,true ,#Find ,Cor Maximum A , pen2str), \n(3 ,[1, 2, 3] ,true ,#Find ,Cor AdditionalValues [u, v] , pen2str), \n(4 ,[1, 2, 3] ,true ,#Relate ,Cor Extremum (A = 2 * u * v - u \<up> 2) , pen2str), \n(5 ,[1, 2] ,true ,#Relate ,Cor SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str), \n(7 ,[1] ,false ,#Given ,Mis FunctionVariable funvar), \n(10 ,[1, 2] ,false ,#Given ,Mis Input_Descript.Domain doma), \n(12 ,[1, 2, 3] ,false ,#Given ,Mis ErrorBound err)]" =
|
Walther@60763
|
735 |
i_model |> I_Model.to_string ctxt ( *+isa2*)
|
Walther@60760
|
736 |
(*\\------------------ step into complete_for ----------------------------------------------//*)
|
Walther@60760
|
737 |
val (o_model, ctxt, i_model) = return_complete_for
|
Walther@60760
|
738 |
|
Walther@60760
|
739 |
(*|------------------- continue. complete_for ------------------------------------------------*)
|
Walther@60760
|
740 |
val return_complete_for_step = (o_model', ctxt', i_model)
|
Walther@60760
|
741 |
|
Walther@60760
|
742 |
val (o_model'_step, i_model_step) = (#1 return_complete_for_step, #3 return_complete_for_step)
|
Walther@60760
|
743 |
val (o_model', i_model) = (#1 return_complete_for, #3 return_complete_for)
|
Walther@60760
|
744 |
;
|
Walther@60763
|
745 |
(*+*)if (o_model'_step, i_model_step) = (o_model', i_model)
|
Walther@60763
|
746 |
(*+*)then () else error "return_complete_for_step <> return_complete_for";
|
Walther@60659
|
747 |
(*\------------------- step into me Specify_Problem ----------------------------------------//*)
|
Walther@60659
|
748 |
val (p,_,f,nxt,_,pt) = return_me_Specify_Problem
|
Walther@60578
|
749 |
|
Walther@60760
|
750 |
val return_me_Specify_Method
|
Walther@60763
|
751 |
= me nxt p c pt; val Add_Given "FunctionVariable a" = #4 return_me_Specify_Method;
|
Walther@60760
|
752 |
(*/------------------- step into me_Specify_Method -----------------------------------------\\*)
|
Walther@60659
|
753 |
"~~~~~ fun me , args:"; val (tac, p, _, pt) = (nxt, p, c, pt);
|
Walther@60760
|
754 |
|
Walther@60778
|
755 |
(*+*)val "[]" =(*+*) get_obj g_met pt (fst p) |> I_Model.OLD_to_POS |> I_Model.to_string_POS ctxt
|
Walther@60760
|
756 |
|
Walther@60578
|
757 |
val ctxt = Ctree.get_ctxt pt p
|
Walther@60578
|
758 |
val (pt, p) =
|
Walther@60578
|
759 |
case Step.by_tactic tac (pt, p) of
|
Walther@60578
|
760 |
("ok", (_, _, ptp)) => ptp;
|
Walther@60578
|
761 |
|
Walther@60760
|
762 |
(*quick step into --> me_Specify_Method*)
|
Walther@60760
|
763 |
(*+*)val Specify_Method ["Optimisation", "by_univariate_calculus"] = tac;
|
Walther@60760
|
764 |
(* Step.by_tactic*)
|
Walther@60760
|
765 |
"~~~~~ fun by_tactic , args:"; val () = ();
|
Walther@60760
|
766 |
(* Step.check*)
|
Walther@60760
|
767 |
"~~~~~ fun check , args:"; val () = ();
|
Walther@60760
|
768 |
(*Specify_Step.check (Tactic.Specify_Method*)
|
Walther@60760
|
769 |
"~~~~~ fun check , args:"; val () = ();
|
Walther@60760
|
770 |
(*Specify_Step.complete_for*)
|
Walther@60760
|
771 |
"~~~~~ fun complete_for , args:"; val () = ();
|
Walther@60769
|
772 |
(* M_Match.by_i_models*)
|
Walther@60769
|
773 |
"~~~~~ fun by_i_models , args:"; val () = ();
|
Walther@60760
|
774 |
|
Walther@60778
|
775 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60778
|
776 |
= get_obj g_met pt (fst p) |> I_Model.OLD_to_POS |> I_Model.to_string_POS ctxt;
|
Walther@60763
|
777 |
|
Walther@60578
|
778 |
(*case*)
|
Walther@60578
|
779 |
Step.do_next p ((pt, Pos.e_pos'), []) (*of*);
|
Walther@60760
|
780 |
(*//------------------ step into Step.do_next ----------------------------------------------\\*)
|
Walther@60578
|
781 |
"~~~~~ fun do_next , args:"; val ((ip as (_, p_)), (ptp as (pt, p), tacis)) = (p, ((pt, Pos.e_pos'), []));
|
Walther@60578
|
782 |
(*if*) Pos.on_calc_end ip (*else*);
|
Walther@60578
|
783 |
val (_, probl_id, _) = Calc.references (pt, p);
|
Walther@60578
|
784 |
val _ =
|
Walther@60578
|
785 |
(*case*) tacis (*of*);
|
Walther@60578
|
786 |
(*if*) probl_id = Problem.id_empty (*else*);
|
Walther@60578
|
787 |
|
Walther@60578
|
788 |
Step.switch_specify_solve p_ (pt, ip);
|
Walther@60760
|
789 |
(*///----------------- step into Step.switch_specify_solve ---------------------------------\\*)
|
Walther@60578
|
790 |
"~~~~~ fun switch_specify_solve , args:"; val (state_pos, (pt, input_pos)) = (p_, (pt, ip));
|
Walther@60578
|
791 |
(*if*) Pos.on_specification ([], state_pos) (*then*);
|
Walther@60578
|
792 |
|
Walther@60578
|
793 |
Step.specify_do_next (pt, input_pos);
|
Walther@60760
|
794 |
(*////---------------- step into Step.specify_do_next --------------------------------------\\*)
|
Walther@60578
|
795 |
"~~~~~ fun specify_do_next , args:"; val ((ptp as (pt, (p, p_)))) = (pt, input_pos);
|
Walther@60578
|
796 |
|
Walther@60578
|
797 |
val (_, (p_', tac)) =
|
Walther@60578
|
798 |
Specify.find_next_step ptp;
|
Walther@60763
|
799 |
(*/////--------------- step into find_next_step --------------------------------------------\\*)
|
Walther@60578
|
800 |
"~~~~~ fun find_next_step , args:"; val ((pt, pos as (_, p_))) = (ptp);
|
Walther@60578
|
801 |
val {meth = met, origin = origin as (oris, o_refs as (_, pI', mI'), _), probl = pbl,
|
Walther@60578
|
802 |
spec = refs, ...} = Calc.specify_data (pt, pos);
|
Walther@60578
|
803 |
val ctxt = Ctree.get_ctxt pt pos;
|
Walther@60578
|
804 |
(*if*) Ctree.just_created (pt, pos) andalso origin <> Ctree.e_origin (*else*);
|
Walther@60578
|
805 |
(*if*) p_ = Pos.Pbl (*else*);
|
Walther@60578
|
806 |
|
Walther@60778
|
807 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60778
|
808 |
= met |> I_Model.OLD_to_POS |> I_Model.to_string_POS ctxt
|
Walther@60760
|
809 |
|
Walther@60763
|
810 |
(**)val ("dummy", (Met, Add_Given "FunctionVariable a")) =(**)
|
Walther@60776
|
811 |
Specify.for_method ctxt oris (o_refs, refs) (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met);
|
Walther@60760
|
812 |
(*///// /------------- step into Step.for_method -------------------------------------------\\*)
|
Walther@60730
|
813 |
"~~~~~ fun for_method , args:"; val (ctxt, oris, ((dI', pI', mI'), (dI, pI, mI)), (_, met))
|
Walther@60776
|
814 |
= (ctxt, oris, (o_refs, refs), (I_Model.OLD_to_POS pbl, I_Model.OLD_to_POS met));
|
Walther@60578
|
815 |
val cmI = if mI = MethodC.id_empty then mI' else mI;
|
Walther@60730
|
816 |
val {model, where_rls, where_, ...} = MethodC.from_store ctxt cmI; (*..MethodC ?*)
|
Walther@60776
|
817 |
val (preok, _) = Pre_Conds.check ctxt where_rls where_ (model, met);
|
Walther@60578
|
818 |
val NONE =
|
Walther@60776
|
819 |
(*case*) find_first (I_Model.is_error o #1 o #5) met (*of*);
|
Walther@60578
|
820 |
|
Walther@60763
|
821 |
(** )SOME (fd, ct') =( **)
|
Walther@60763
|
822 |
(**)val return_item_to_add =(**)
|
Walther@60578
|
823 |
(*case*)
|
Walther@60776
|
824 |
Specify.item_to_add ctxt oris met (*of*);
|
Walther@60763
|
825 |
(*///// //------------ step into item_to_add -----------------------------------------------\\*)
|
Walther@60776
|
826 |
"~~~~~ fun item_to_add , args:"; val (ctxt, o_model, i_model) = (ctxt, oris, met);
|
Walther@60763
|
827 |
(*+*)val "[\n(1, [\"1\", \"2\", \"3\"], #Given, Constants, [\"[r = 7]\"]), \n(2, [\"1\", \"2\", \"3\"], #Given, Maximum, [\"A\"]), \n(3, [\"1\", \"2\", \"3\"], #Find, AdditionalValues, [\"[u]\", \"[v]\"]), \n(4, [\"1\", \"2\", \"3\"], #Given, Extremum, [\"A = 2 * u * v - u \<up> 2\"]), \n(5, [\"1\", \"2\"], #Given, SideConditions, [\"[(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]\"]), \n(6, [\"3\"], #Given, SideConditions, [\"[u / 2 = r * sin \<alpha>]\", \"[2 / v = r * cos \<alpha>]\"]), \n(7, [\"1\"], #Given, FunctionVariable, [\"a\"]), \n(8, [\"2\"], #Given, FunctionVariable, [\"b\"]), \n(9, [\"3\"], #Given, FunctionVariable, [\"\<alpha>\"]), \n(10, [\"1\", \"2\"], #Given, Input_Descript.Domain, [\"{0<..<r}\"]), \n(11, [\"3\"], #Given, Input_Descript.Domain, [\"{0<..<\<pi> / 2}\"]), \n(12, [\"1\", \"2\", \"3\"], #Given, ErrorBound, [\"\<epsilon> = 0\"])]"
|
Walther@60763
|
828 |
= oris |> O_Model.to_string ctxt
|
Walther@60771
|
829 |
(*+*)val "[\n(1, [1, 2, 3], true ,#Given, (Cor_POS Constants [r = 7] , pen2str, Position.T)), \n(2, [1, 2, 3], true ,#Find, (Cor_POS Maximum A , pen2str, Position.T)), \n(4, [1, 2, 3], true ,#Relate, (Cor_POS Extremum (A = 2 * u * v - u \<up> 2) , pen2str, Position.T)), \n(5, [1, 2], true ,#Relate, (Cor_POS SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2] , pen2str, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T)), \n(3, [1, 2, 3], true ,#Find, (Cor_POS AdditionalValues [u, v] , pen2str, Position.T))]"
|
Walther@60771
|
830 |
= i_model |> I_Model.to_string_POS ctxt
|
Walther@60763
|
831 |
|
Walther@60763
|
832 |
val max_vnt = last_elem (*this decides, for which variant initially help is given*)
|
Walther@60763
|
833 |
(Model_Def.max_variants o_model i_model)
|
Walther@60763
|
834 |
val o_vnts = filter (fn (_, vnts, _, _, _) => member op= vnts max_vnt) o_model
|
Walther@60763
|
835 |
val i_to_select = i_model
|
Walther@60771
|
836 |
|> filter_out (fn (_, vnts, _, _, (I_Model.Cor_POS _, _)) => member op= vnts max_vnt | _ => false)
|
Walther@60763
|
837 |
|> select_inc_lists
|
Walther@60771
|
838 |
(*+*)val "[\n(0, [2], false ,i_model_empty, (Sup_POS FunctionVariable, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS Input_Descript.Domain, Position.T)), \n(0, [2], false ,i_model_empty, (Sup_POS ErrorBound, Position.T))]"
|
Walther@60771
|
839 |
= i_to_select |> I_Model.to_string_POS ctxt
|
Walther@60763
|
840 |
|
Walther@60763
|
841 |
val false =
|
Walther@60763
|
842 |
(*if*) i_to_select = [] (*else*);
|
Walther@60763
|
843 |
|
Walther@60763
|
844 |
(** )val SOME (_, _, _, m_field, (feedb, _)) =( **)
|
Walther@60763
|
845 |
(**)val return_fill_from_o = (**)
|
Walther@60763
|
846 |
(*case*) I_Model.fill_from_o o_vnts (hd i_to_select) (*of*);
|
Walther@60763
|
847 |
(*///// ///----------- step into fill_from_o -----------------------------------------------\\*)
|
Walther@60763
|
848 |
"~~~~~ fun fill_from_o , args:"; val (o_model, (i, vnts, bool, _, (feedb, pos))) =
|
Walther@60763
|
849 |
(o_vnts, (hd i_to_select));
|
Walther@60763
|
850 |
val (m_field, all_value) =
|
Walther@60767
|
851 |
case find_first (fn (_, _, _, descr', _) => Model_Def.descriptor_exists descr' feedb) o_model of
|
Walther@60763
|
852 |
SOME (_, _, m_field, _, ts) => (m_field, ts)
|
Walther@60767
|
853 |
val descr = Model_Def.get_descr feedb (*i_single has been filtered appropriately*)
|
Walther@60763
|
854 |
val false =
|
Walther@60766
|
855 |
(*if*) Model_Def.is_list_descr descr (*else*);
|
Walther@60771
|
856 |
val return_fill_from_o_STEP = SOME (i, vnts, bool, m_field, (Cor_POS (descr, all_value), pos))
|
Walther@60763
|
857 |
(*-------------------- stopped after ERROR found ---------------------------------------------*)
|
Walther@60763
|
858 |
(*\\\\\ \\\----------- step into fill_from_o -----------------------------------------------//*)
|
Walther@60763
|
859 |
val SOME (_, _, _, m_field, (feedb, _)) = return_fill_from_o
|
Walther@60763
|
860 |
|
Walther@60763
|
861 |
(*||||| ||------------ step into item_to_add -----------------------------------------------//*)
|
Walther@60763
|
862 |
(*\\\\\ \\\----------- step into item_to_add -----------------------------------------------//*)
|
Walther@60763
|
863 |
val return_item_to_add_STEP as SOME ("#Given", "FunctionVariable a") =
|
Walther@60763
|
864 |
SOME (m_field, feedb |> I_Model.feedb_args_to_string ctxt)
|
Walther@60763
|
865 |
(*\\\\\ \\------------ step into item_to_add -----------------------------------------------//*)
|
Walther@60763
|
866 |
val SOME (fd, ct') = return_item_to_add;
|
Walther@60763
|
867 |
(*||||| |------------- contine.. Step.for_method ---------------------------------------------*)
|
Walther@60763
|
868 |
val return_for_method_STEP = ("dummy", (Pos.Met, P_Model.mk_additem fd ct'))
|
Walther@60763
|
869 |
|
Walther@60763
|
870 |
(*\\\\\ \------------- step into Step.for_method -------------------------------------------//*)
|
Walther@60760
|
871 |
(*\------------------- step into me_Specify_Method -----------------------------------------//*)
|
Walther@60578
|
872 |
|
Walther@60763
|
873 |
val (p,_,f,nxt,_,pt) = return_me_Specify_Method;
|
Walther@60763
|
874 |
val Add_Given "FunctionVariable a" = nxt;
|
Walther@60766
|
875 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "Input_Descript.Domain {0<..<r}" = nxt
|
Walther@60578
|
876 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; val Add_Given "ErrorBound (\<epsilon> = 0)" = nxt;
|
Walther@60763
|
877 |
(*ErRoR type_of: type mismatch in application, bool, bool list, (#) [r = 7] --> 200a-start-method
|
Walther@60763
|
878 |
val (p,_,f,nxt,_,pt) = me nxt p c pt; val Apply_Method xxx = nxt
|
Walther@60763
|
879 |
*)
|