src/Pure/tactic.ML
changeset 1077 c2df11ae8b55
parent 952 9e10962866b0
child 1209 03dc596b3a18
equal deleted inserted replaced
1076:68f088887f48 1077:c2df11ae8b55
    44   val fold_goals_tac: thm list -> tactic
    44   val fold_goals_tac: thm list -> tactic
    45   val fold_tac: thm list -> tactic
    45   val fold_tac: thm list -> tactic
    46   val forward_tac: thm list -> int -> tactic   
    46   val forward_tac: thm list -> int -> tactic   
    47   val forw_inst_tac: (string*string)list -> thm -> int -> tactic
    47   val forw_inst_tac: (string*string)list -> thm -> int -> tactic
    48   val freeze: thm -> thm   
    48   val freeze: thm -> thm   
       
    49   val insert_tagged_brl:  ('a*(bool*thm)) * 
       
    50                     (('a*(bool*thm))net * ('a*(bool*thm))net) ->
       
    51                     ('a*(bool*thm))net * ('a*(bool*thm))net
    49   val is_fact: thm -> bool
    52   val is_fact: thm -> bool
    50   val lessb: (bool * thm) * (bool * thm) -> bool
    53   val lessb: (bool * thm) * (bool * thm) -> bool
    51   val lift_inst_rule: thm * int * (string*string)list * thm -> thm
    54   val lift_inst_rule: thm * int * (string*string)list * thm -> thm
    52   val make_elim: thm -> thm
    55   val make_elim: thm -> thm
    53   val match_from_net_tac: (int*thm) net -> int -> tactic
    56   val match_from_net_tac: (int*thm) net -> int -> tactic
   312 
   315 
   313 (*return list elements in original order*)
   316 (*return list elements in original order*)
   314 val orderlist = untaglist o sort (fn(x,y)=> #1 x < #1 y); 
   317 val orderlist = untaglist o sort (fn(x,y)=> #1 x < #1 y); 
   315 
   318 
   316 (*insert one tagged brl into the pair of nets*)
   319 (*insert one tagged brl into the pair of nets*)
   317 fun insert_kbrl (kbrl as (k,(eres,th)), (inet,enet)) =
   320 fun insert_tagged_brl (kbrl as (k,(eres,th)), (inet,enet)) =
   318     if eres then 
   321     if eres then 
   319 	case prems_of th of
   322 	case prems_of th of
   320 	    prem::_ => (inet, Net.insert_term ((prem,kbrl), enet, K false))
   323 	    prem::_ => (inet, Net.insert_term ((prem,kbrl), enet, K false))
   321 	  | [] => error"insert_kbrl: elimination rule with no premises"
   324 	  | [] => error"insert_tagged_brl: elimination rule with no premises"
   322     else (Net.insert_term ((concl_of th, kbrl), inet, K false), enet);
   325     else (Net.insert_term ((concl_of th, kbrl), inet, K false), enet);
   323 
   326 
   324 (*build a pair of nets for biresolution*)
   327 (*build a pair of nets for biresolution*)
   325 fun build_netpair netpair brls = 
   328 fun build_netpair netpair brls = 
   326     foldr insert_kbrl (taglist 1 brls, netpair);
   329     foldr insert_tagged_brl (taglist 1 brls, netpair);
   327 
   330 
   328 (*biresolution using a pair of nets rather than rules*)
   331 (*biresolution using a pair of nets rather than rules*)
   329 fun biresolution_from_nets_tac match (inet,enet) =
   332 fun biresolution_from_nets_tac match (inet,enet) =
   330   SUBGOAL
   333   SUBGOAL
   331     (fn (prem,i) =>
   334     (fn (prem,i) =>
   384 
   387 
   385 
   388 
   386 (*** For Natural Deduction using (bires_flg, rule) pairs ***)
   389 (*** For Natural Deduction using (bires_flg, rule) pairs ***)
   387 
   390 
   388 (*The number of new subgoals produced by the brule*)
   391 (*The number of new subgoals produced by the brule*)
   389 fun subgoals_of_brl (true,rule) = length (prems_of rule) - 1
   392 fun subgoals_of_brl (true,rule)  = nprems_of rule - 1
   390   | subgoals_of_brl (false,rule) = length (prems_of rule);
   393   | subgoals_of_brl (false,rule) = nprems_of rule;
   391 
   394 
   392 (*Less-than test: for sorting to minimize number of new subgoals*)
   395 (*Less-than test: for sorting to minimize number of new subgoals*)
   393 fun lessb (brl1,brl2) = subgoals_of_brl brl1 < subgoals_of_brl brl2;
   396 fun lessb (brl1,brl2) = subgoals_of_brl brl1 < subgoals_of_brl brl2;
   394 
   397 
   395 
   398