src/ZF/Tools/typechk.ML
changeset 61268 abe08fb15a12
parent 60774 6c28d8ed2488
child 64556 851ae0e7b09c
equal deleted inserted replaced
61267:0b6217fda81b 61268:abe08fb15a12
    24  {rules: thm list,     (*the type-checking rules*)
    24  {rules: thm list,     (*the type-checking rules*)
    25   net: thm Net.net};   (*discrimination net of the same rules*)
    25   net: thm Net.net};   (*discrimination net of the same rules*)
    26 
    26 
    27 fun add_rule ctxt th (tcs as TC {rules, net}) =
    27 fun add_rule ctxt th (tcs as TC {rules, net}) =
    28   if member Thm.eq_thm_prop rules th then
    28   if member Thm.eq_thm_prop rules th then
    29     (warning ("Ignoring duplicate type-checking rule\n" ^ Display.string_of_thm ctxt th); tcs)
    29     (warning ("Ignoring duplicate type-checking rule\n" ^ Thm.string_of_thm ctxt th); tcs)
    30   else
    30   else
    31     TC {rules = th :: rules, net = Net.insert_term (K false) (Thm.concl_of th, th) net};
    31     TC {rules = th :: rules, net = Net.insert_term (K false) (Thm.concl_of th, th) net};
    32 
    32 
    33 fun del_rule ctxt th (tcs as TC {rules, net}) =
    33 fun del_rule ctxt th (tcs as TC {rules, net}) =
    34   if member Thm.eq_thm_prop rules th then
    34   if member Thm.eq_thm_prop rules th then
    35     TC {net = Net.delete_term Thm.eq_thm_prop (Thm.concl_of th, th) net,
    35     TC {net = Net.delete_term Thm.eq_thm_prop (Thm.concl_of th, th) net,
    36       rules = remove Thm.eq_thm_prop th rules}
    36       rules = remove Thm.eq_thm_prop th rules}
    37   else (warning ("No such type-checking rule\n" ^ Display.string_of_thm ctxt th); tcs);
    37   else (warning ("No such type-checking rule\n" ^ Thm.string_of_thm ctxt th); tcs);
    38 
    38 
    39 
    39 
    40 (* generic data *)
    40 (* generic data *)
    41 
    41 
    42 structure Data = Generic_Data
    42 structure Data = Generic_Data
    59 val tcset_of = Data.get o Context.Proof;
    59 val tcset_of = Data.get o Context.Proof;
    60 
    60 
    61 fun print_tcset ctxt =
    61 fun print_tcset ctxt =
    62   let val TC {rules, ...} = tcset_of ctxt in
    62   let val TC {rules, ...} = tcset_of ctxt in
    63     Pretty.writeln (Pretty.big_list "type-checking rules:"
    63     Pretty.writeln (Pretty.big_list "type-checking rules:"
    64       (map (Display.pretty_thm_item ctxt) rules))
    64       (map (Thm.pretty_thm_item ctxt) rules))
    65   end;
    65   end;
    66 
    66 
    67 
    67 
    68 (* tactics *)
    68 (* tactics *)
    69 
    69