src/Tools/isac/Isac_Mathengine.thy
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 19 Aug 2010 12:00:46 +0200
branchisac-update-Isa09-2
changeset 37928 dfec2cf32f77
parent 37927 183e35109dda
child 37930 f2b8d1b3fcc2
permissions -rw-r--r--
updated ME/generate
     1 (*  Title:   ~~~/isac/Isac_Mathengine.thy
     2     Author: Walther Neuper, TU Graz
     3 
     4 $ cd /usr/local/Isabelle2009-1/src/Tools/isac
     5 $ /usr/local/isabisac/bin/isabelle emacs Isac_Mathengine.thy &
     6 $ /usr/local/isabisac/bin/isabelle jedit Isac_Mathengine.thy &
     7 
     8 OR tty (unusable: after errors wrong toplevel):
     9 $ cd "/home/neuper/proto2/isac/src/sml"
    10 $ isabelle-process HOL HOL-Isac
    11 ML> use_thy "Isac_Mathengine"; 
    12 
    13 12345678901234567890123456789012345678901234567890123456789012345678901234567890
    14         10        20        30        40        50        60        70        80
    15 *)
    16 
    17 header {* Loading the isac mathengine *}
    18 
    19 theory Isac_Mathengine
    20 (*imports Complex_Main*)
    21 imports Complex_Main "Scripts/Script" (*ListG, Tools, Script*)
    22 begin
    23 
    24 ML {* Toplevel.debug := true; *}
    25 use "library.sml"
    26 use "calcelems.sml"
    27 ML {* check_guhs_unique := true *}
    28 
    29 use "Scripts/term_G.sml"
    30 use "Scripts/calculate.sml"
    31 use "Scripts/rewrite.sml"
    32 use_thy"Scripts/Script"
    33 use "Scripts/scrtools.sml"
    34 
    35 use "ME/mstools.sml"
    36 use "ME/ctree.sml"
    37 use "ME/ptyps.sml"
    38 use "ME/generate.sml"
    39 
    40 ML {*
    41 thy2ctxt;
    42 *}
    43 
    44 
    45 
    46 (*
    47 use "ME/calchead.sml"
    48 use "ME/appl.sml"
    49 use "ME/rewtools.sml"
    50 use "ME/script.sml"
    51 use "ME/solve.sml"
    52 use "ME/inform.sml"
    53 use "ME/mathengine.sml"
    54 
    55 use "xmlsrc/mathml.sml"
    56 use "xmlsrc/datatypes.sml"
    57 use "xmlsrc/pbl-met-hierarchy.sml"
    58 use "xmlsrc/thy-hierarchy.sml" 
    59 use "xmlsrc/interface-xml.sml"
    60 
    61 use "FE-interface/messages.sml"
    62 use "FE-interface/states.sml"
    63 use "FE-interface/interface.sml"
    64 
    65 use "print_exn_G.sml"
    66 
    67 text "**** build math-engine complete *************************"
    68 *)(*
    69 setup {*
    70   Code_Preproc.setup
    71   #> Code_ML.setup
    72   #> Code_Haskell.setup
    73   #> Nbe.setup
    74 *}
    75 *)
    76 
    77 (*--------------------------shift to some isac-10 -------------------
    78 (*cleaner output from...*)
    79 ML_command {*
    80 "----- ";
    81 writeln "werwerw";
    82 *}
    83 
    84 ML {* @{prop "False"} *}
    85 (*ML {* @{type "int"} *} only new version*)
    86 ML {* @{thm  conjI} *}
    87 ML {* @{thms  conjI TrueI} *}
    88 ML {* @{theory} *}
    89 
    90 ML{* @{const_name plus} *} (*creates long names (extern names)*)
    91 term plus
    92 
    93 term foo
    94 (*ML{* @{const_name foo} *}  only new version*)
    95  
    96 text {*
    97 werwer
    98  *}
    99 
   100 ML {*
   101   fun inc_by_five x =
   102   x |> (fn x => x + 1)
   103 *}
   104 
   105 (*canonical argument order introduced after 1997*)
   106 
   107 text{*
   108 this is the most appropriate fold for lists (generalizes to lists of lists by (fold o fold o fold))
   109 @{ML fold}
   110 
   111 @{ML fold_rev}
   112 
   113 for accumulating side results in |>
   114 @{ML fold_map}
   115 *}
   116 
   117 ML {* 
   118   val items = 1 upto 10;
   119   val l1 = fold cons items []; (*alternating useful frequently*)
   120 *}
   121 
   122 ML{*
   123   fun merge_list eq (xs, ys) = fold_rev (insert eq) ys xs;
   124 *}
   125 ML{*
   126   merge_list (op =) ([3,2,1], [7,5,3,1]);
   127   merge_list (op =) ([3,2,1], [7,5,3,1]);
   128 *}
   129 
   130 (*session 2-------Christian+Makarius---------------*)
   131 ML{*
   132 let
   133   val ctxt = @{context}
   134 in 1 end
   135 *}
   136 
   137 (* build and handle tables THIS IS THE ACCESS-STRUCTURE...
   138 ML{*
   139   structure Data = Theory_Data
   140   (
   141     type T = term Symtab.table
   142     val empty = Symtab.empty
   143     val extend = O
   144     fun merge (t1, t2) = Symtab.merge (op = ) (t1, t2)
   145   )
   146 *}
   147 *)
   148 (*session 3-------Blanchette--------------------
   149 working on nitpic, ML level tool
   150 
   151 SEE THESE LECTURE NOTES !!!*)
   152 
   153 (*
   154 ML{*
   155 Const ("x", dummyT) |> Syntax.check_term @{context}
   156                        ^^^^^^^^^^^^^^^^^
   157 *}
   158 *)
   159 
   160 text{*
   161 SEE funs for 
   162 # deleting identifiers
   163 # handle Bounds when made visible
   164 # kill trivial quantifiers, e.g. \foral x. (NO x)
   165 # handling name clashes in Abs
   166 # which constants, free vars ... occur in a term !!!!!!!!!!!
   167 # Var (("x", 2), dummyT)   ... 25 old from Larry "maxidx"
   168 # get fresh Const, Var
   169 # use the "Name" structure
   170 
   171 *}
   172 
   173 ML{* val context = Name.make_context ["d"] *}
   174 
   175 (*
   176 ML{* Name.invents context "foo" 10  *}
   177 (*ML{* Name variants ... *}*)
   178 *)
   179 --------------------------shift to some isac-10 -------------------*)
   180 
   181 end
   182