src/HOL/Tools/meson.ML
changeset 18508 c5861e128a95
parent 18405 afb1a52a7011
child 18662 598d3971eeb0
     1.1 --- a/src/HOL/Tools/meson.ML	Fri Dec 23 15:21:05 2005 +0100
     1.2 +++ b/src/HOL/Tools/meson.ML	Fri Dec 23 17:34:46 2005 +0100
     1.3 @@ -292,15 +292,6 @@
     1.4  (*Raises an exception if any Vars in the theorem mention type bool; they
     1.5    could cause make_horn to loop! Also rejects functions whose arguments are 
     1.6    Booleans or other functions.*)
     1.7 -fun check_is_fol th = 
     1.8 -  let val {prop,...} = rep_thm th
     1.9 -  in if exists (has_bool o fastype_of) (term_vars prop)  orelse
    1.10 -        not (Term.is_first_order ["all","All","Ex"] prop) orelse
    1.11 -        has_bool_arg_const prop  orelse  
    1.12 -        has_meta_conn prop
    1.13 -  then raise THM ("check_is_fol", 0, [th]) else th
    1.14 -  end;
    1.15 -
    1.16  fun check_is_fol_term term =
    1.17      if exists (has_bool o fastype_of) (term_vars term)  orelse
    1.18          not (Term.is_first_order ["all","All","Ex"] term) orelse
    1.19 @@ -308,6 +299,8 @@
    1.20          has_meta_conn term
    1.21      then raise TERM("check_is_fol_term",[term]) else term;
    1.22  
    1.23 +fun check_is_fol th = (check_is_fol_term (prop_of th); th);
    1.24 +
    1.25  
    1.26  (*Create a meta-level Horn clause*)
    1.27  fun make_horn crules th = make_horn crules (tryres(th,crules))
    1.28 @@ -356,10 +349,12 @@
    1.29  		  handle INSERT => true;
    1.30  
    1.31  (*Like TRYALL eq_assume_tac, but avoids expensive THEN calls*)
    1.32 -fun TRYALL_eq_assume_tac 0 st = Seq.single st
    1.33 -  | TRYALL_eq_assume_tac i st =
    1.34 -       TRYALL_eq_assume_tac (i-1) (eq_assumption i st)
    1.35 -       handle THM _ => TRYALL_eq_assume_tac (i-1) st;
    1.36 +fun TRYING_eq_assume_tac 0 st = Seq.single st
    1.37 +  | TRYING_eq_assume_tac i st =
    1.38 +       TRYING_eq_assume_tac (i-1) (eq_assumption i st)
    1.39 +       handle THM _ => TRYING_eq_assume_tac (i-1) st;
    1.40 +
    1.41 +fun TRYALL_eq_assume_tac st = TRYING_eq_assume_tac (nprems_of st) st;
    1.42  
    1.43  (*Loop checking: FAIL if trying to prove the same thing twice
    1.44    -- if *ANY* subgoal has repeated literals*)
    1.45 @@ -371,7 +366,7 @@
    1.46  (* net_resolve_tac actually made it slower... *)
    1.47  fun prolog_step_tac horns i =
    1.48      (assume_tac i APPEND resolve_tac horns i) THEN check_tac THEN
    1.49 -    TRYALL eq_assume_tac;
    1.50 +    TRYALL_eq_assume_tac;
    1.51  
    1.52  (*Sums the sizes of the subgoals, ignoring hypotheses (ancestors)*)
    1.53  fun addconcl(prem,sz) = size_of_term(Logic.strip_assums_concl prem) + sz
    1.54 @@ -458,7 +453,7 @@
    1.55  		      EVERY1 [skolemize_prems_tac negs,
    1.56  			      METAHYPS (cltac o make_clauses)]) 1,
    1.57              expand_defs_tac]) i st
    1.58 -  handle THM _ => no_tac st;	(*probably from check_is_fol*)		      
    1.59 +  handle TERM _ => no_tac st;	(*probably from check_is_fol*)		      
    1.60  
    1.61  (** Best-first search versions **)
    1.62  
    1.63 @@ -549,6 +544,7 @@
    1.64  (*Maps the clause  [P1,...Pn]==>False to [P1,...,P(i-1),P(i+1),...Pn] ==> ~P*)
    1.65  fun select_literal i cl = negate_head (make_last i cl);
    1.66  
    1.67 +
    1.68  (*Top-level Skolemization. Allows part of the conversion to clauses to be
    1.69    expressed as a tactic (or Isar method).  Each assumption of the selected 
    1.70    goal is converted to NNF and then its existential quantifiers are pulled
    1.71 @@ -556,8 +552,6 @@
    1.72    leaving !!-quantified variables. Perhaps Safe_tac should follow, but it
    1.73    might generate many subgoals.*)
    1.74  
    1.75 -
    1.76 -
    1.77  val skolemize_tac = 
    1.78    SUBGOAL
    1.79      (fn (prop,_) =>
    1.80 @@ -570,7 +564,6 @@
    1.81       end);
    1.82  
    1.83  
    1.84 -
    1.85  (*Top-level conversion to meta-level clauses. Each clause has  
    1.86    leading !!-bound universal variables, to express generality. To get 
    1.87    disjunctions instead of meta-clauses, remove "make_meta_clauses" below.*)