Walther@60491
|
1 |
theory Test_VSCode_Example
|
Walther@60686
|
2 |
imports "Isac.Build_Isac" (*"Isac.Calculation"*)
|
Walther@60690
|
3 |
keywords "Example_TEST" :: thy_decl
|
Walther@60600
|
4 |
begin
|
Walther@60491
|
5 |
|
Walther@60686
|
6 |
text \<open>
|
Walther@60686
|
7 |
Tests here in BridgePIDE are already based on Build_Isac.thy bypassing $ISABELLE_ISAC_TEST.
|
Walther@60686
|
8 |
TODO: eliminate "Isac." above on eliminating session in $ISABELLE_ISAC_TEST.
|
Walther@60686
|
9 |
\<close>
|
Walther@60686
|
10 |
|
Walther@60686
|
11 |
subsection \<open>Development\<close>
|
Walther@60686
|
12 |
text \<open>
|
Walther@60697
|
13 |
Here we develop the semantics of \<open>Example_TEST\<close> as test
|
Walther@60697
|
14 |
--- build Outer_Syntax Example_TEST n:
|
Walther@60697
|
15 |
and save intermediate states as separate tests in test/../preliminary.sml
|
Walther@60697
|
16 |
as soon as some stable state is achieved.
|
Walther@60697
|
17 |
|
Walther@60697
|
18 |
This way we make all \<open>Example\<close> to \<open>Example_TEST\<close> step by step
|
Walther@60697
|
19 |
and finally rename all again to \<open>Example\<close>.
|
Walther@60697
|
20 |
\<close> ML \<open>
|
Walther@60697
|
21 |
val ((in_thy, thy_id_pos), (in_pbl, probl_id_pos), (in_met, meth_id_pos)) =
|
Walther@60697
|
22 |
(("__", Position.none), ( "__/__", Position.none), ("__/__", Position.none))
|
Walther@60697
|
23 |
val in_ = (in_thy, in_pbl, in_met)
|
Walther@60697
|
24 |
val spec_ as (spec_thy, spec_pbl, spec_met) = References.empty
|
Walther@60697
|
25 |
val o_ as (o_thy, o_pbl, o_met) =
|
Walther@60697
|
26 |
("Diff_App", ["univariate_calculus", "Optimisation"], ["Optimisation", "by_univariate_calculus"])
|
Walther@60697
|
27 |
\<close> ML \<open>
|
Walther@60687
|
28 |
\<close> ML \<open> (** preliminary handling of References **)
|
Walther@60687
|
29 |
\<close> ML \<open> (* assumption: we read the Specfication as a whole *)
|
Walther@60698
|
30 |
(*/-------------------- state of src/../preliminary.sml at that time -------------------------\*)
|
Walther@60687
|
31 |
fun re_eval_all ((*dummyarg*)) = ("re_eval_all if new_thy"; ((*dummyarg*)))
|
Walther@60687
|
32 |
fun re_eval_pbl ((*dummyarg*)) = ("re_eval_pbl"; ((*dummyarg*)))
|
Walther@60687
|
33 |
fun re_eval_met ((*dummyarg*)) = ("re_eval_met"; ((*dummyarg*)))
|
Walther@60687
|
34 |
;
|
Walther@60697
|
35 |
re_eval_all: unit -> unit;
|
Walther@60687
|
36 |
(*
|
Walther@60687
|
37 |
switch_pbl_met IS MISSING! Greater changes are to expect with respective introduction.
|
Walther@60687
|
38 |
In the meanwhile we just \<open>re_eval\<close> the \<open>I_Model\<close> of \<open>Problem\<close>;
|
Walther@60687
|
39 |
in case this is complete, we automatically complete the \<open>I_Model\<close> of \<open>MethodC\<close>
|
Walther@60687
|
40 |
without displaying the respective \<open>P_Model\<close> and immediately start solve-phase by \<open>Apply_Method\<close>;
|
Walther@60687
|
41 |
*)
|
Walther@60687
|
42 |
fun re_eval (input_thy, input_pbl, input_met) (spec_thy, spec_pbl, spec_met) =
|
Walther@60687
|
43 |
if spec_thy <> input_thy
|
Walther@60687
|
44 |
then re_eval_all ()
|
Walther@60687
|
45 |
else if spec_pbl <> input_pbl
|
Walther@60687
|
46 |
then re_eval_pbl ()
|
Walther@60687
|
47 |
else if spec_met <> input_met
|
Walther@60687
|
48 |
then re_eval_met ()
|
Walther@60687
|
49 |
else ("nothing to re-evaluate"; ((*dummyarg*)))
|
Walther@60687
|
50 |
;
|
Walther@60705
|
51 |
re_eval: References.T -> References.T -> unit;
|
Walther@60698
|
52 |
(*\-------------------- state of src/../preliminary.sml at that time -------------------------/*)
|
Walther@60705
|
53 |
\<close> ML \<open> (*for building code copy here
|
Walther@60705
|
54 |
calculation.sml --- build Outer_Syntax Example_TEST 3 ff*)
|
Walther@60687
|
55 |
\<close> ML \<open>
|
Walther@60692
|
56 |
\<close> ML \<open>
|
Walther@60686
|
57 |
val _ =
|
Walther@60690
|
58 |
Outer_Syntax.command \<^command_keyword>\<open>Example_TEST\<close>
|
Walther@60686
|
59 |
"prepare ISAC problem type and register it to Knowledge Store"
|
Walther@60686
|
60 |
(Parse.name -- Parse.!!! ( \<^keyword>\<open>Specification\<close> -- \<^keyword>\<open>:\<close> --
|
Walther@60686
|
61 |
\<^keyword>\<open>Model\<close> -- \<^keyword>\<open>:\<close> |-- Problem.parse_pos_model_input --
|
Walther@60686
|
62 |
(\<^keyword>\<open>References\<close> -- \<^keyword>\<open>:\<close> |-- Parse.!!! References.parse_input_pos
|
Walther@60686
|
63 |
(** )-- ( \<^keyword>\<open>Solution\<close> -- keyword>\<open>:\<close>)( ** )WHAT IS WRONG HEREWITH?( **)) ) >>
|
Walther@60686
|
64 |
(fn (example_id, (model_input,
|
Walther@60687
|
65 |
((thy_id, thy_id_pos), ((probl_id, probl_id_pos), (meth_id, meth_id_pos)) ) )) =>
|
Walther@60686
|
66 |
Toplevel.theory (fn thy =>
|
Walther@60686
|
67 |
let
|
Walther@60688
|
68 |
val state =
|
Walther@60688
|
69 |
case the_data thy of
|
Walther@60704
|
70 |
CTbasic_TEST.EmptyPtree => Preliminary.init_ctree thy example_id
|
Walther@60704
|
71 |
| state =>
|
Walther@60688
|
72 |
let
|
Walther@60704
|
73 |
val {origin = (o_model, o_ref, _), spec = spec_ref, probl, meth, ctxt, ...} =
|
Walther@60705
|
74 |
CTbasic_TEST.get_obj I state [(*Pos todo*)] |> CTbasic_TEST.rep_specify_data
|
Walther@60688
|
75 |
val thy_id' = References.for_parse thy_id (#1 spec_ref) (#1 o_ref)
|
Walther@60704
|
76 |
val (model, where_) = Model_Pattern.parse_pos_empty ctxt model_input (*+check syntax*)
|
Walther@60705
|
77 |
(*reminder for Template.show ----------------------------------------------------------------\*)
|
Walther@60705
|
78 |
val ((_, _, _), (_, pbl_id as ["univariate_calculus", "Optimisation"], _)) =
|
Walther@60705
|
79 |
References.for_eval_model (thy_id, probl_id, meth_id) spec_ref o_ref
|
Walther@60707
|
80 |
|
Walther@60707
|
81 |
val (_, env_eval) = Pre_Conds.sep_variants_envs_OLD model_patt probl
|
Walther@60707
|
82 |
(*------------------- must be completed first ---^^^^^*)
|
Walther@60707
|
83 |
|
Walther@60705
|
84 |
val {model = model_patt, where_ = where_ctree, where_rls, ...} =
|
Walther@60705
|
85 |
Problem.from_store ctxt pbl_id;
|
Walther@60705
|
86 |
val _ =
|
Walther@60705
|
87 |
case I_Model.is_complete_OLD ctxt model_patt where_rls where_ctree probl of
|
Walther@60705
|
88 |
NONE => writeln "I_Model.is_complete_OLD --> NONE"
|
Walther@60705
|
89 |
| SOME variants =>
|
Walther@60705
|
90 |
writeln ("I_Model.is_complete_OLD --> SOME " ^ LibraryC.ints2str' variants)
|
Walther@60705
|
91 |
(*reminder for Template.show ----------------------------------------------------------------/*)
|
Walther@60705
|
92 |
|
Walther@60705
|
93 |
(*reminder for Pre_Conds.check_TEST ---------------------------------------------------------\*)
|
Walther@60705
|
94 |
val (true, [(true, (Const ("Orderings.ord_class.less", _) $ Const ("Groups.zero_class.zero", _) $
|
Walther@60705
|
95 |
Free ("r", _), _))]) = Pre_Conds.check_TEST ctxt where_rls where_ env_eval;
|
Walther@60705
|
96 |
(*reminder for Pre_Conds.check_TEST ---------------------------------------------------------/*)
|
Walther@60687
|
97 |
(**)
|
Walther@60705
|
98 |
val ((_, _, _), (_, pbl_id as ["univariate_calculus", "Optimisation"], _)) =
|
Walther@60705
|
99 |
References.for_eval_model (thy_id, probl_id, meth_id) spec_ref o_ref
|
Walther@60688
|
100 |
val _ = re_eval References.empty References.empty
|
Walther@60687
|
101 |
(**)
|
Walther@60698
|
102 |
in
|
Walther@60704
|
103 |
Preliminary.update_state thy
|
Walther@60688
|
104 |
(example_id, (model_input, (thy_id, probl_id, meth_id))) (the_data thy)
|
Walther@60698
|
105 |
end
|
Walther@60687
|
106 |
in set_data state thy end)));
|
Walther@60686
|
107 |
\<close> ML \<open>
|
Walther@60690
|
108 |
\<close> ML \<open> (*Example_TEST below*)
|
Walther@60686
|
109 |
\<close>
|
Walther@60686
|
110 |
|
Walther@60692
|
111 |
subsection \<open>Mirror from src/../VSCode_Example.thy for testing purposes\<close>
|
Walther@60687
|
112 |
|
Walther@60491
|
113 |
subsubsection \<open>Complete Specification at once\<close>
|
Walther@60687
|
114 |
|
Walther@60491
|
115 |
text \<open>
|
Walther@60491
|
116 |
Just a test, that this works also in $ISABELLE_ISAC_TEST
|
Walther@60491
|
117 |
\<close>
|
Walther@60699
|
118 |
Example_TEST "Diff_App-No.123a" (*complete Specification*)
|
Walther@60491
|
119 |
Specification:
|
Walther@60491
|
120 |
Model:
|
Walther@60491
|
121 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60491
|
122 |
Where: \<open>0 < r\<close>
|
Walther@60491
|
123 |
Find: \<open>Maximum A\<close> \<open>AdditionalValues [u, v]\<close>
|
Walther@60699
|
124 |
Relate: \<open>Extremum (A = 2 * u * v - u \<up> 2)\<close>
|
Walther@60579
|
125 |
\<open>SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]\<close>
|
Walther@60687
|
126 |
References:
|
Walther@60687
|
127 |
Theory_Ref: "Diff_App"
|
Walther@60687
|
128 |
(*\<Otimes>*) Problem_Ref: "univariate_calculus/Optimisation"
|
Walther@60687
|
129 |
(*\<Odot>*) Method_Ref: "Optimisation/by_univariate_calculus"
|
Walther@60687
|
130 |
(*Solution:*)
|
Walther@60687
|
131 |
|
Walther@60687
|
132 |
text \<open>
|
Walther@60687
|
133 |
Check complete \<open>Model\<close>, infer empty \<open>References\<close> from data hidden in "Diff_App-No.123a"
|
Walther@60687
|
134 |
\<close>
|
Walther@60698
|
135 |
(*
|
Walther@60699
|
136 |
Example: no syntax check of terms, thus OK.
|
Walther@60698
|
137 |
Example_TEST: proper syntax check of terms with Model_Pattern.parse_pos,
|
Walther@60698
|
138 |
*)
|
Walther@60699
|
139 |
(** )Example
|
Walther@60699
|
140 |
( **)Example_TEST(**) "Diff_App-No.123a" (*complete Model, empty References*)
|
Walther@60687
|
141 |
Specification:
|
Walther@60687
|
142 |
Model:
|
Walther@60687
|
143 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60687
|
144 |
Where: \<open>0 < r\<close>
|
Walther@60687
|
145 |
Find: \<open>Maximum A\<close> \<open>AdditionalValues [u, v]\<close>
|
Walther@60687
|
146 |
Relate: \<open>Extremum (A = 2 * u * v - u \<up> 2)\<close>
|
Walther@60687
|
147 |
\<open>SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]\<close>
|
Walther@60491
|
148 |
References:
|
Walther@60687
|
149 |
Theory_Ref: "__"
|
Walther@60687
|
150 |
(*\<Odot>*) Problem_Ref: "__/__"
|
Walther@60687
|
151 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
152 |
(*Solution:*)
|
Walther@60491
|
153 |
|
Walther@60686
|
154 |
subsubsection \<open>Empty Specification ready for input by students\<close>
|
Walther@60579
|
155 |
text \<open>
|
Walther@60579
|
156 |
In order to help the student (similar to a personal instructur helping a beginner)
|
Walther@60579
|
157 |
the \<open>Specification\<close> is given as a template,
|
Walther@60579
|
158 |
where so-called \<open>descriptor\<close>s give hints about the input requested
|
Walther@60579
|
159 |
(in native language!) and delimiters are (partially) given.
|
Walther@60579
|
160 |
|
Walther@60579
|
161 |
For the same reason \<open>Where\<close> is already filled; most beginners are
|
Walther@60686
|
162 |
not aware of "where_-conditions", i.e. of preconditions.
|
Walther@60579
|
163 |
\<close>
|
Walther@60707
|
164 |
(*all empty*)
|
Walther@60605
|
165 |
|
Walther@60707
|
166 |
Example_TEST "Diff_App-No.123a"
|
Walther@60579
|
167 |
Specification:
|
Walther@60579
|
168 |
Model:
|
Walther@60690
|
169 |
Given: \<open>Constants [__=__, __=__]\<close>
|
Walther@60579
|
170 |
Where: \<open>0 < r\<close>
|
Walther@60690
|
171 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [__, __]\<close>
|
Walther@60579
|
172 |
Relate: \<open>Extremum __\<close>
|
Walther@60690
|
173 |
\<open>SideConditions [__=__, __=__]\<close>
|
Walther@60579
|
174 |
References:
|
Walther@60686
|
175 |
Theory_Ref: "__"
|
Walther@60601
|
176 |
(*\<Odot>*) Problem_Ref: "__/__"
|
Walther@60601
|
177 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
178 |
(*Solution:*)
|
Walther@60579
|
179 |
|
Walther@60532
|
180 |
subsubsection \<open>Start Example with a CAS_Cmd\<close>
|
Walther@60532
|
181 |
text \<open>
|
Walther@60532
|
182 |
The student wants to use Isabelle/Isac like an Algebra System and issues a CAS_Cmd.
|
Walther@60579
|
183 |
The CAS_Cmd triggers implicit Specification (which usually is not requested
|
Walther@60579
|
184 |
in case of CAS_Cmd).
|
Walther@60532
|
185 |
|
Walther@60532
|
186 |
This user-requirement is not reflected so far. Three possible solutions are sketched below.
|
Walther@60532
|
187 |
\<close>
|
Walther@60532
|
188 |
(*----------------------------------------* )
|
Walther@60532
|
189 |
Example ""
|
Walther@60532
|
190 |
Specification (\<open>Simplify (2*a + 3*a)\<close>):
|
Walther@60532
|
191 |
Solution:
|
Walther@60532
|
192 |
\<open>2*a + 3*a\<close>
|
Walther@60532
|
193 |
:
|
Walther@60532
|
194 |
( *-----------------------------------------*)
|
Walther@60532
|
195 |
|
Walther@60532
|
196 |
(*----------------------------------------* )
|
Walther@60532
|
197 |
Example \<open>Simplify (2*a + 3*a)\<close>
|
Walther@60532
|
198 |
Specification:
|
Walther@60532
|
199 |
Solution:
|
Walther@60532
|
200 |
\<open>2*a + 3*a\<close>
|
Walther@60532
|
201 |
:
|
Walther@60532
|
202 |
( *----------------------------------------*)
|
Walther@60532
|
203 |
|
Walther@60532
|
204 |
(*----------------------------------------* )
|
Walther@60532
|
205 |
\<open>Simplify (2*a + 3*a)\<close>
|
Walther@60532
|
206 |
Specification:
|
Walther@60532
|
207 |
Solution:
|
Walther@60532
|
208 |
\<open>2*a + 3*a\<close>
|
Walther@60532
|
209 |
:
|
Walther@60532
|
210 |
( *----------------------------------------*)
|
Walther@60532
|
211 |
|
Walther@60491
|
212 |
subsubsection \<open>Specification step by step\<close>
|
Walther@60491
|
213 |
|
Walther@60491
|
214 |
text \<open>
|
Walther@60491
|
215 |
In an electronic textbook there shall be references to examples given, for instance,
|
Walther@60510
|
216 |
by \<open>Example "Diff_App-No.123a"\<close>. Such a reference shall be easily "activated"
|
Walther@60579
|
217 |
to start a Specification + Solution at the spot ?and?or? to open a separate window.
|
Walther@60491
|
218 |
|
Walther@60510
|
219 |
Activating the reference \<open>Example "Diff_App-No.123a"\<close> shall result in a threefold alternative,
|
Walther@60579
|
220 |
where (2)=(3) holds for the parsers:
|
Walther@60491
|
221 |
(1) the Example presents a "normal problem" with a Specification (preferred by engineers),
|
Walther@60491
|
222 |
see above subsubsection \<open>Empty Specification\<close>,
|
Walther@60491
|
223 |
(2) the Example presents a "normal problem" without a Specification (preferred in high-school):
|
Walther@60510
|
224 |
|Example "Diff_App-No.123a"
|
Walther@60491
|
225 |
| Specification:
|
Walther@60491
|
226 |
| Solution:
|
Walther@60491
|
227 |
| ..first formula as given by the specifid Method..
|
Walther@60491
|
228 |
(3) the Example presents a "CAS_Cmd":
|
Walther@60579
|
229 |
|Example \<open>Simplify (2*a + 3*a)\<close>
|
Walther@60491
|
230 |
| Specification:
|
Walther@60491
|
231 |
| Solution:
|
Walther@60491
|
232 |
| solve (x + 1 = 2, x)
|
Walther@60491
|
233 |
\<open>Specification\<close> is always visible in order to remind of the existence.
|
Walther@60491
|
234 |
\<open>Outer_Syntax.command \<^command_keyword>\<open>Example\<close>\<close> shall be able to parse all three cases
|
Walther@60491
|
235 |
(while still skipping considerations about \<open>Specification\<close> and sub-problems).
|
Walther@60491
|
236 |
|
Walther@60491
|
237 |
Below is the Example with case (1):
|
Walther@60491
|
238 |
* The lines \<open>text --- remove this line and make content Isar input---\\<close>
|
Walther@60491
|
239 |
and ---------- remove this line and make content Isar input---/
|
Walther@60491
|
240 |
will be deleted after correct implementation
|
Walther@60491
|
241 |
* The \<open>ML \<open>blocks\<close>\<close> in between show, that ISAC is able of "next step guidance";
|
Walther@60579
|
242 |
these can be deleted as well.
|
Walther@60491
|
243 |
* This Example also shows the toggle between \<open>\<Otimes>\<close> and \<open>\<Odot>\<close>.
|
Walther@60491
|
244 |
\<close>
|
Walther@60491
|
245 |
|
Walther@60491
|
246 |
text \<open>
|
Walther@60579
|
247 |
# 1: ISAC starts the Example by presenting an "empty" Specification.
|
Walther@60579
|
248 |
|
Walther@60579
|
249 |
"Presenting" should mean: by "activation" of Example the system presents
|
Walther@60695
|
250 |
the empty Specification as a template, where the items give hints on the input format.
|
Walther@60579
|
251 |
|
Walther@60579
|
252 |
The field \<open>Where\<close> is already filled, but editable and shows missing input by \<open>False\<close>.
|
Walther@60603
|
253 |
\<close>
|
Walther@60603
|
254 |
ML \<open>
|
Walther@60603
|
255 |
\<close> ML \<open> (* # 1: At the first call of \<open>Example\<close> ISAC initialises a calculation *)
|
Walther@60491
|
256 |
val p = ([], Pos.Pbl);
|
Walther@60693
|
257 |
val pt = Preliminary.update_state @{theory} (*here we have Ctree.EmptyPtree and thus call init_ctree*)
|
Walther@60579
|
258 |
("Diff_App-No.123a",
|
Walther@60603
|
259 |
( [("#Given", [("Constants [r = 7]", Position.none)]),
|
Walther@60603
|
260 |
("#Where", [("0 < r", Position.none)]),
|
Walther@60603
|
261 |
("#Find", [("Maximum A", Position.none), ("AdditionalValues [u, v]", Position.none)]),
|
Walther@60603
|
262 |
("#Relate", [("Extremum A = 2 * u * v - u \<up> 2", Position.none),
|
Walther@60603
|
263 |
("SideConditions [((u::real) / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]", Position.none)])
|
Walther@60491
|
264 |
],
|
Walther@60605
|
265 |
("Diff_App", "univariate_calculus/Optimisation", "Optimisation/by_univariate_calculus")
|
Walther@60491
|
266 |
)
|
Walther@60704
|
267 |
) CTbasic_TEST.EmptyPtree;
|
Walther@60491
|
268 |
val ptp = (pt, p);
|
Walther@60491
|
269 |
\<close>
|
Walther@60699
|
270 |
Example_TEST "Diff_App-No.123a" (*all empty step 0*)
|
Walther@60491
|
271 |
Specification:
|
Walther@60491
|
272 |
Model:
|
Walther@60690
|
273 |
Given: \<open>Constants [__=__, __=__]\<close>
|
Walther@60491
|
274 |
Where: \<open>0 < r\<close>
|
Walther@60690
|
275 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [__, __]\<close>
|
Walther@60579
|
276 |
Relate: \<open>Extremum __\<close>
|
Walther@60690
|
277 |
\<open>SideConditions [__=__, __=__]\<close>
|
Walther@60491
|
278 |
References:
|
Walther@60686
|
279 |
Theory_Ref: "__"
|
Walther@60686
|
280 |
(*\<Odot>*) Problem_Ref: "__/__"
|
Walther@60686
|
281 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
282 |
(*Solution:*)
|
Walther@60491
|
283 |
|
Walther@60491
|
284 |
text \<open>
|
Walther@60579
|
285 |
# 2: Somewhere in the Model, the user inputs a next item, which is marked "correct" by ISAC.
|
Walther@60579
|
286 |
|
Walther@60579
|
287 |
By this input Where: \<open>0 < r\<close> is not rendered \<open>False\<close> anymore.
|
Walther@60491
|
288 |
\<close>
|
Walther@60579
|
289 |
ML \<open> (* # 2: Somewhere in the Model, the user inputs a next item *)
|
Walther@60704
|
290 |
(*/---Step.specify_do_next still works with Ctree, not Ctree_TEST-------------------* )
|
Walther@60491
|
291 |
val ("ok", ([(Tactic.Add_Given "Constants [r = 7]", _, _)], _, ptp))
|
Walther@60491
|
292 |
= Step.specify_do_next ptp;
|
Walther@60704
|
293 |
( *\---Step.specify_do_next still works with Ctree, not Ctree_TEST-------------------*)
|
Walther@60491
|
294 |
\<close>
|
Walther@60699
|
295 |
Example_TEST "Diff_App-No.123a" (*step 1: <Constants [r = 7]>*)
|
Walther@60491
|
296 |
Specification:
|
Walther@60491
|
297 |
Model:
|
Walther@60690
|
298 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60491
|
299 |
Where: \<open>0 < r\<close>
|
Walther@60699
|
300 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [__, __]\<close>
|
Walther@60699
|
301 |
Relate: \<open>Extremum __\<close> \<open>SideConditions [__=__, __=__]\<close>
|
Walther@60491
|
302 |
References:
|
Walther@60686
|
303 |
Theory_Ref: "__"
|
Walther@60686
|
304 |
(*\<Odot>*) Problem_Ref: "__/__"
|
Walther@60686
|
305 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
306 |
(*Solution:*)
|
Walther@60491
|
307 |
|
Walther@60491
|
308 |
text \<open>
|
Walther@60491
|
309 |
# 3: The user inputs a next item somewhere in the \<open>Specification\<close>;
|
Walther@60491
|
310 |
Since this item requests for a list, \<open>AdditionalValues\<close> is marked "incomplete":
|
Walther@60491
|
311 |
\<close>
|
Walther@60491
|
312 |
ML \<open> (* 3: ISAC suggests a next item within a term list *)
|
Walther@60704
|
313 |
(*/---Step.specify_do_next still works with Ctree, not Ctree_TEST-------------------* )
|
Walther@60491
|
314 |
val ("ok", ([(Tactic.Add_Find "Maximum A", _, _)], _, ptp))
|
Walther@60491
|
315 |
= Step.specify_do_next ptp;
|
Walther@60704
|
316 |
( *\---Step.specify_do_next still works with Ctree, not Ctree_TEST-------------------*)
|
Walther@60491
|
317 |
\<close>
|
Walther@60699
|
318 |
Example_TEST "Diff_App-No.123a" (*step 2: AdditionalValues [u]*)
|
Walther@60491
|
319 |
Specification:
|
Walther@60491
|
320 |
Model:
|
Walther@60699
|
321 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60491
|
322 |
Where: \<open>0 < r\<close>
|
Walther@60699
|
323 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [u]\<close>
|
Walther@60699
|
324 |
Relate: \<open>Extremum __\<close> \<open>SideConditions [__=__, __=__]\<close>
|
Walther@60491
|
325 |
References:
|
Walther@60686
|
326 |
Theory_Ref: "__"
|
Walther@60686
|
327 |
(*\<Odot>*) Problem_Ref: "__/__"
|
Walther@60686
|
328 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
329 |
(*Solution:*)
|
Walther@60491
|
330 |
|
Walther@60491
|
331 |
text \<open>
|
Walther@60491
|
332 |
# 4: The user inputs a next item, and the item \<open>AdditionalValues\<close> is marked "correct":
|
Walther@60491
|
333 |
\<close>
|
Walther@60491
|
334 |
ML \<open> (* # 4: ISAC suggests a next step on request, even a next element within a list *)
|
Walther@60704
|
335 |
(*/---Step.specify_do_next still works with Ctree, not Ctree_TEST-------------------* )
|
Walther@60491
|
336 |
val ("ok", ([(Tactic.Add_Find "AdditionalValues [u]", _, _)], _, ptp))
|
Walther@60491
|
337 |
= Step.specify_do_next ptp;
|
Walther@60704
|
338 |
( *\---Step.specify_do_next still works with Ctree, not Ctree_TEST-------------------*)
|
Walther@60491
|
339 |
\<close>
|
Walther@60491
|
340 |
|
Walther@60699
|
341 |
Example_TEST "Diff_App-No.123a" (*step 3: A.Values [u, v]*)
|
Walther@60491
|
342 |
Specification:
|
Walther@60491
|
343 |
Model:
|
Walther@60699
|
344 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60491
|
345 |
Where: \<open>0 < r\<close>
|
Walther@60699
|
346 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [u, v]\<close>
|
Walther@60699
|
347 |
Relate: \<open>Extremum __\<close> \<open>SideConditions [__=__, __=__]\<close>
|
Walther@60491
|
348 |
References:
|
Walther@60686
|
349 |
Theory_Ref: "__"
|
Walther@60686
|
350 |
(*\<Odot>*) Problem_Ref: "__/__"
|
Walther@60686
|
351 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
352 |
(*Solution:*)
|
Walther@60491
|
353 |
|
Walther@60491
|
354 |
text \<open>
|
Walther@60491
|
355 |
# 5: Input to \<open>Problem_Ref\<close> is according to the (hidden) formalisation:
|
Walther@60491
|
356 |
\<close>
|
Walther@60491
|
357 |
ML \<open> (* # 5: Input to \<open>Problem_Ref\<close> might change the \<open>Model\<close> *)
|
Walther@60491
|
358 |
\<close>
|
Walther@60699
|
359 |
Example_TEST "Diff_App-No.123a" (*step 4: (wrong) Problem_Ref input*)
|
Walther@60491
|
360 |
Specification:
|
Walther@60491
|
361 |
Model:
|
Walther@60699
|
362 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60491
|
363 |
Where: \<open>0 < r\<close>
|
Walther@60699
|
364 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [u, v]\<close>
|
Walther@60699
|
365 |
Relate: \<open>Extremum __\<close> \<open>SideConditions [__=__, __=__]\<close>
|
Walther@60491
|
366 |
References:
|
Walther@60686
|
367 |
Theory_Ref: "__"
|
Walther@60699
|
368 |
(*\<Odot>*) Problem_Ref: "univariate_calculus/Optimisation" (*"Biegelinien/einfache" not in teststore*)
|
Walther@60686
|
369 |
(*\<Otimes>*) Method_Ref: "__/__"
|
Walther@60605
|
370 |
(*Solution:*)
|
Walther@60491
|
371 |
|
Walther@60491
|
372 |
text \<open>
|
Walther@60491
|
373 |
# 6: Input to \<open>Method_Ref\<close> changes the \<open>Model\<close> to the respective \<open>Method\<close>;
|
Walther@60491
|
374 |
There is also a feature to change the \<open>Model\<close> according to
|
Walther@60491
|
375 |
direct manipulation of \<open>\<Otimes>\<close> and \<open>\<Odot>\<close>.
|
Walther@60491
|
376 |
\<close>
|
Walther@60491
|
377 |
ML \<open> (* # 6: Input to \<open>Method_Ref\<close> changes the \<open>Model\<close> to the respective \<open>Method\<close> *)
|
Walther@60491
|
378 |
\<close>
|
Walther@60699
|
379 |
Example_TEST "Diff_App-No.123a" (*step 5: Method_Ref updated*)
|
Walther@60491
|
380 |
Specification:
|
Walther@60601
|
381 |
Model: (* FIXME: lookup model of method *)
|
Walther@60699
|
382 |
Given: \<open>Constants [r = 7]\<close>
|
Walther@60491
|
383 |
Where: \<open>0 < r\<close>
|
Walther@60699
|
384 |
Find: \<open>Maximum __\<close> \<open>AdditionalValues [u, v]\<close>
|
Walther@60699
|
385 |
Relate: \<open>Extremum __\<close> \<open>SideConditions [__]\<close>
|
Walther@60491
|
386 |
References:
|
Walther@60686
|
387 |
Theory_Ref: "__"
|
Walther@60601
|
388 |
(*\<Odot>*) Problem_Ref: "univariate_calculus/Optimisation"
|
Walther@60601
|
389 |
(*\<Otimes>*) Method_Ref: "Optimisation/by_univariate_calculus"
|
Walther@60605
|
390 |
(*Solution:*)
|
Walther@60491
|
391 |
|
Walther@60491
|
392 |
text \<open>
|
Walther@60491
|
393 |
# 7: xxxxx:
|
Walther@60491
|
394 |
\<close>
|
Walther@60708
|
395 |
ML \<open> (* # 7: user inputs value of Method_Ref, which shows the respective Model *)
|
Walther@60491
|
396 |
\<close>
|
Walther@60708
|
397 |
|
Walther@60708
|
398 |
subsubsection \<open>Specification with Model for the Method_Ref\<close>
|
Walther@60708
|
399 |
|
Walther@60708
|
400 |
text \<open>
|
Walther@60708
|
401 |
Observe the (still outcommented) toggles \<Odot>\<Otimes> changed according to the Reference
|
Walther@60708
|
402 |
\<close>
|
Walther@60708
|
403 |
Example_TEST "Diff_App-No.123a" (*Specification of the Method_Ref*)
|
Walther@60708
|
404 |
Specification:
|
Walther@60708
|
405 |
Model:
|
Walther@60708
|
406 |
Given: \<open>Constants [r = 7]\<close> \<open>Maximum A\<close> \<open>AdditionalValues [u, v]\<close>
|
Walther@60708
|
407 |
\<open>Extremum (A = 2 * u * v - u \<up> 2)\<close>
|
Walther@60708
|
408 |
\<open>SideConditions [(u / 2) \<up> 2 + (2 / v) \<up> 2 = r \<up> 2]\<close>
|
Walther@60708
|
409 |
\<open>FunctionVariable u\<close> \<open>Domain {0 <..< r}\<close> \<open>ErrorBound (\<epsilon> = 0)\<close>
|
Walther@60708
|
410 |
Where: \<open>0 < r\<close>
|
Walther@60708
|
411 |
Find: \<open>Results (A, u, v)\<close>
|
Walther@60708
|
412 |
Relate:
|
Walther@60708
|
413 |
References:
|
Walther@60708
|
414 |
Theory_Ref: "Diff_App"
|
Walther@60708
|
415 |
(*\<Odot>*) Problem_Ref: "univariate_calculus/Optimisation"
|
Walther@60708
|
416 |
(*\<Otimes>*) Method_Ref: "Optimisation/by_univariate_calculus"
|
Walther@60708
|
417 |
(*Solution:*)
|
Walther@60708
|
418 |
|
Walther@60491
|
419 |
text \<open> --- remove this line and make content Isar input---\
|
Walther@60491
|
420 |
---------- remove this line and make content Isar input---/
|
Walther@60491
|
421 |
\<close>
|
Walther@60491
|
422 |
|
Walther@60491
|
423 |
text \<open>
|
Walther@60491
|
424 |
# 8: xxxxx:
|
Walther@60491
|
425 |
\<close>
|
Walther@60491
|
426 |
ML \<open> (* # 8: ISAC suggests a next step on request *)
|
Walther@60491
|
427 |
\<close>
|
Walther@60491
|
428 |
text \<open> --- remove this line and make content Isar input---\
|
Walther@60491
|
429 |
---------- remove this line and make content Isar input---/
|
Walther@60491
|
430 |
\<close>
|
Walther@60491
|
431 |
|
Walther@60491
|
432 |
text \<open>
|
Walther@60491
|
433 |
# 9: xxxxx:
|
Walther@60491
|
434 |
\<close>
|
Walther@60491
|
435 |
ML \<open> (* # 9: ISAC suggests a next step on request *)
|
Walther@60491
|
436 |
\<close>
|
Walther@60491
|
437 |
text \<open> --- remove this line and make content Isar input---\
|
Walther@60491
|
438 |
---------- remove this line and make content Isar input---/
|
Walther@60491
|
439 |
\<close>
|
Walther@60491
|
440 |
|
Walther@60491
|
441 |
ML \<open>
|
Walther@60491
|
442 |
\<close> ML \<open>
|
Walther@60491
|
443 |
\<close> ML \<open>
|
Walther@60491
|
444 |
\<close>
|
Walther@60491
|
445 |
|
Walther@60491
|
446 |
end
|