src/HOL/arith_data.ML
changeset 23190 d45c4d6c5f15
parent 23085 fd30d75a6614
child 23200 d47e2daac665
equal deleted inserted replaced
23189:4574ab8f3b21 23190:d45c4d6c5f15
   179 fun atomize thm = case #prop(rep_thm thm) of
   179 fun atomize thm = case #prop(rep_thm thm) of
   180     Const("Trueprop",_) $ (Const("op &",_) $ _ $ _) =>
   180     Const("Trueprop",_) $ (Const("op &",_) $ _ $ _) =>
   181     atomize(thm RS conjunct1) @ atomize(thm RS conjunct2)
   181     atomize(thm RS conjunct1) @ atomize(thm RS conjunct2)
   182   | _ => [thm];
   182   | _ => [thm];
   183 
   183 
   184 fun neg_prop(TP$(Const("Not",_)$t)) = TP$t
   184 fun neg_prop ((TP as Const("Trueprop",_)) $ (Const("Not",_) $ t)) = TP $ t
   185   | neg_prop(TP$t) = TP $ (Const("Not",HOLogic.boolT-->HOLogic.boolT)$t);
   185   | neg_prop ((TP as Const("Trueprop",_)) $ t) = TP $ (HOLogic.Not $t)
       
   186   | neg_prop t = raise TERM ("neg_prop", [t]);
   186 
   187 
   187 fun is_False thm =
   188 fun is_False thm =
   188   let val _ $ t = #prop(rep_thm thm)
   189   let val _ $ t = #prop(rep_thm thm)
   189   in t = Const("False",HOLogic.boolT) end;
   190   in t = Const("False",HOLogic.boolT) end;
   190 
   191 
   399   | _ => NONE;
   400   | _ => NONE;
   400 
   401 
   401 fun negate (SOME (x, i, rel, y, j, d)) = SOME (x, i, "~" ^ rel, y, j, d)
   402 fun negate (SOME (x, i, rel, y, j, d)) = SOME (x, i, "~" ^ rel, y, j, d)
   402   | negate NONE                        = NONE;
   403   | negate NONE                        = NONE;
   403 
   404 
   404 fun decomp_negation data (_ $ (Const (rel, T) $ lhs $ rhs)) : decompT option =
   405 fun decomp_negation data
       
   406   ((Const ("Trueprop", _)) $ (Const (rel, T) $ lhs $ rhs)) : decompT option =
   405       decomp_typecheck data (T, (rel, lhs, rhs))
   407       decomp_typecheck data (T, (rel, lhs, rhs))
   406   | decomp_negation data (_ $ (Const ("Not", _) $ (Const (rel, T) $ lhs $ rhs))) =
   408   | decomp_negation data ((Const ("Trueprop", _)) $
       
   409   (Const ("Not", _) $ (Const (rel, T) $ lhs $ rhs))) =
   407       negate (decomp_typecheck data (T, (rel, lhs, rhs)))
   410       negate (decomp_typecheck data (T, (rel, lhs, rhs)))
   408   | decomp_negation data _ =
   411   | decomp_negation data _ =
   409       NONE;
   412       NONE;
   410 
   413 
   411 fun decomp sg : term -> decompT option =
   414 fun decomp sg : term -> decompT option =
   979 end;
   982 end;
   980 
   983 
   981 in
   984 in
   982 
   985 
   983   val simple_arith_tac = FIRST' [fast_arith_tac,
   986   val simple_arith_tac = FIRST' [fast_arith_tac,
   984     ObjectLogic.atomize_tac THEN' raw_arith_tac true];
   987     ObjectLogic.full_atomize_tac THEN' (REPEAT_DETERM o rtac impI) THEN' raw_arith_tac true];
   985 
   988 
   986   val arith_tac = FIRST' [fast_arith_tac,
   989   val arith_tac = FIRST' [fast_arith_tac,
   987     ObjectLogic.atomize_tac THEN' raw_arith_tac true,
   990     ObjectLogic.full_atomize_tac THEN' (REPEAT_DETERM o rtac impI) THEN' raw_arith_tac true,
   988     arith_theory_tac];
   991     arith_theory_tac];
   989 
   992 
   990   val silent_arith_tac = FIRST' [fast_arith_tac,
   993   val silent_arith_tac = FIRST' [fast_arith_tac,
   991     ObjectLogic.atomize_tac THEN' raw_arith_tac false,
   994     ObjectLogic.full_atomize_tac THEN' (REPEAT_DETERM o rtac impI) THEN' raw_arith_tac false,
   992     arith_theory_tac];
   995     arith_theory_tac];
   993 
   996 
   994   fun arith_method prems =
   997   fun arith_method prems =
   995     Method.METHOD (fn facts => HEADGOAL (Method.insert_tac (prems @ facts) THEN' arith_tac));
   998     Method.METHOD (fn facts => HEADGOAL (Method.insert_tac (prems @ facts) THEN' arith_tac));
   996 
   999