thys/Data_slot.thy
author ibm-PC\ibm <xingyuanzhang@126.com>
Fri, 12 Sep 2014 00:47:15 +0800
changeset 24 77daf1b85cf0
parent 0 1378b654acde
permissions -rw-r--r--
new change

theory Data_slot
imports Main
begin

ML {*
  fun ML_exec prog = ML_Compiler.eval true Position.none
                        (ML_Lex.tokenize prog)

  fun prog_data_slot name tp empty  = 
  "structure " ^ name ^ " = Theory_Data ( " ^
  "type T = "^ tp ^" " ^
  "val empty = " ^ empty ^ " ; "^
  "val extend = I; "^
  "fun merge (x, y) = x) "^
  "fun "^ name ^ "_store v =  Context.>>(Context.map_theory (" ^ name ^".map (fn x => v))) "^
  "fun "^ name ^ "_get () = Context.>>>(Context.map_theory_result (fn th => "^
  "                                     ("^ name ^".get th, th))) "

  fun data_slot name tp empty  = ML_exec (prog_data_slot name tp empty)
  val empty_term = @{term "x"}
  val empty_cterm = @{cterm "x"}
  val empty_thm = @{thm ext}
*}

end