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