src/Provers/classical.ML
changeset 24358 d75af3e90e82
parent 24218 fbf1646b267c
child 24867 e5b55d7be9bb
equal deleted inserted replaced
24357:d42cf77da51f 24358:d75af3e90e82
   653 
   653 
   654 (*Merge works by adding all new rules of the 2nd claset into the 1st claset.
   654 (*Merge works by adding all new rules of the 2nd claset into the 1st claset.
   655   Merging the term nets may look more efficient, but the rather delicate
   655   Merging the term nets may look more efficient, but the rather delicate
   656   treatment of priority might get muddled up.*)
   656   treatment of priority might get muddled up.*)
   657 fun merge_cs (cs as CS {safeIs, safeEs, hazIs, hazEs, ...},
   657 fun merge_cs (cs as CS {safeIs, safeEs, hazIs, hazEs, ...},
   658     CS {safeIs = safeIs2, safeEs = safeEs2, hazIs = hazIs2, hazEs = hazEs2,
   658     cs' as CS {safeIs = safeIs2, safeEs = safeEs2, hazIs = hazIs2, hazEs = hazEs2,
   659       swrappers, uwrappers, ...}) =
   659       swrappers, uwrappers, ...}) =
   660   let
   660   if pointer_eq (cs, cs') then cs
   661     val safeIs' = fold rem_thm safeIs safeIs2;
   661   else
   662     val safeEs' = fold rem_thm safeEs safeEs2;
   662     let
   663     val hazIs' = fold rem_thm hazIs hazIs2;
   663       val safeIs' = fold rem_thm safeIs safeIs2;
   664     val hazEs' = fold rem_thm hazEs hazEs2;
   664       val safeEs' = fold rem_thm safeEs safeEs2;
   665     val cs1   = cs addSIs safeIs'
   665       val hazIs' = fold rem_thm hazIs hazIs2;
   666                    addSEs safeEs'
   666       val hazEs' = fold rem_thm hazEs hazEs2;
   667                    addIs  hazIs'
   667       val cs1   = cs addSIs safeIs'
   668                    addEs  hazEs';
   668                      addSEs safeEs'
   669     val cs2 = map_swrappers
   669                      addIs  hazIs'
   670       (fn ws => AList.merge (op =) (K true) (ws, swrappers)) cs1;
   670                      addEs  hazEs';
   671     val cs3 = map_uwrappers
   671       val cs2 = map_swrappers
   672       (fn ws => AList.merge (op =) (K true) (ws, uwrappers)) cs2;
   672         (fn ws => AList.merge (op =) (K true) (ws, swrappers)) cs1;
   673   in cs3 end;
   673       val cs3 = map_uwrappers
       
   674         (fn ws => AList.merge (op =) (K true) (ws, uwrappers)) cs2;
       
   675     in cs3 end;
   674 
   676 
   675 
   677 
   676 (**** Simple tactics for theorem proving ****)
   678 (**** Simple tactics for theorem proving ****)
   677 
   679 
   678 (*Attack subgoals using safe inferences -- matching, not resolution*)
   680 (*Attack subgoals using safe inferences -- matching, not resolution*)
   849   ContextCS {swrappers = swrappers, uwrappers = uwrappers};
   851   ContextCS {swrappers = swrappers, uwrappers = uwrappers};
   850 
   852 
   851 val empty_context_cs = make_context_cs ([], []);
   853 val empty_context_cs = make_context_cs ([], []);
   852 
   854 
   853 fun merge_context_cs (ctxt_cs1, ctxt_cs2) =
   855 fun merge_context_cs (ctxt_cs1, ctxt_cs2) =
   854   let
   856   if pointer_eq (ctxt_cs1, ctxt_cs2) then ctxt_cs1
   855     val ContextCS {swrappers = swrappers1, uwrappers = uwrappers1} = ctxt_cs1;
   857   else
   856     val ContextCS {swrappers = swrappers2, uwrappers = uwrappers2} = ctxt_cs2;
   858     let
   857     val swrappers' = AList.merge (op =) (K true) (swrappers1, swrappers2);
   859       val ContextCS {swrappers = swrappers1, uwrappers = uwrappers1} = ctxt_cs1;
   858     val uwrappers' = AList.merge (op =) (K true) (uwrappers1, uwrappers2);
   860       val ContextCS {swrappers = swrappers2, uwrappers = uwrappers2} = ctxt_cs2;
   859   in make_context_cs (swrappers', uwrappers') end;
   861       val swrappers' = AList.merge (op =) (K true) (swrappers1, swrappers2);
       
   862       val uwrappers' = AList.merge (op =) (K true) (uwrappers1, uwrappers2);
       
   863     in make_context_cs (swrappers', uwrappers') end;
   860 
   864 
   861 
   865 
   862 
   866 
   863 (** claset data **)
   867 (** claset data **)
   864 
   868