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