src/Provers/clasimp.ML
changeset 30541 9f168bdc468a
parent 30528 7173bf123335
child 30609 983e8b6e4e69
equal deleted inserted replaced
30540:5e2d9604a3d3 30541:9f168bdc468a
   294   ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (local_clasimpset_of ctxt));
   294   ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (local_clasimpset_of ctxt));
   295 
   295 
   296 fun clasimp_meth' tac prems ctxt = METHOD (fn facts =>
   296 fun clasimp_meth' tac prems ctxt = METHOD (fn facts =>
   297   HEADGOAL (Method.insert_tac (prems @ facts) THEN' tac (local_clasimpset_of ctxt)));
   297   HEADGOAL (Method.insert_tac (prems @ facts) THEN' tac (local_clasimpset_of ctxt)));
   298 
   298 
   299 val clasimp_method = Method.bang_sectioned_args clasimp_modifiers o clasimp_meth;
   299 
   300 val clasimp_method' = Method.bang_sectioned_args clasimp_modifiers o clasimp_meth';
   300 fun clasimp_method tac =
   301 
   301   Args.bang_facts --| Method.sections clasimp_modifiers >> (clasimp_meth tac);
   302 
   302 
   303 fun auto_args m =
   303 fun clasimp_method' tac =
   304   Method.bang_sectioned_args' clasimp_modifiers
   304   Args.bang_facts --| Method.sections clasimp_modifiers >> (clasimp_meth' tac);
   305     (Scan.lift (Scan.option (OuterParse.nat -- OuterParse.nat))) m;
   305 
   306 
   306 val auto_method =
   307 fun auto_meth NONE = clasimp_meth (CHANGED_PROP o auto_tac)
   307   Args.bang_facts -- Scan.lift (Scan.option (OuterParse.nat -- OuterParse.nat)) --|
   308   | auto_meth (SOME (m, n)) = clasimp_meth (CHANGED_PROP o (fn css => mk_auto_tac css m n));
   308   Method.sections clasimp_modifiers >>
       
   309   (fn (prems, NONE) => clasimp_meth (CHANGED_PROP o auto_tac) prems
       
   310     | (prems, SOME (m, n)) => clasimp_meth (CHANGED_PROP o (fn css => mk_auto_tac css m n)) prems);
   309 
   311 
   310 
   312 
   311 (* theory setup *)
   313 (* theory setup *)
   312 
   314 
   313 val clasimp_setup =
   315 val clasimp_setup =
   314  (Attrib.setup @{binding iff} iff_att "declaration of Simplifier / Classical rules" #>
   316   Attrib.setup @{binding iff} iff_att "declaration of Simplifier / Classical rules" #>
   315   Method.add_methods
   317   Method.setup @{binding fastsimp} (clasimp_method' fast_simp_tac) "combined fast and simp" #>
   316    [("fastsimp", clasimp_method' fast_simp_tac, "combined fast and simp"),
   318   Method.setup @{binding slowsimp} (clasimp_method' slow_simp_tac) "combined slow and simp" #>
   317     ("slowsimp", clasimp_method' slow_simp_tac, "combined slow and simp"),
   319   Method.setup @{binding bestsimp} (clasimp_method' best_simp_tac) "combined best and simp" #>
   318     ("bestsimp", clasimp_method' best_simp_tac, "combined best and simp"),
   320   Method.setup @{binding force} (clasimp_method' force_tac) "force" #>
   319     ("force", clasimp_method' force_tac, "force"),
   321   Method.setup @{binding auto} auto_method "auto" #>
   320     ("auto", auto_args auto_meth, "auto"),
   322   Method.setup @{binding clarsimp} (clasimp_method' (CHANGED_PROP oo clarsimp_tac))
   321     ("clarsimp", clasimp_method' (CHANGED_PROP oo clarsimp_tac), "clarify simplified goal")]);
   323     "clarify simplified goal";
   322 
   324 
   323 end;
   325 end;