src/Tools/isac/TODO.thy
author Walther Neuper <walther.neuper@jku.at>
Mon, 20 Jan 2020 14:38:46 +0100
changeset 59779 013e6808d1ca
parent 59778 148d369e6b71
child 59780 3d25a02a022e
permissions -rw-r--r--
determine structure for TODO.thy
neuper@42314
     1
(* Title:  todo's for isac core
neuper@42314
     2
   Author: Walther Neuper 111013
neuper@42314
     3
   (c) copyright due to lincense terms.
neuper@42314
     4
*)
wneuper@59504
     5
theory TODO
wneuper@59504
     6
imports "~~/src/Doc/Prog_Prove/LaTeXsugar"
wneuper@59504
     7
begin
neuper@42314
     8
walther@59779
     9
text \<open>
walther@59779
    10
Legend: here + code since 200120
walther@59779
    11
  \<open>(*DOC\<close> identifies stuff dedicated for isac/Doc/Lucas_Interpreter
walther@59779
    12
  \<open>(*?!?\<close> identifies a design question
walther@59779
    13
walther@59779
    14
Distillation of "rounds of reforms":
walther@59779
    15
  \<open>TODOs from current changesets\<close> \<rightarrow> \<open>Postponed from current changeset\<close> \<rightarrow>
walther@59779
    16
  (*to be removed..*) \<rightarrow> \<open>Separated tasks\<close> (*.. to be removed*)
walther@59779
    17
  \<rightarrow> subsection of \<open>Major reforms\<close>
walther@59779
    18
\<close>
walther@59779
    19
wneuper@59574
    20
section \<open>TODOs from current changesets\<close>
wneuper@59568
    21
text\<open>
walther@59779
    22
  Shift more complicated issues from  \<open>Current changeset\<close> to \<open>Postponed from current changeset\<close>
wneuper@59568
    23
\<close>
wneuper@59574
    24
subsection \<open>Current changeset\<close>
wneuper@59574
    25
text \<open>
wneuper@59569
    26
  \begin{itemize}
walther@59779
    27
  \item xxx          
walther@59779
    28
  \item xxx
walther@59779
    29
  \item xxx
wneuper@59601
    30
  \item xxx
walther@59659
    31
  \item xxx
walther@59771
    32
  \item shift check_leaf Lucin --> LucinNEW ? LItool ?
walther@59771
    33
  \item xxx
walther@59635
    34
  \item rm test/..--- check Scripts ---
walther@59635
    35
  \item xxx
walther@59718
    36
  \item reformat + rename "fun eval_leaf"+"fun get_stac"
walther@59635
    37
        (*1*)(*2*)
walther@59635
    38
        ?consistency with subst term?
walther@59730
    39
  \item Tactic.Rewrite*': drop "bool"
walther@59635
    40
  \item xxx
walther@59635
    41
  \item exception PROG analogous to TERM
walther@59635
    42
  \item xxx
walther@59778
    43
  \item Prog_Tac: fun get_stac takes both Prog_Tac + Program --- wait for separate Tactical
walther@59635
    44
    then shift into common descendant
walther@59635
    45
    rename get_stac --> ?ptac?
wneuper@59601
    46
  \item xxx
walther@59778
    47
  \item separate code required in both, ProgLang & Interpret (e.g?)
wneuper@59591
    48
  \item xxx
wneuper@59591
    49
  \item /-------------------------------------------------------------------
wneuper@59591
    50
  \item check occurences of KEStore_Elems.add_rlss [("list_rls",
wneuper@59591
    51
  \item rename list_rls accordingly
wneuper@59591
    52
  \item ------------------------------------------------------------------/
wneuper@59591
    53
  \item xxx
wneuper@59591
    54
  \item xxx
wneuper@59586
    55
    \item signature LIBRARY_C
wneuper@59586
    56
    \item Program.thy  (*=========== record these ^^^ in 'tacs' in program.ML =========*)
wneuper@59586
    57
    \item sig/struc ..elems --> elem
wneuper@59586
    58
    \item xxx
wneuper@59586
    59
    \item xxx
wneuper@59586
    60
    \end{itemize}
wneuper@59574
    61
  \item xxx
wneuper@59582
    62
  \item xxx
walther@59633
    63
  \item distribute test/../scrtools.sml
wneuper@59574
    64
  \item xxx
wneuper@59574
    65
  \item xxx
walther@59769
    66
  \item simplify calls of scan_dn1, scan_dn etc
wneuper@59586
    67
  \item open Istate in LucinNEW
wneuper@59574
    68
  \end{itemize}
wneuper@59574
    69
\<close>
wneuper@59574
    70
subsection \<open>Postponed from current changeset\<close>
wneuper@59574
    71
text \<open>
wneuper@59574
    72
  \begin{itemize}
walther@59648
    73
  \item xxx
walther@59779
    74
  \item generate, generate1: NO thy as arg.
walther@59779
    75
  \item xxx
walther@59779
    76
  \item decompose do_next, by_tactic: mutual recursion only avoids multiple generate1
walther@59779
    77
    ! ^^^ in find_next_step --- ? ? ? in locate_input_tactic ?
walther@59779
    78
  \item xxx
walther@59779
    79
  \item Generate.generate1 thy is redundant: is the same during pbl, thus lookup spec
walther@59779
    80
  \item xxx
walther@59779
    81
  \item NEW structure Step.applicable     Step.add
walther@59779
    82
                          ^applicable_in      ^generate1
walther@59779
    83
  \item xxx
walther@59779
    84
  \item revise Pstate {or, ...}; strange occurrence in program without Tactical.Or documented here
walther@59779
    85
  \item xxx
walther@59779
    86
  \item shift tests into NEW model.sml (upd, upds_envv, ..)
walther@59779
    87
  \item xxx
walther@59779
    88
  \item xxx
walther@59779
    89
  \item clarify handling of contexts
walther@59779
    90
    \begin{itemize}
walther@59779
    91
    \item xxx
walther@59779
    92
    \item Specify/ works with thy | Interpret/ works with ctxt | MathEngine.step works with ?!?ctxt
walther@59779
    93
    \item xxx
walther@59779
    94
    \item Check_Elementwise "Assumptions": prerequisite for ^^goal
walther@59779
    95
      rm tactic Check_elementwise "Assumptions" in a way, which keeps it for Minisubpbl
walther@59779
    96
      rm Assumptions  :: bool  (* TODO: remove with making ^^^ idle *)
walther@59779
    97
    \item xxx
walther@59779
    98
    \item cleanup fun me:
walther@59779
    99
      fun me (*(_, Empty_Tac) p _ _ = raise ERROR ("me:  Empty_Tac at " ^ pos'2str p)
walther@59779
   100
        | me*) (_, tac) p _(*NEW remove*) pt =
walther@59779
   101
      + -------------------------^^^^^^
walther@59779
   102
    \item xxx
walther@59779
   103
    \item remove ctxt from Tactic.T; this makes use of ctxt more explicit (e.g. in Lucin)
walther@59779
   104
      \begin{itemize}
walther@59779
   105
      \item Tactic.Apply_Method' (mI, _, _, _(*ctxt ?!?*))) .. remove ctxt
walther@59779
   106
      \item rm ctxt from Subproblem' (is separated in associate!))
walther@59779
   107
      \end{itemize}
walther@59779
   108
    \item check Tactic.Subproblem': are 2 terms required?
walther@59779
   109
    \item xxx
walther@59779
   110
    \item Test_Some.--- rat-equ: remove x = 0 from [x = 0, x = 6 / 5] due to contexts --
walther@59779
   111
      --: wait for deleting Check_Elementwise Assumptions
walther@59779
   112
    \item xxx
walther@59779
   113
    \item lucas-intrpreter.scan_dn1: Generate.generate1 (Celem.assoc_thy "Isac_Knowledge") 
walther@59779
   114
    \end{itemize}
walther@59779
   115
  \item xxx
walther@59779
   116
  \item xxx
walther@59779
   117
  \item complete mstools.sml (* survey on handling contexts:
walther@59779
   118
  \item xxx
walther@59779
   119
  \item xxx
walther@59779
   120
  \item istate
walther@59779
   121
    \begin{itemize}
walther@59779
   122
    \item datatype L,R,D --> Istate
walther@59779
   123
    \item xxx
walther@59779
   124
    \item xxx
walther@59779
   125
    \item xxx
walther@59779
   126
    \item in locate_input_tactic .. ?scan_dn1?; Program.is_eval_expr   .use  Term.exists_Const
walther@59779
   127
    \item xxx
walther@59779
   128
    \item pstate2str --> pstate2str
walther@59779
   129
    \item xxx
walther@59779
   130
    \item after review of Rrls, detail ?-->? istate
walther@59779
   131
    \item locate_input_tactic: get_simplifier cstate (*TODO: shift to init_istate*)
walther@59779
   132
    \item xxx
walther@59779
   133
    \item push srls into pstate
walther@59779
   134
    \item lucas-intrpreter.locate_input_tactic: scan_to_tactic1 srls tac cstate (progr, Rule.e_rls)
walther@59779
   135
                                                                                        ^^^^^^^^^^
walther@59779
   136
    \item xxx
walther@59779
   137
    \item xxx
walther@59779
   138
    \end{itemize}
walther@59779
   139
  \item xxx
walther@59779
   140
  \item trace_script: replace ' by " in writeln
walther@59779
   141
  \item xxx
walther@59779
   142
  \item librarys.ml --> libraryC.sml + text from termC.sml
walther@59779
   143
  \item xxx
walther@59779
   144
  \item xxx
walther@59779
   145
  \item xxx
walther@59779
   146
  \item xxx
walther@59779
   147
  \item xxx
walther@59779
   148
  \item xxx
walther@59779
   149
  \item concentrate "insert_assumptions" for locate_input_tactic in "associate", ?OR? Tactic.insert_assumptions
walther@59779
   150
                                   DONE  for find_next_step by Tactic.insert_assumptions m' ctxt 
walther@59779
   151
    \begin{itemize}
walther@59779
   152
    \item rm from "generate1" ("Detail_Set_Inst'", Tactic.Detail_Set' ?)
walther@59779
   153
    \item shift from "applicable_in..Apply_Method" to ? ? ? (is ONLY use-case in appl.sml))
walther@59779
   154
    \item ?"insert_assumptions" necessary in "init_pstate" ?+++? in "applicable_in" ?+++? "associate"
walther@59779
   155
    \item xxx
walther@59779
   156
    \item xxx
walther@59779
   157
    \item DO DELETIONS AFTER analogous concentrations in find_next_step
walther@59779
   158
    \end{itemize}
walther@59779
   159
  \item xxx
walther@59779
   160
  \item ? what is the difference headline <--> cascmd in
walther@59779
   161
    Subproblem' (spec, oris, headline, fmz_, context, cascmd)
walther@59779
   162
  \item xxx
walther@59779
   163
  \item inform: TermC.parse (Celem.assoc_thy "Isac_Knowledge") istr --> parseNEW context istr
walther@59779
   164
  \item extract common code from associate.. stac2tac_
walther@59779
   165
        rename Lucin.stac2tac -> Tactic.from_prog_tac ? Solve_Tac.from_prog_tac,
walther@59779
   166
        .. see \<open>Separate ..\<close>
walther@59779
   167
  \end{itemize}
walther@59779
   168
\<close>
walther@59779
   169
walther@59779
   170
section \<open>Separated tasks\<close>
walther@59779
   171
text \<open>
walther@59779
   172
  This section shall be removed, because
walther@59779
   173
  the distinction \<open>Simple\<close> | \<open>Simple but laborous\<close> | \<open>Questionable\<close>
walther@59779
   174
  is too distracting when working \<open>TODOs from current changesets\<close>.
walther@59779
   175
\<close>
walther@59779
   176
subsection \<open>Simple\<close>
walther@59779
   177
text \<open>
walther@59779
   178
  \begin{itemize}
walther@59779
   179
  \item rm Float
walther@59779
   180
  \item xxx
walther@59779
   181
  \item check location of files:
walther@59779
   182
        test/Tools/isac/Interpret/ptyps.thy
walther@59779
   183
        test/Tools/isac/Specify.ptyps.sml
walther@59779
   184
  \item xxx
walther@59779
   185
  \item check occurences of Atools in src/ test/
walther@59779
   186
  \item xxx
walther@59779
   187
  \item drop  drop_questionmarks_
walther@59779
   188
  \item xxx
walther@59779
   189
  \item Const ("Atools.pow", _) ---> Const ("Base_Tool.pow", _) 
walther@59779
   190
  \item rename   Base_Tool.thy  <---         Base_Tool
walther@59779
   191
  \item xxx
walther@59779
   192
  \item test/..  tools.sml, atools.sml, scrtools.sml ...
walther@59779
   193
  \item xxx
walther@59779
   194
  \item Diff.thy: differentiateX --> differentiate after removal of script-constant
walther@59779
   195
  \item Test.thy: met_test_sqrt2: deleted?!
walther@59779
   196
  \item xxx
walther@59779
   197
  \item Applicable.applicable_in --> Applicable.tactic_at
walther@59779
   198
  \item xxx
walther@59779
   199
  \item adopt naming conventions in Knowledge: EqSystem --> Equation_System, etc
walther@59779
   200
  \item xxx
walther@59779
   201
  \item TermC.vars_of replace by vars (recognises numerals)
walther@59779
   202
  \item xxx
walther@59779
   203
  \item xxx
walther@59779
   204
  \end{itemize}
walther@59779
   205
\<close>
walther@59779
   206
subsection \<open>Simple but laborous\<close>
walther@59779
   207
text \<open>
walther@59779
   208
  \begin{itemize}
walther@59779
   209
  \item prep_met
walther@59779
   210
    \begin{itemize}
walther@59779
   211
    \item rename field scr in meth
walther@59779
   212
    \item xxx
walther@59779
   213
    \item Rule.rew_ord' := overwritel (! Rule.rew_ord', (*<<<---- use KEStore.xxx, too*)
walther@59779
   214
    \item xxx
walther@59779
   215
    \item check match between args of partial_function and model-pattern of meth;
walther@59779
   216
       provide error message.
walther@59779
   217
    \item xxx
walther@59779
   218
    \item automatically extrac rls from program-code 
walther@59779
   219
      ? take ["SignalProcessing", "Z_Transform", "Inverse_sub"] as an example ?
walther@59779
   220
    \item xxx
walther@59779
   221
    \item xxx
walther@59779
   222
    \item xxx
walther@59779
   223
    \end{itemize}
walther@59779
   224
  \item xxx
walther@59779
   225
  \item drop "init_form" and use "Take" in programs (start with latter!)
walther@59779
   226
  \item xxx
walther@59779
   227
  \item deprive Check_elementwise, but keep it for Minisubpl
walther@59779
   228
    (which checks for Check_Postcond separated by another tactic)
walther@59779
   229
    This seems a prerequisite for appropriate handling of contexts at Check_Postcond.
walther@59779
   230
  \item xxx
walther@59779
   231
  \end{itemize}
walther@59779
   232
\<close>
walther@59779
   233
subsection \<open>Questionable\<close>
walther@59779
   234
text \<open>
walther@59779
   235
  \begin{itemize}
walther@59779
   236
  \item finish output of trace_script with Check_Postcond (useful for SubProblem)
walther@59779
   237
  \item unify in signature LANGUAGE_TOOLS =\\
walther@59779
   238
    val pblterm: Rule.domID -> Celem.pblID -> term     vvv        vvv\\
walther@59779
   239
    val subpbl: string -> string list -> term          unify with ^^^
walther@59779
   240
  \item xxx
walther@59779
   241
  \item Telem.safe is questionable: has it been replaced by Safe_Step, Not_Derivable, Helpless, etc?
walther@59779
   242
    Note: replacement of Istate.safe by Istate.appy_ didn't care much about Telem.safe.
walther@59779
   243
    If Telem.safe is kept, consider merge with CTbasic.ostate
walther@59779
   244
  \item xxx
walther@59779
   245
  \item remove find_next_step from solve Apply_Method';
walther@59779
   246
    this enforces Pos.at_first_tactic, which should be dropped, too.
walther@59779
   247
  \item xxx
walther@59779
   248
  \item xxx
walther@59779
   249
  \end{itemize}
walther@59779
   250
\<close>
walther@59779
   251
section \<open>Major reforms\<close>
walther@59779
   252
text \<open>
walther@59779
   253
\<close>
walther@59779
   254
subsection \<open>Exception Size raised\<close>
walther@59779
   255
text \<open>
walther@59779
   256
  During update Isabelle2018 --> Isabelle2019 we noticed, that
walther@59779
   257
  "isabelle build" uses resources more efficiently than "isabelle jedit".
walther@59779
   258
  The former works, but the latter causes 
walther@59779
   259
  \begin{itemize}
walther@59779
   260
  \item "Exception- Size raised"
walther@59779
   261
    in Build_Thydata.thy
walther@59779
   262
  \item "exception Size raised (line 169 of "./basis/LibrarySupport.sml")"
walther@59779
   263
    in test/../biegelinie-*.xml.
walther@59779
   264
  \end{itemize}
walther@59779
   265
  This has been detected after changeset (30cd47104ad7) "lucin: reorganise theories in ProgLang".
walther@59779
   266
walther@59779
   267
  Find tools to investigate the Exception, and find ways around it eventually.
walther@59779
   268
\<close>
walther@59779
   269
subsection \<open>Cleanup & review signatures wrt. implementation.pdf canonical argument order\<close>
walther@59779
   270
text \<open>
walther@59779
   271
  \begin{itemize}
walther@59779
   272
  \item there are comments in several signatures
walther@59779
   273
  \item ML_file "~~/src/Tools/isac/Interpret/specification-elems.sml" can be (almost) deleted
walther@59779
   274
  \item src/../Frontend/: signatures missing
walther@59779
   275
  \item xxx
walther@59779
   276
  \end{itemize}
walther@59779
   277
\<close>
walther@59779
   278
subsection \<open>overall structure of code\<close>
walther@59779
   279
text \<open>
walther@59779
   280
  \begin{itemize}
walther@59779
   281
  \item try to separate Isac_Knowledge from MathEngine
walther@59779
   282
    common base: Knowledge_Author / ..??
walther@59779
   283
  \item xxx
walther@59779
   284
  \item  ML_file "~~/src/Tools/isac/Interpret/ctree.sml" (*shift to base in common with Interpret*)
walther@59779
   285
  \item xxx
walther@59779
   286
  \item xxx
walther@59779
   287
  \item xxx
walther@59779
   288
  \end{itemize}
walther@59779
   289
\<close>
walther@59779
   290
subsection \<open>solve, loc_solve_, by_tactic, do_next, ...\<close>
walther@59779
   291
text \<open>
walther@59779
   292
  unify to calcstate, calcstate', ?Calc.T?
walther@59779
   293
  \begin{itemize}
walther@59779
   294
  \item by_tactic Check_Postcond' needs NO 2.find_next_step
walther@59779
   295
                 solve Check_Postcond' needs, because NO prog_result in Tactic.input
walther@59779
   296
     and applicable_in cannot get it.
walther@59779
   297
  \item xxx
walther@59779
   298
  \item adopt the same for specification phase
walther@59779
   299
  \item xxx
walther@59779
   300
  \end{itemize}
walther@59779
   301
\<close>
walther@59779
   302
subsection \<open>Separate MathEngineBasic/ Specify/ Interpret/ MathEngine/\<close>
walther@59779
   303
text \<open>
walther@59779
   304
  \begin{itemize}
walther@59779
   305
  \item xxx
walther@59734
   306
  \item re-organise code for Interpret
walther@59734
   307
    \begin{itemize}
walther@59743
   308
    \item Step*:
walther@59734
   309
      \begin{itemize}
walther@59743
   310
      \item Step_Specify in Specify/step-specify.sml in analogy to Interpret/... TODO
walther@59742
   311
        \begin{itemize}
walther@59743
   312
        \item Step_Specify.check <-- Applicable.applicable_in
walther@59743
   313
        \item Step_Specify.add   <-- Generate.generate1
walther@59775
   314
        \item Step_Specify.by_formula: ?term?       -> Calc.T -> ...stay as is
walther@59742
   315
        \end{itemize}
walther@59743
   316
      \item Step_Solve in Interpret/step-solve.sml
walther@59734
   317
        \begin{itemize}
walther@59743
   318
        \item Step_Solve.check   <-- Applicable.applicable_in
walther@59746
   319
          inserts all data into Tactic.T available -- not all are at time of call!
walther@59743
   320
        \item Step_Solve.add     <-- Generate.generate1
walther@59775
   321
        \item Step_Solve.by_formula  : term         -> Calc.T -> ...stay as is
walther@59734
   322
        \end{itemize}
walther@59743
   323
      \item Step in MathEngine/step.sml
walther@59743
   324
        \begin{itemize}
walther@59743
   325
        \item Step.check     : Step_Specify.check      | Step_Solve.check      depending on pos'
walther@59746
   326
          inserts all data into Tactic.T available -- not all are at time of call!
walther@59743
   327
        \item Step.add       : Step_Specify.add        | Step_Solve.add        depending on pos'
walther@59743
   328
        \item Step.by_tactic : Step_Specify.by_tactic  | Step_Solve.by_tactic  depending on pos'
walther@59743
   329
        \item Step.by_formula: Step_Specify.by_formula | Step_Solve.by_formula depending on pos'
walther@59760
   330
        \item Step.do_next   : Step_Specify.find_next  | Step_Solve.find_next  depending on pos'
walther@59743
   331
        \end{itemize}
walther@59761
   332
      \item NOTE on mut.rec: Step.do_next calls Step_Solve.do_next + Step_Specify.do_next
walther@59761
   333
                                                                    ^ Math_Engine.nxt_specify_
walther@59762
   334
        so some restructuring is required.
walther@59761
   335
        INTERMEDIATE STEP: Step.do_next is still Math_Engine.do_next
walther@59743
   336
      \end{itemize}
walther@59734
   337
    \item xxx
walther@59734
   338
    \item xxx
walther@59734
   339
    \end{itemize}
walther@59734
   340
  \item xxx
walther@59778
   341
  \item plan separate handling of tactics for Specify/ Interpret/    
walther@59778
   342
    \begin{itemize}
walther@59778
   343
    \item already prep. MathEngineBasic/tactic-def.sml + tactic.sml
walther@59778
   344
    \item new: Specify/spec-tac.sml .. Interpret/solve-tac.sml: generate --> insert, etc
walther@59778
   345
    \item reduce occurrences of "tactic" in TODO.thy
walther@59778
   346
    \item xxx
walther@59778
   347
    \end{itemize}
walther@59778
   348
  \item xxx
walther@59778
   349
  \item ??????????? WHY CAN LucinNEW.by_tactic NOT BE REPLACED BY Step_Solve.by_tactic ???????????
walther@59778
   350
  \item xxx
walther@59778
   351
  \item ..Separate:
walther@59778
   352
    MathEngine.solve, ...,
walther@59778
   353
    ? or identify "layers" like in Isabelle?
walther@59778
   354
  \item xxx
walther@59778
   355
  \end{itemize}
walther@59778
   356
\<close>
wneuper@59574
   357
subsection \<open>Review modelling- + specification-phase\<close>
wneuper@59574
   358
text \<open>
wneuper@59574
   359
  \begin{itemize}
walther@59778
   360
  \item first do above "Separate MathEngineBasic/ Specify/ Interpret/ MathEngine/"
walther@59778
   361
  \item xxx
wneuper@59574
   362
  \item "--- hack for funpack: generalise handling of meths which extend problem items ---"
wneuper@59569
   363
    \begin{itemize}
wneuper@59574
   364
    \item see several locations of hack in code
wneuper@59574
   365
    \item these locations are NOT sufficient, see
wneuper@59574
   366
      test/../biegelinie-3.sml --- IntegrierenUndKonstanteBestimmen2: Bsp.7.70. auto ---
wneuper@59574
   367
    \item "fun associate" "match_ags ..dI" instead "..pI" breaks many tests, however,
wneuper@59574
   368
      this would be according to survey Notes (3) in src/../calchead.sml.
wneuper@59574
   369
    \end{itemize}
wneuper@59574
   370
  \item see "failed trial to generalise handling of meths"98298342fb6d
wneuper@59574
   371
  \item abstract specify + nxt_specif to common aux-funs;
wneuper@59574
   372
    see e.g. "--- hack for funpack: generalise handling of meths which extend problem items ---"
wneuper@59574
   373
  \item xxx
wneuper@59574
   374
  \item type model = itm list ?
wneuper@59574
   375
  \item review survey Notes in src/../calchead.sml: they are questionable
wneuper@59574
   376
  \item review copy-named, probably two issues commingled 
wneuper@59574
   377
    \begin{itemize}
wneuper@59574
   378
    \item special handling of "#Find#, because it is not a formal argument of partial_function
wneuper@59574
   379
    \item special naming for solutions of equation solving: x_1, x_2, ...
wneuper@59569
   380
    \end{itemize}
wneuper@59569
   381
  \item xxx
walther@59634
   382
  \item structure Tactic Specify -?-> Proglang (would require Model., Selem.)
walther@59634
   383
  \item xxx
wneuper@59574
   384
  \item this has been written in one go:
wneuper@59574
   385
    \begin{itemize}
wneuper@59574
   386
    \item reconsidering Model.max_vt, use problem with meth ["DiffApp","max_by_calculus"]
wneuper@59574
   387
    \item reconsider add_field': where is it used for what? Shift into mk_oris
wneuper@59574
   388
    \item reconsider match_itms_oris: where is it used for what? max_vt ONLY???
wneuper@59574
   389
    \item in Specify_Method search root-oris for items (e.g. "errorBound"), #1# in survey
wneuper@59574
   390
    \item Specify_Problem, Specify_Method: check respective identifiers after re-Specify_
wneuper@59574
   391
      (relevant for pre-condition)
wneuper@59574
   392
    \item unify match_ags to mk_oris1..N with different args (fmz | pat list, pbl | meth
wneuper@59574
   393
    \item 
wneuper@59574
   394
    \end{itemize}
wneuper@59574
   395
  \end{itemize}
wneuper@59574
   396
\<close>
wneuper@59574
   397
subsection \<open>taci list, type step\<close>
wneuper@59574
   398
text \<open>
walther@59762
   399
taci was, most likely, invented to make "fun me" more efficient by avoiding duplicate rewrite,
walther@59762
   400
and probably, because the Kernel interface separated setNextTactic and applyTactic.
walther@59762
   401
Both are no good reasons to make code more complicated. For instance Math_Engine.do_next
walther@59775
   402
could drop half of the code. So try to use Calc.T only.
wneuper@59574
   403
  \begin{itemize}
walther@59762
   404
  \item xxx
walther@59775
   405
  \item Step* functions should return Calc.T instead of Chead.calcstate'
walther@59762
   406
  \item xxx
wneuper@59574
   407
  \item states.sml: check, when "length tacis > 1"
wneuper@59574
   408
  \item in Test_Isac.thy there is only 1 error in Interpret/inform.sml
wneuper@59574
   409
  \item (*WN190713 REMOVE: "creating a new node" was never implemented for more than one node?!?
wneuper@59569
   410
  \item xxx
walther@59762
   411
  \item brute force setting all empty ([], [], ptp) but ptp causes errors -- investigate!
walther@59762
   412
  \item xxx
wneuper@59573
   413
  \end{itemize}
wneuper@59574
   414
\<close>
wneuper@59574
   415
subsection \<open>Ctree\<close>
wneuper@59574
   416
text \<open>
wneuper@59568
   417
  \begin{itemize}
wneuper@59574
   418
  \item review get_ctxt, update_ctxt, get_istate, upd_istate, upd_ctxt,
wneuper@59574
   419
    <---> update_loc', repl_loc (remove the latter)
wneuper@59568
   420
  \item delete field ctxt in PblObj in favour of loc
wneuper@59568
   421
  \item xxx
wneuper@59574
   422
  \item xxx
wneuper@59568
   423
  \end{itemize}
wneuper@59574
   424
\<close>
wneuper@59574
   425
subsection \<open>replace theory/thy by context/ctxt\<close>
wneuper@59574
   426
text \<open>
wneuper@59574
   427
  \begin{itemize}
walther@59660
   428
  \item xxx
walther@59748
   429
  \item Specify/ works with thy | Interpret/ works with ctxt | MathEngine.step works with ?!?ctxt
walther@59748
   430
    special case: Tactic.Refine_Problem
walther@59748
   431
  \item xxx
walther@59748
   432
  \item theory can be retrieved from ctxt by Proof_Context.theory_of
walther@59660
   433
  \item xxx
wneuper@59577
   434
  \item cleaup the many conversions string -- theory
wneuper@59577
   435
  \item make dest_spec --> (theory, pblID, metID) ?+ common_subthy ?
wneuper@59574
   436
  \item 1. Rewrite.eval_true_, then
walther@59772
   437
    Lucin.check_leaf, Rewrite.eval_prog_expr, Generate.generate1, Lucin.stac2tac.
wneuper@59577
   438
  \item fun associate
wneuper@59592
   439
    let val thy = Celem.assoc_thy "Isac_Knowledge";(*TODO*)
wneuper@59574
   440
  \item xxx
wneuper@59574
   441
  \item xxx
wneuper@59577
   442
  \item xxx
wneuper@59574
   443
  \end{itemize}
wneuper@59574
   444
\<close>
wneuper@59583
   445
subsection \<open>Rfuns, Begin_/End_Detail', Rrls, Istate\<close>
wneuper@59574
   446
text \<open>
wneuper@59562
   447
  \begin{itemize}
wneuper@59573
   448
  \item removing from_pblobj_or_detail' causes many strange errors
wneuper@59573
   449
  \item ^^^+ see from_pblobj_or_detail_thm, from_pblobj_or_detail_calc, ...
wneuper@59573
   450
  \item xxx
wneuper@59569
   451
  \item probably only "normal_form" seems to be needed
wneuper@59569
   452
  \item deleted Rfuns in NEW "locate_input_tactic": no active test for "locate_rule"
wneuper@59569
   453
    but that seems desirable
wneuper@59569
   454
  \item ?how is the relation to reverse-rewriting ???
wneuper@59569
   455
  \item "Rfuns" markers in test/../rational
wneuper@59562
   456
  \item xxx
walther@59667
   457
  \item datatype istate (Istate.T): remove RrlsState, pstate: use Rrls only for creating results beyond
wneuper@59573
   458
    rewriting and/or respective intermediate steps (e.g. cancellation of fractions).
wneuper@59583
   459
    Thus we get a 1-step-action which does NOT require a state beyond istate/pstate.
wneuper@59573
   460
    Thus we drastically reduce complexity, also get rid of "fun from_pblobj_or_detail_calc" , etc.
wneuper@59573
   461
  \item debug ^^^ related: is there an occurence of Steps with more than 1 element?
wneuper@59569
   462
  \item xxx
walther@59760
   463
  \item and do_next (* WN1907: ?only for Begin_/End_Detail' DEL!!!*)
wneuper@59573
   464
  \item xxx
wneuper@59573
   465
  \item shouldn't go Rfuns from Rewrite --> Rewrite_Set; they behave similar to "fun interSteps" ?
wneuper@59562
   466
  \end{itemize}
wneuper@59574
   467
\<close>
wneuper@59574
   468
subsection \<open>Inverse_Z_Transform.thy\<close>
wneuper@59574
   469
text \<open>
wneuper@59538
   470
  \begin{itemize}
wneuper@59550
   471
  \item\label{new-var-rhs} rule1..6, ruleZY introduce new variables on the rhs of the rewrite-rule.
wneuper@59550
   472
  ? replace rewriting with substitution ?!?
wneuper@59537
   473
  The problem is related to the decision of typing for "d_d" and making bound variables free (while
wneuper@59550
   474
  shifting specific handling in equation solving etc. to the meta-logic). 
wneuper@59550
   475
  \item Find "stepResponse (x[n::real]::bool)" is superfluous, because immediately used by
wneuper@59550
   476
    rewrite-rules; see \ref{new-var-rhs}.
wneuper@59538
   477
  \item Reconsider whole problem:
wneuper@59538
   478
    input only the polynomial as argument of partial_function, in ([1], Frm) compile lhs "X z" ?
wneuper@59538
   479
  \end{itemize}
wneuper@59574
   480
\<close>
wneuper@59574
   481
subsection \<open>Adopt Isabelle's numerals for Isac\<close>
wneuper@59574
   482
text \<open>
wneuper@59540
   483
  \begin{itemize}
wneuper@59574
   484
  \item replace numerals of type "real" by "nat" in some specific functions from ListC.thy
wneuper@59574
   485
    and have both representations in parallel for "nat".
wneuper@59574
   486
  \item xxx
wneuper@59574
   487
  \item xxx
wneuper@59540
   488
  \end{itemize}
wneuper@59574
   489
\<close>
walther@59636
   490
subsection \<open>Auto_Prog\<close>
wneuper@59588
   491
text \<open>
walther@59636
   492
two issues:
walther@59636
   493
(1) fun prep_rls creates a Program with too general and wrong types.
walther@59636
   494
(2) generated Programs (huge since strings are coded in ASCII) stored in rls drives
walther@59636
   495
    Build_Thydata towards limits of resources.
walther@59636
   496
  \begin{itemize}
walther@59636
   497
  \item rename Auto_Prog.prep_rls --> Auto_Prog.generate
walther@59636
   498
  \item Auto_Prog.generate : term -> rls -> (*Program*)term
walther@59636
   499
     Ctree.current_formula---^^^^
walther@59636
   500
  \item xxx
walther@59636
   501
  \item xxx
walther@59636
   502
  \item generate Program on demand in from_pblobj_or_detail'
walther@59636
   503
  \item xxx
walther@59636
   504
  \item xxx
walther@59636
   505
  \end{itemize}
walther@59636
   506
\<close>
wneuper@59591
   507
subsection \<open>Redesign thms for equation solver\<close>
wneuper@59591
   508
text \<open>
wneuper@59591
   509
  Existing solver is structured along the WRONG assumption,
wneuper@59591
   510
  that Poly.thy must be the LAST thy among all thys involved.
wneuper@59591
   511
wneuper@59591
   512
  Preliminary solution: all inappropriately located thms are collected in Base_Tools.thy
wneuper@59591
   513
\<close>
wneuper@59574
   514
subsection \<open>Finetunig required for xmldata\<close>
wneuper@59574
   515
text \<open>
wneuper@59574
   516
  See xmldata https://intra.ist.tugraz.at/hg/isac/rev/5b222a649390
wneuper@59574
   517
  and in kbase html-representation generated from these xmldata.
wneuper@59574
   518
  Notes in ~~/xmldata/TODO.txt.
wneuper@59574
   519
\<close>
wneuper@59574
   520
wneuper@59574
   521
section \<open>Hints for further development\<close>
wneuper@59574
   522
text \<open>
wneuper@59574
   523
\<close>
wneuper@59591
   524
subsection \<open>Coding standards & some explanations for math-authors\<close>
wneuper@59591
   525
text \<open>copy from doc/math-eng.tex WN.28.3.03
wneuper@59591
   526
WN071228 extended\<close>
wneuper@59591
   527
wneuper@59591
   528
subsubsection \<open>Identifiers\<close>
wneuper@59591
   529
text \<open>Naming is particularily crucial, because Isabelles name space is global, and isac does
wneuper@59591
   530
  not yet use the novel locale features introduces by Isar. For instance, {\tt probe} sounds
wneuper@59591
   531
  reasonable as (1) a description in the model of a problem-pattern, (2) as an element of the
wneuper@59591
   532
  problem hierarchies key, (3) as a socalled CAS-command, (4) as the name of a related script etc.
wneuper@59591
   533
  However, all the cases (1)..(4) require different typing for one and the same
wneuper@59591
   534
  identifier {\tt probe} which is impossible, and actually leads to strange errors
wneuper@59591
   535
  (for instance (1) is used as string, except in a script addressing a Subproblem).
wneuper@59591
   536
wneuper@59591
   537
  These are the preliminary rules for naming identifiers>
wneuper@59591
   538
  \begin{description}
wneuper@59591
   539
  \item [elements of a key] into the hierarchy of problems or methods must not contain
wneuper@59591
   540
    capital letters and may contain underscrores, e.g. {\tt probe, for_polynomials}.
wneuper@59591
   541
  \item [descriptions in problem-patterns] must contain at least 1 capital letter and
wneuper@59591
   542
    must not contain underscores, e.g. {\tt Probe, forPolynomials}.
wneuper@59591
   543
  \item [CAS-commands] follow the same rules as descriptions in problem-patterns above, thus
wneuper@59591
   544
    beware of conflicts~!
wneuper@59591
   545
  \item [script identifiers] always end with {\tt Program}, e.g. {\tt ProbeScript}.
wneuper@59591
   546
  \item [???] ???
wneuper@59591
   547
  \item [???] ???
wneuper@59591
   548
  \end{description}
wneuper@59591
   549
%WN071228 extended\<close>
wneuper@59591
   550
wneuper@59591
   551
subsubsection \<open>Rule sets\<close>
wneuper@59591
   552
text \<open>The actual version of the coding standards for rulesets is in {\tt /IsacKnowledge/Atools.ML
wneuper@59591
   553
  where it can be viewed using the knowledge browsers.
wneuper@59591
   554
wneuper@59591
   555
  There are rulesets visible to the student, and there are rulesets visible (in general) only for
wneuper@59591
   556
  math authors. There are also rulesets which {\em must} exist for {\em each} theory;
wneuper@59591
   557
  these contain the identifier of the respective theory (including all capital letters) 
wneuper@59591
   558
  as indicated by {\it Thy} below.
wneuper@59591
   559
wneuper@59591
   560
  \begin{description}
wneuper@59591
   561
  \item [norm\_{\it Thy}] exists for each theory, and {\em efficiently} calculates a
wneuper@59591
   562
    normalform for all terms which can be expressed by the definitions of the respective theory
wneuper@59591
   563
    (and the respective parents).
wneuper@59591
   564
  \item [simplify\_{\it Thy}] exists for each theory, and calculates a normalform for all terms
wneuper@59591
   565
    which can be expressed by the definitions of the respective theory (and the respective parents)
wneuper@59591
   566
    such, that the rewrites can be presented to the student.
wneuper@59591
   567
  \item [calculate\_{\it Thy}] exists for each theory, and evaluates terms with 
wneuper@59591
   568
    numerical constants only (i.e. all terms which can be expressed by the definitions of
wneuper@59591
   569
    the respective theory and the respective parent theories). In particular, this ruleset includes
wneuper@59591
   570
    evaluating in/equalities with numerical constants only.
wneuper@59591
   571
    WN.3.7.03: may be dropped due to more generality: numericals and non-numericals
wneuper@59591
   572
    are logically equivalent, where the latter often add to the assumptions
wneuper@59591
   573
    (e.g. in Check_elementwise).
wneuper@59591
   574
  \end{description}
wneuper@59591
   575
wneuper@59591
   576
  The above rulesets are all visible to the user, and also may be input; 
wneuper@59591
   577
  thus they must be contained in {\tt Theory_Data} (KEStore_Elems.add_rlss,
wneuper@59591
   578
  KEStore_Elems.get_rlss). All these rulesets must undergo a preparation
wneuper@59591
   579
  using the function {\tt prep_rls'}, which generates a script for stepwise rewriting etc.
wneuper@59591
   580
  The following rulesets are used for internal purposes and usually invisible to the (naive) user:
wneuper@59591
   581
wneuper@59591
   582
  \begin{description}
wneuper@59591
   583
  \item [*\_erls] TODO
wneuper@59591
   584
  \item [*\_prls] 
wneuper@59591
   585
  \item [*\_srls] 
wneuper@59591
   586
  \end{description}
wneuper@59591
   587
{\tt Rule.append_rls, Rule.merge_rls, remove_rls} TODO
wneuper@59591
   588
\<close>
wneuper@59591
   589
wneuper@59574
   590
subsection \<open>get proof-state\<close>
wneuper@59574
   591
text \<open>
wneuper@59574
   592
  Re: [isabelle] Programatically get "this"
wneuper@59574
   593
  ----------------------------------------------------
wneuper@59574
   594
  So here is my (Makarius') version of your initial example, following these principles:
wneuper@59574
   595
  begin{verbatim}
wneuper@59574
   596
    notepad
wneuper@59574
   597
    begin
wneuper@59574
   598
      assume a: A
wneuper@59574
   599
      ML_val \<open>
wneuper@59574
   600
        val ctxt = @{context};
wneuper@59558
   601
    
wneuper@59574
   602
        val this_name =
walther@59748
   603
          Name_Space.full_name (Proof_Context.naming_of ctxt) (Binding.name Auto_Bind.thisN);
wneuper@59574
   604
        val this = #thms (the (Proof_Context.lookup_fact ctxt this_name));
wneuper@59574
   605
      \<close>
wneuper@59574
   606
    end
wneuper@59574
   607
  end{verbatim}
wneuper@59574
   608
\<close>
wneuper@59574
   609
subsection \<open>write Specification to jEdit\<close>
wneuper@59574
   610
text \<open>
wneuper@59574
   611
  Re: [isabelle] Printing terms with type annotations
wneuper@59574
   612
  ----------------------------------------------------
wneuper@59574
   613
  On 06/02/2019 17:52, Moa Johansson wrote:
wneuper@59574
   614
  >
wneuper@59574
   615
  > I’m writing some code that should create a snippet of Isar script.
wneuper@59574
   616
  
wneuper@59574
   617
  This is how Sledgehammer approximates this:
wneuper@59574
   618
  
wneuper@59574
   619
  http://isabelle.in.tum.de/repos/isabelle/file/Isabelle2018/src/HOL/Tools/Sledgehammer/sledgehammer_isar_proof.ML#l299
wneuper@59574
   620
  
wneuper@59574
   621
  (The module name already shows that the proper terminology is "Isar
wneuper@59574
   622
  proof" (or "Isar proof text").  Proof scripts are a thing from the past,
wneuper@59574
   623
  before Isar. You can emulate old-style proof scripts via a sequence of
wneuper@59574
   624
  'apply' commands, but this is improper Isar.)
wneuper@59574
   625
  
wneuper@59574
   626
  Note that there is no standard function in Isabelle/Pure, because the
wneuper@59574
   627
  problem to print just the right amount of type information is very
wneuper@59574
   628
  complex and not fully solved. One day, after 1 or 2 rounds of
wneuper@59574
   629
  refinements over the above approach, it might become generally available.
wneuper@59574
   630
\<close>
wneuper@59574
   631
subsection \<open>follow Isabelle conventions (*Does not yet work in Isabelle2018\<close>
wneuper@59574
   632
text \<open>
wneuper@59574
   633
  isabelle update -u path_cartouches
wneuper@59574
   634
  isabelle update -u inner_syntax_cartouches
wneuper@59574
   635
\<close>
wneuper@59582
   636
section \<open>Questions to Isabelle experts\<close>
wneuper@59582
   637
text \<open>
wneuper@59582
   638
\begin{itemize}
wneuper@59591
   639
\item what is the actual replacement of "hg log --follow" ?
wneuper@59591
   640
\item xxx
wneuper@59582
   641
\item how HANDLE these exceptions, e.g.:
wneuper@59582
   642
    Syntax.read_term ctxt "Randbedingungen y 0 = (0::real), y L = 0, M_b 0 = 0, M_b L = 0]"
wneuper@59582
   643
  GIVES
wneuper@59582
   644
    "Inner syntax error
wneuper@59582
   645
     Failed to parse term"
wneuper@59582
   646
\item xxx
walther@59734
   647
\item how cope with "exception Size raised (line 171 of "./basis/LibrarySupport.sml")"
walther@59734
   648
  e.g. in test/Interpret/lucas-interpreter.sml
wneuper@59582
   649
\item xxx
wneuper@59582
   650
\item xxx
wneuper@59582
   651
\end{itemize}
wneuper@59582
   652
\<close>
wneuper@59582
   653
wneuper@59574
   654
section \<open>For copy & paste\<close>
wneuper@59574
   655
text \<open>
wneuper@59582
   656
\begin{itemize}
walther@59778
   657
\item xxx
wneuper@59558
   658
  \begin{itemize}
wneuper@59558
   659
  \item xxx
wneuper@59540
   660
    \begin{itemize}
wneuper@59558
   661
    \item xxx
wneuper@59540
   662
      \begin{itemize}
wneuper@59558
   663
      \item xxx
wneuper@59574
   664
        \begin{itemize}
wneuper@59574
   665
        \item xxx
wneuper@59574
   666
        \end{itemize}
wneuper@59540
   667
      \end{itemize}
wneuper@59540
   668
    \end{itemize}
wneuper@59504
   669
  \end{itemize}
wneuper@59504
   670
\end{itemize}
wneuper@59504
   671
\<close>
wneuper@59574
   672
subsection \<open>xxx\<close>
wneuper@59574
   673
subsubsection \<open>xxx\<close>
neuper@52150
   674
end