src/HOL/Library/reflection.ML
changeset 42368 3b8498ac2314
parent 42361 23f352990944
child 42426 7ec150fcf3dc
equal deleted inserted replaced
42367:577d85fb5862 42368:3b8498ac2314
   296     val rth = conv ft
   296     val rth = conv ft
   297   in simplify (HOL_basic_ss addsimps raw_eqs addsimps [nth_Cons_0, nth_Cons_Suc])
   297   in simplify (HOL_basic_ss addsimps raw_eqs addsimps [nth_Cons_0, nth_Cons_Suc])
   298              (simplify (HOL_basic_ss addsimps [rth]) th)
   298              (simplify (HOL_basic_ss addsimps [rth]) th)
   299   end
   299   end
   300 
   300 
   301 fun genreify_tac ctxt eqs to i = (fn st =>
   301 fun genreify_tac ctxt eqs to = SUBGOAL (fn (goal, i) =>
   302   let
   302   let
   303     fun P () = HOLogic.dest_Trueprop (nth (prems_of st) (i - 1))
   303     val t = (case to of NONE => HOLogic.dest_Trueprop goal | SOME x => x)
   304     val t = (case to of NONE => P () | SOME x => x)
   304     val th = genreif ctxt eqs t RS ssubst
   305     val th = (genreif ctxt eqs t) RS ssubst
   305   in rtac th i end);
   306   in rtac th i st
       
   307   end);
       
   308 
   306 
   309     (* Reflection calls reification and uses the correctness *)
   307     (* Reflection calls reification and uses the correctness *)
   310         (* theorem assumed to be the dead of the list *)
   308         (* theorem assumed to be the dead of the list *)
   311 fun gen_reflection_tac ctxt conv corr_thms raw_eqs to i = (fn st =>
   309 fun gen_reflection_tac ctxt conv corr_thms raw_eqs to = SUBGOAL (fn (goal, i) =>
   312   let
   310   let
   313     val P = HOLogic.dest_Trueprop (nth (prems_of st) (i - 1));
   311     val t = (case to of NONE => HOLogic.dest_Trueprop goal | SOME x => x)
   314     val t = the_default P to;
   312     val th = genreflect ctxt conv corr_thms raw_eqs t RS ssubst
   315     val th = genreflect ctxt conv corr_thms raw_eqs t
   313   in rtac th i THEN TRY (rtac TrueI i) end);  (* FIXME THEN_ALL_NEW !? *)
   316       RS ssubst;
       
   317   in (rtac th i THEN TRY(rtac TrueI i)) st end);
       
   318 
   314 
   319 fun reflection_tac ctxt = gen_reflection_tac ctxt Codegen.evaluation_conv;
   315 fun reflection_tac ctxt = gen_reflection_tac ctxt Codegen.evaluation_conv;
   320   (*FIXME why Codegen.evaluation_conv?  very specific...*)
   316   (*FIXME why Codegen.evaluation_conv?  very specific...*)
   321 
   317 
   322 end
   318 end