src/Provers/classical.ML
changeset 5001 9de7fda0a6df
parent 4854 d1850e0964f2
child 5028 61c10aad3d71
equal deleted inserted replaced
5000:9271b89c7e2c 5001:9de7fda0a6df
    24 type netpair = (int * (bool * thm)) Net.net * (int * (bool * thm)) Net.net;
    24 type netpair = (int * (bool * thm)) Net.net * (int * (bool * thm)) Net.net;
    25 type wrapper = (int -> tactic) -> (int -> tactic);
    25 type wrapper = (int -> tactic) -> (int -> tactic);
    26 
    26 
    27 signature CLASET_THY_DATA =
    27 signature CLASET_THY_DATA =
    28 sig
    28 sig
    29   val clasetK: string
    29   val clasetN: string
    30   exception ClasetData of object ref
    30   val clasetK: Object.kind
       
    31   exception ClasetData of Object.T ref
    31   val setup: (theory -> theory) list
    32   val setup: (theory -> theory) list
    32   val fix_methods: object * (object -> object) *
    33   val fix_methods: Object.T * (Object.T -> Object.T) *
    33     (object * object -> object) * (Sign.sg -> object -> unit) -> unit
    34     (Object.T * Object.T -> Object.T) * (Sign.sg -> Object.T -> unit) -> unit
    34 end;
    35 end;
    35 
    36 
    36 signature CLASSICAL_DATA =
    37 signature CLASSICAL_DATA =
    37 sig
    38 sig
    38   val mp	: thm    	(* [| P-->Q;  P |] ==> Q *)
    39   val mp	: thm    	(* [| P-->Q;  P |] ==> Q *)
   137 structure ClasetThyData: CLASET_THY_DATA =
   138 structure ClasetThyData: CLASET_THY_DATA =
   138 struct
   139 struct
   139 
   140 
   140 (* data kind claset -- forward declaration *)
   141 (* data kind claset -- forward declaration *)
   141 
   142 
   142 val clasetK = "Provers/claset";
   143 val clasetN = "Provers/claset";
   143 exception ClasetData of object ref;
   144 val clasetK = Object.kind clasetN;
       
   145 exception ClasetData of Object.T ref;
   144 
   146 
   145 local
   147 local
   146   fun undef _ = raise Match;
   148   fun undef _ = raise Match;
   147 
   149 
   148   val empty_ref = ref ERROR;
   150   val empty_ref = ref ERROR;
   149   val prep_ext_fn = ref (undef: object -> object);
   151   val prep_ext_fn = ref (undef: Object.T -> Object.T);
   150   val merge_fn = ref (undef: object * object -> object);
   152   val merge_fn = ref (undef: Object.T * Object.T -> Object.T);
   151   val print_fn = ref (undef: Sign.sg -> object -> unit);
   153   val print_fn = ref (undef: Sign.sg -> Object.T -> unit);
   152 
   154 
   153   val empty = ClasetData empty_ref;
   155   val empty = ClasetData empty_ref;
   154   fun prep_ext exn = ! prep_ext_fn exn;
   156   fun prep_ext exn = ! prep_ext_fn exn;
   155   fun merge exn = ! merge_fn exn;
   157   fun merge exn = ! merge_fn exn;
   156   fun print sg exn = ! print_fn sg exn;
   158   fun print sg exn = ! print_fn sg exn;
   157 in
   159 in
   158   val setup = [Theory.init_data [(clasetK, (empty, prep_ext, merge, print))]];
   160   val setup = [Theory.init_data clasetK (empty, prep_ext, merge, print)];
   159   fun fix_methods (e, ext, mrg, prt) =
   161   fun fix_methods (e, ext, mrg, prt) =
   160     (empty_ref := e; prep_ext_fn := ext; merge_fn := mrg; print_fn := prt);
   162     (empty_ref := e; prep_ext_fn := ext; merge_fn := mrg; print_fn := prt);
   161 end;
   163 end;
   162 
   164 
   163 
   165 
   752 end;
   754 end;
   753 
   755 
   754 
   756 
   755 (* access claset *)
   757 (* access claset *)
   756 
   758 
   757 fun print_claset thy = Display.print_data thy clasetK;
   759 val print_claset = Theory.print_data clasetK;
   758 
   760 
   759 fun claset_ref_of_sg sg =
   761 val claset_ref_of_sg = Sign.get_data clasetK (fn ClasetData (ref (CSData r)) => r);
   760   (case Sign.get_data sg clasetK of
       
   761     ClasetData (ref (CSData r)) => r
       
   762   | _ => type_error clasetK);
       
   763 
   762 
   764 val claset_ref_of = claset_ref_of_sg o sign_of;
   763 val claset_ref_of = claset_ref_of_sg o sign_of;
   765 val claset_of_sg = ! o claset_ref_of_sg;
   764 val claset_of_sg = ! o claset_ref_of_sg;
   766 val claset_of = claset_of_sg o sign_of;
   765 val claset_of = claset_of_sg o sign_of;
   767 
   766