src/Provers/classical.ML
changeset 9408 d3d56e1d2ec1
parent 9402 480a1b40fdd6
child 9441 e729ea747250
equal deleted inserted replaced
9407:e8f6d918fde9 9408:d3d56e1d2ec1
   325 
   325 
   326 (*Warn if the rule is already present ELSEWHERE in the claset.  The addition
   326 (*Warn if the rule is already present ELSEWHERE in the claset.  The addition
   327   is still allowed.*)
   327   is still allowed.*)
   328 fun warn_dup th (CS{safeIs, safeEs, hazIs, hazEs, xtraIs, xtraEs, ...}) = 
   328 fun warn_dup th (CS{safeIs, safeEs, hazIs, hazEs, xtraIs, xtraEs, ...}) = 
   329        if mem_thm (th, safeIs) then 
   329        if mem_thm (th, safeIs) then 
   330 	 warning ("Rule already declared as safe introduction (intro)\n" ^ string_of_thm th)
   330 	 warning ("Rule already declared as safe introduction (intro!)\n" ^ string_of_thm th)
   331   else if mem_thm (th, safeEs) then
   331   else if mem_thm (th, safeEs) then
   332          warning ("Rule already declared as safe elimination (elim)\n" ^ string_of_thm th)
   332          warning ("Rule already declared as safe elimination (elim!)\n" ^ string_of_thm th)
   333   else if mem_thm (th, hazIs) then 
   333   else if mem_thm (th, hazIs) then 
   334          warning ("Rule already declared as unsafe introduction (intro?)\n" ^ string_of_thm th)
   334          warning ("Rule already declared as unsafe introduction (intro)\n" ^ string_of_thm th)
   335   else if mem_thm (th, hazEs) then 
   335   else if mem_thm (th, hazEs) then 
   336          warning ("Rule already declared as unsafe elimination (elim?)\n" ^ string_of_thm th)
   336          warning ("Rule already declared as unsafe elimination (elim)\n" ^ string_of_thm th)
   337   else if mem_thm (th, xtraIs) then 
   337   else if mem_thm (th, xtraIs) then 
   338          warning ("Rule already declared as extra introduction (intro??)\n" ^ string_of_thm th)
   338          warning ("Rule already declared as extra introduction (intro?)\n" ^ string_of_thm th)
   339   else if mem_thm (th, xtraEs) then 
   339   else if mem_thm (th, xtraEs) then 
   340          warning ("Rule already declared as extra elimination (elim??)\n" ^ string_of_thm th)
   340          warning ("Rule already declared as extra elimination (elim?)\n" ^ string_of_thm th)
   341   else ();
   341   else ();
   342 
   342 
   343 (*** Safe rules ***)
   343 (*** Safe rules ***)
   344 
   344 
   345 fun addSI (cs as CS{safeIs, safeEs, hazIs, hazEs, xtraIs, xtraEs, swrappers, uwrappers, 
   345 fun addSI (cs as CS{safeIs, safeEs, hazIs, hazEs, xtraIs, xtraEs, swrappers, uwrappers, 
  1028 val delN = "del";
  1028 val delN = "del";
  1029 val delruleN = "delrule";
  1029 val delruleN = "delrule";
  1030 
  1030 
  1031 val colon = Args.$$$ ":";
  1031 val colon = Args.$$$ ":";
  1032 val query = Args.$$$ "?";
  1032 val query = Args.$$$ "?";
  1033 val qquery = Args.$$$ "??";
  1033 val bang = Args.$$$ "!";
  1034 val query_colon = Args.$$$ "?:";
  1034 val query_colon = Args.$$$ "?:";
  1035 val qquery_colon = Args.$$$ "??:";
  1035 val bang_colon = Args.$$$ "!:";
  1036 
  1036 
  1037 fun cla_att change xtra haz safe = Attrib.syntax
  1037 fun cla_att change xtra haz safe = Attrib.syntax
  1038   (Scan.lift ((qquery >> K xtra || query >> K haz || Scan.succeed safe) >> change));
  1038   (Scan.lift ((query >> K xtra || bang >> K haz || Scan.succeed safe) >> change));
  1039 
  1039 
  1040 fun cla_attr f g h = (cla_att change_global_cs f g h, cla_att change_local_cs f g h);
  1040 fun cla_attr f g h = (cla_att change_global_cs f g h, cla_att change_local_cs f g h);
  1041 val del_attr = (Attrib.no_args delrule_global, Attrib.no_args delrule_local);
  1041 val del_attr = (Attrib.no_args delrule_global, Attrib.no_args delrule_local);
  1042 
  1042 
  1043 
  1043 
  1144 
  1144 
  1145 
  1145 
  1146 (* automatic methods *)
  1146 (* automatic methods *)
  1147 
  1147 
  1148 val cla_modifiers =
  1148 val cla_modifiers =
  1149  [Args.$$$ destN -- qquery_colon >> K ((I, xtra_dest_local):Method.modifier),
  1149  [Args.$$$ destN -- query_colon >> K ((I, xtra_dest_local):Method.modifier),
  1150   Args.$$$ destN -- query_colon >> K (I, haz_dest_local),
  1150   Args.$$$ destN -- bang_colon >> K (I, haz_dest_local),
  1151   Args.$$$ destN -- colon >> K (I, safe_dest_local),
  1151   Args.$$$ destN -- colon >> K (I, safe_dest_local),
  1152   Args.$$$ elimN -- qquery_colon >> K (I, xtra_elim_local),
  1152   Args.$$$ elimN -- query_colon >> K (I, xtra_elim_local),
  1153   Args.$$$ elimN -- query_colon >> K (I, haz_elim_local),
  1153   Args.$$$ elimN -- bang_colon >> K (I, haz_elim_local),
  1154   Args.$$$ elimN -- colon >> K (I, safe_elim_local),
  1154   Args.$$$ elimN -- colon >> K (I, safe_elim_local),
  1155   Args.$$$ introN -- qquery_colon >> K (I, xtra_intro_local),
  1155   Args.$$$ introN -- query_colon >> K (I, xtra_intro_local),
  1156   Args.$$$ introN -- query_colon >> K (I, haz_intro_local),
  1156   Args.$$$ introN -- bang_colon >> K (I, haz_intro_local),
  1157   Args.$$$ introN -- colon >> K (I, safe_intro_local),
  1157   Args.$$$ introN -- colon >> K (I, safe_intro_local),
  1158   Args.$$$ delN -- colon >> K (I, delrule_local)];
  1158   Args.$$$ delN -- colon >> K (I, delrule_local)];
  1159 
  1159 
  1160 fun cla_meth tac prems ctxt = Method.METHOD (fn facts =>
  1160 fun cla_meth tac prems ctxt = Method.METHOD (fn facts =>
  1161   ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (get_local_claset ctxt));
  1161   ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (get_local_claset ctxt));