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