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