sane interface for simprocs;
authorwenzelm
Tue Aug 06 11:22:05 2002 +0200 (2002-08-06)
changeset 1346256610e2ba220
parent 13461 f93f7d766895
child 13463 07747943c626
sane interface for simprocs;
src/FOL/simpdata.ML
src/HOL/Bali/Basis.thy
src/HOL/Bali/Eval.thy
src/HOL/Bali/Evaln.thy
src/HOL/Bali/WellType.thy
src/HOL/Fun.ML
src/HOL/Hyperreal/HyperArith0.ML
src/HOL/Hyperreal/HyperBin.ML
src/HOL/Hyperreal/NSA.ML
src/HOL/Hyperreal/hypreal_arith0.ML
src/HOL/Integ/Bin.ML
src/HOL/Integ/int_arith1.ML
src/HOL/Integ/int_factor_simprocs.ML
src/HOL/Integ/nat_bin.ML
src/HOL/Integ/nat_simprocs.ML
src/HOL/List.thy
src/HOL/Modelcheck/EindhovenSyn.ML
src/HOL/Modelcheck/MuckeSyn.ML
src/HOL/Product_Type.thy
src/HOL/Real/RealArith0.ML
src/HOL/Real/RealBin.ML
src/HOL/Real/real_arith0.ML
src/HOL/Set.thy
src/HOL/Tools/datatype_package.ML
src/HOL/Tools/record_package.ML
src/HOL/arith_data.ML
src/HOL/simpdata.ML
src/Provers/Arith/abel_cancel.ML
src/Provers/Arith/assoc_fold.ML
src/Provers/simplifier.ML
src/ZF/Datatype.ML
src/ZF/Integ/int_arith.ML
src/ZF/OrdQuant.thy
src/ZF/arith_data.ML
src/ZF/simpdata.ML
     1.1 --- a/src/FOL/simpdata.ML	Tue Aug 06 11:20:47 2002 +0200
     1.2 +++ b/src/FOL/simpdata.ML	Tue Aug 06 11:22:05 2002 +0200
     1.3 @@ -266,20 +266,13 @@
     1.4  
     1.5  end;
     1.6  
     1.7 -local
     1.8 -
     1.9 -val ex_pattern =
    1.10 -  read_cterm (Theory.sign_of (the_context ())) ("EX x. P(x)", FOLogic.oT)
    1.11 +val defEX_regroup =
    1.12 +  Simplifier.simproc (Theory.sign_of (the_context ()))
    1.13 +    "defined EX" ["EX x. P(x)"] Quantifier1.rearrange_ex;
    1.14  
    1.15 -val all_pattern =
    1.16 -  read_cterm (Theory.sign_of (the_context ())) ("ALL x. P(x)", FOLogic.oT)
    1.17 -
    1.18 -in
    1.19 -val defEX_regroup =
    1.20 -  mk_simproc "defined EX" [ex_pattern] Quantifier1.rearrange_ex;
    1.21  val defALL_regroup =
    1.22 -  mk_simproc "defined ALL" [all_pattern] Quantifier1.rearrange_all;
    1.23 -end;
    1.24 +  Simplifier.simproc (Theory.sign_of (the_context ()))
    1.25 +    "defined ALL" ["ALL x. P(x)"] Quantifier1.rearrange_all;
    1.26  
    1.27  
    1.28  (*** Case splitting ***)
     2.1 --- a/src/HOL/Bali/Basis.thy	Tue Aug 06 11:20:47 2002 +0200
     2.2 +++ b/src/HOL/Bali/Basis.thy	Tue Aug 06 11:22:05 2002 +0200
     2.3 @@ -19,11 +19,9 @@
     2.4  
     2.5  declare same_fstI [intro!] (*### TO HOL/Wellfounded_Relations *)
     2.6  
     2.7 -(* ###TO HOL/???.ML?? *)
     2.8  ML {*
     2.9 -fun make_simproc name pat pred thm = Simplifier.mk_simproc name
    2.10 -   [Thm.read_cterm (Thm.sign_of_thm thm) (pat, HOLogic.typeT)] 
    2.11 -   (K (K (fn s => if pred s then None else Some (standard (mk_meta_eq thm)))))
    2.12 +fun cond_simproc name pat pred thm = Simplifier.simproc (Thm.sign_of_thm thm) name [pat]
    2.13 +  (fn _ => fn _ => fn t => if pred t then None else Some (mk_meta_eq thm));
    2.14  *}
    2.15  
    2.16  declare split_if_asm  [split] option.split [split] option.split_asm [split]
     3.1 --- a/src/HOL/Bali/Eval.thy	Tue Aug 06 11:20:47 2002 +0200
     3.2 +++ b/src/HOL/Bali/Eval.thy	Tue Aug 06 11:22:05 2002 +0200
     3.3 @@ -894,7 +894,7 @@
     3.4    fun pred (_ $ (Const ("Pair",_) $ _ $ 
     3.5        (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ x $ _ ))) $ _ ) = is_Inj x
     3.6  in
     3.7 -  make_simproc name lhs pred (thm name)
     3.8 +  cond_simproc name lhs pred (thm name)
     3.9  end
    3.10  
    3.11  val eval_expr_proc =eval_fun "expr" "In1l" "\<exists>v.  w=In1 v   \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<rightarrow> s'"
    3.12 @@ -989,7 +989,7 @@
    3.13       (Const ("Pair", _) $ x $ _) $ _ ) $ _)) = is_None x
    3.14  in
    3.15    val eval_no_abrupt_proc = 
    3.16 -  make_simproc "eval_no_abrupt" "G\<turnstile>(x,s) \<midarrow>e\<succ>\<rightarrow> (w,Norm s')" pred 
    3.17 +  cond_simproc "eval_no_abrupt" "G\<turnstile>(x,s) \<midarrow>e\<succ>\<rightarrow> (w,Norm s')" pred 
    3.18            (thm "eval_no_abrupt")
    3.19  end;
    3.20  Addsimprocs [eval_no_abrupt_proc]
    3.21 @@ -1017,7 +1017,7 @@
    3.22         x))) $ _ ) = is_Some x
    3.23  in
    3.24    val eval_abrupt_proc = 
    3.25 -  make_simproc "eval_abrupt" 
    3.26 +  cond_simproc "eval_abrupt" 
    3.27                 "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<rightarrow> (w,s')" pred (thm "eval_abrupt")
    3.28  end;
    3.29  Addsimprocs [eval_abrupt_proc]
     4.1 --- a/src/HOL/Bali/Evaln.thy	Tue Aug 06 11:20:47 2002 +0200
     4.2 +++ b/src/HOL/Bali/Evaln.thy	Tue Aug 06 11:22:05 2002 +0200
     4.3 @@ -260,7 +260,7 @@
     4.4    fun pred (_ $ (Const ("Pair",_) $ _ $ (Const ("Pair", _) $ _ $ 
     4.5      (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ x $ _ )))) $ _ ) = is_Inj x
     4.6  in
     4.7 -  make_simproc name lhs pred (thm name)
     4.8 +  cond_simproc name lhs pred (thm name)
     4.9  end;
    4.10  
    4.11  val evaln_expr_proc = enf "expr" "In1l" "\<exists>v.  w=In1 v  \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<midarrow>n\<rightarrow> s'";
    4.12 @@ -350,7 +350,7 @@
    4.13         (Const ("Pair", _) $ _ $ x)))) $ _ ) = is_Some x
    4.14  in
    4.15    val evaln_abrupt_proc = 
    4.16 - make_simproc "evaln_abrupt" "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')" pred (thm "evaln_abrupt")
    4.17 + cond_simproc "evaln_abrupt" "G\<turnstile>(Some xc,s) \<midarrow>e\<succ>\<midarrow>n\<rightarrow> (w,s')" pred (thm "evaln_abrupt")
    4.18  end;
    4.19  Addsimprocs [evaln_abrupt_proc]
    4.20  *}
     5.1 --- a/src/HOL/Bali/WellType.thy	Tue Aug 06 11:20:47 2002 +0200
     5.2 +++ b/src/HOL/Bali/WellType.thy	Tue Aug 06 11:22:05 2002 +0200
     5.3 @@ -620,7 +620,7 @@
     5.4       _ $ (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ _ $
     5.5         x))) $ _ )) = is_Inj x
     5.6  in
     5.7 -  make_simproc name lhs pred (thm name)
     5.8 +  cond_simproc name lhs pred (thm name)
     5.9  end
    5.10  
    5.11  val wt_expr_proc  = wt_fun "wt_expr_eq"  "In1l" "\<exists>T.  U=Inl T  \<and> E,dt\<Turnstile>t\<Colon>-T"
     6.1 --- a/src/HOL/Fun.ML	Tue Aug 06 11:20:47 2002 +0200
     6.2 +++ b/src/HOL/Fun.ML	Tue Aug 06 11:22:05 2002 +0200
     6.3 @@ -372,10 +372,10 @@
     6.4                            simp_tac ss 1]
     6.5    fun mk_eq_cterm sg T l r = Thm.cterm_of sg (equals T $ l $ r)
     6.6  in 
     6.7 -  val fun_upd2_simproc = Simplifier.mk_simproc "fun_upd2"
     6.8 -   [HOLogic.read_cterm (sign_of (the_context ())) "f(v := w, x := y)"]
     6.9 -   (fn sg => (K (fn t => case find_double t of (T,None)=> None | (T,Some rhs)=> 
    6.10 -       Some (prove_goalw_cterm [] (mk_eq_cterm sg T t rhs) fun_upd_prover))))
    6.11 +  val fun_upd2_simproc =
    6.12 +    Simplifier.simproc (Theory.sign_of (the_context ())) "fun_upd2" ["f(v := w, x := y)"]
    6.13 +    (fn sg => fn _ => fn t => case find_double t of (T, None) => None | (T, Some rhs) =>
    6.14 +        Some (prove_goalw_cterm [] (mk_eq_cterm sg T t rhs) fun_upd_prover));
    6.15  end;
    6.16  Addsimprocs[fun_upd2_simproc];
    6.17  
     7.1 --- a/src/HOL/Hyperreal/HyperArith0.ML	Tue Aug 06 11:20:47 2002 +0200
     7.2 +++ b/src/HOL/Hyperreal/HyperArith0.ML	Tue Aug 06 11:22:05 2002 +0200
     7.3 @@ -9,59 +9,59 @@
     7.4  *)
     7.5  
     7.6  Goal "x - - y = x + (y::hypreal)";
     7.7 -by (Simp_tac 1); 
     7.8 +by (Simp_tac 1);
     7.9  qed "hypreal_diff_minus_eq";
    7.10  Addsimps [hypreal_diff_minus_eq];
    7.11  
    7.12  Goal "((x * y = 0) = (x = 0 | y = (0::hypreal)))";
    7.13 -by Auto_tac;  
    7.14 +by Auto_tac;
    7.15  by (cut_inst_tac [("x","x"),("y","y")] hypreal_mult_zero_disj 1);
    7.16 -by Auto_tac;  
    7.17 +by Auto_tac;
    7.18  qed "hypreal_mult_is_0";
    7.19  AddIffs [hypreal_mult_is_0];
    7.20  
    7.21  (** Division and inverse **)
    7.22  
    7.23  Goal "0/x = (0::hypreal)";
    7.24 -by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); 
    7.25 +by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1);
    7.26  qed "hypreal_0_divide";
    7.27  Addsimps [hypreal_0_divide];
    7.28  
    7.29  Goal "((0::hypreal) < inverse x) = (0 < x)";
    7.30  by (case_tac "x=0" 1);
    7.31 -by (asm_simp_tac (HOL_ss addsimps [HYPREAL_INVERSE_ZERO]) 1); 
    7.32 -by (auto_tac (claset() addDs [hypreal_inverse_less_0], 
    7.33 -              simpset() addsimps [linorder_neq_iff, 
    7.34 -                                  hypreal_inverse_gt_0]));  
    7.35 +by (asm_simp_tac (HOL_ss addsimps [HYPREAL_INVERSE_ZERO]) 1);
    7.36 +by (auto_tac (claset() addDs [hypreal_inverse_less_0],
    7.37 +              simpset() addsimps [linorder_neq_iff,
    7.38 +                                  hypreal_inverse_gt_0]));
    7.39  qed "hypreal_0_less_inverse_iff";
    7.40  Addsimps [hypreal_0_less_inverse_iff];
    7.41  
    7.42  Goal "(inverse x < (0::hypreal)) = (x < 0)";
    7.43  by (case_tac "x=0" 1);
    7.44 -by (asm_simp_tac (HOL_ss addsimps [HYPREAL_INVERSE_ZERO]) 1); 
    7.45 -by (auto_tac (claset() addDs [hypreal_inverse_less_0], 
    7.46 -              simpset() addsimps [linorder_neq_iff, 
    7.47 -                                  hypreal_inverse_gt_0]));  
    7.48 +by (asm_simp_tac (HOL_ss addsimps [HYPREAL_INVERSE_ZERO]) 1);
    7.49 +by (auto_tac (claset() addDs [hypreal_inverse_less_0],
    7.50 +              simpset() addsimps [linorder_neq_iff,
    7.51 +                                  hypreal_inverse_gt_0]));
    7.52  qed "hypreal_inverse_less_0_iff";
    7.53  Addsimps [hypreal_inverse_less_0_iff];
    7.54  
    7.55  Goal "((0::hypreal) <= inverse x) = (0 <= x)";
    7.56 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); 
    7.57 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
    7.58  qed "hypreal_0_le_inverse_iff";
    7.59  Addsimps [hypreal_0_le_inverse_iff];
    7.60  
    7.61  Goal "(inverse x <= (0::hypreal)) = (x <= 0)";
    7.62 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); 
    7.63 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
    7.64  qed "hypreal_inverse_le_0_iff";
    7.65  Addsimps [hypreal_inverse_le_0_iff];
    7.66  
    7.67  Goalw [hypreal_divide_def] "x/(0::hypreal) = 0";
    7.68 -by (stac (HYPREAL_INVERSE_ZERO) 1); 
    7.69 -by (Simp_tac 1); 
    7.70 +by (stac (HYPREAL_INVERSE_ZERO) 1);
    7.71 +by (Simp_tac 1);
    7.72  qed "HYPREAL_DIVIDE_ZERO";
    7.73  
    7.74  Goal "inverse (x::hypreal) = 1/x";
    7.75 -by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); 
    7.76 +by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1);
    7.77  qed "hypreal_inverse_eq_divide";
    7.78  
    7.79  Goal "((0::hypreal) < x/y) = (0 < x & 0 < y | x < 0 & y < 0)";
    7.80 @@ -76,34 +76,34 @@
    7.81  
    7.82  Goal "((0::hypreal) <= x/y) = ((x <= 0 | 0 <= y) & (0 <= x | y <= 0))";
    7.83  by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_0_le_mult_iff]) 1);
    7.84 -by Auto_tac;  
    7.85 +by Auto_tac;
    7.86  qed "hypreal_0_le_divide_iff";
    7.87  Addsimps [inst "x" "number_of ?w" hypreal_0_le_divide_iff];
    7.88  
    7.89  Goal "(x/y <= (0::hypreal)) = ((x <= 0 | y <= 0) & (0 <= x | 0 <= y))";
    7.90 -by (simp_tac (simpset() addsimps [hypreal_divide_def, 
    7.91 +by (simp_tac (simpset() addsimps [hypreal_divide_def,
    7.92                                    hypreal_mult_le_0_iff]) 1);
    7.93 -by Auto_tac;  
    7.94 +by Auto_tac;
    7.95  qed "hypreal_divide_le_0_iff";
    7.96  Addsimps [inst "x" "number_of ?w" hypreal_divide_le_0_iff];
    7.97  
    7.98  Goal "(inverse(x::hypreal) = 0) = (x = 0)";
    7.99 -by (auto_tac (claset(), 
   7.100 -              simpset() addsimps [HYPREAL_INVERSE_ZERO]));  
   7.101 -by (rtac ccontr 1); 
   7.102 -by (blast_tac (claset() addDs [hypreal_inverse_not_zero]) 1); 
   7.103 +by (auto_tac (claset(),
   7.104 +              simpset() addsimps [HYPREAL_INVERSE_ZERO]));
   7.105 +by (rtac ccontr 1);
   7.106 +by (blast_tac (claset() addDs [hypreal_inverse_not_zero]) 1);
   7.107  qed "hypreal_inverse_zero_iff";
   7.108  Addsimps [hypreal_inverse_zero_iff];
   7.109  
   7.110  Goal "(x/y = 0) = (x=0 | y=(0::hypreal))";
   7.111 -by (auto_tac (claset(), simpset() addsimps [hypreal_divide_def]));  
   7.112 +by (auto_tac (claset(), simpset() addsimps [hypreal_divide_def]));
   7.113  qed "hypreal_divide_eq_0_iff";
   7.114  Addsimps [hypreal_divide_eq_0_iff];
   7.115  
   7.116  Goal "h ~= (0::hypreal) ==> h/h = 1";
   7.117 -by (asm_simp_tac 
   7.118 +by (asm_simp_tac
   7.119      (simpset() addsimps [hypreal_divide_def, hypreal_mult_inverse_left]) 1);
   7.120 -qed "hypreal_divide_self_eq"; 
   7.121 +qed "hypreal_divide_self_eq";
   7.122  Addsimps [hypreal_divide_self_eq];
   7.123  
   7.124  
   7.125 @@ -121,23 +121,23 @@
   7.126  
   7.127  Goal "[| i<j;  k < (0::hypreal) |] ==> j*k < i*k";
   7.128  by (rtac (hypreal_minus_less_minus RS iffD1) 1);
   7.129 -by (auto_tac (claset(), 
   7.130 +by (auto_tac (claset(),
   7.131                simpset() delsimps [hypreal_minus_mult_eq2 RS sym]
   7.132                          addsimps [hypreal_minus_mult_eq2,
   7.133 -                                  hypreal_mult_less_mono1])); 
   7.134 +                                  hypreal_mult_less_mono1]));
   7.135  qed "hypreal_mult_less_mono1_neg";
   7.136  
   7.137  Goal "[| i<j;  k < (0::hypreal) |] ==> k*j < k*i";
   7.138  by (rtac (hypreal_minus_less_minus RS iffD1) 1);
   7.139 -by (auto_tac (claset(), 
   7.140 +by (auto_tac (claset(),
   7.141                simpset() delsimps [hypreal_minus_mult_eq1 RS sym]
   7.142                          addsimps [hypreal_minus_mult_eq1,
   7.143                                    hypreal_mult_less_mono2]));
   7.144  qed "hypreal_mult_less_mono2_neg";
   7.145  
   7.146  Goal "[| i <= j;  k <= (0::hypreal) |] ==> j*k <= i*k";
   7.147 -by (auto_tac (claset(), 
   7.148 -          simpset() addsimps [order_le_less, hypreal_mult_less_mono1_neg]));  
   7.149 +by (auto_tac (claset(),
   7.150 +          simpset() addsimps [order_le_less, hypreal_mult_less_mono1_neg]));
   7.151  qed "hypreal_mult_le_mono1_neg";
   7.152  
   7.153  Goal "[| i <= j;  k <= (0::hypreal) |] ==> k*j <= k*i";
   7.154 @@ -147,56 +147,56 @@
   7.155  
   7.156  Goal "(m*k < n*k) = (((0::hypreal) < k & m<n) | (k < 0 & n<m))";
   7.157  by (case_tac "k = (0::hypreal)" 1);
   7.158 -by (auto_tac (claset(), 
   7.159 -          simpset() addsimps [linorder_neq_iff, 
   7.160 -                      hypreal_mult_less_mono1, hypreal_mult_less_mono1_neg]));  
   7.161 -by (auto_tac (claset(), 
   7.162 +by (auto_tac (claset(),
   7.163 +          simpset() addsimps [linorder_neq_iff,
   7.164 +                      hypreal_mult_less_mono1, hypreal_mult_less_mono1_neg]));
   7.165 +by (auto_tac (claset(),
   7.166                simpset() addsimps [linorder_not_less,
   7.167 -				  inst "y1" "m*k" (linorder_not_le RS sym),
   7.168 +                                  inst "y1" "m*k" (linorder_not_le RS sym),
   7.169                                    inst "y1" "m" (linorder_not_le RS sym)]));
   7.170  by (TRYALL (etac notE));
   7.171 -by (auto_tac (claset(), 
   7.172 +by (auto_tac (claset(),
   7.173                simpset() addsimps [order_less_imp_le, hypreal_mult_le_mono1,
   7.174 -                                  hypreal_mult_le_mono1_neg]));  
   7.175 +                                  hypreal_mult_le_mono1_neg]));
   7.176  qed "hypreal_mult_less_cancel2";
   7.177  
   7.178  Goal "(m*k <= n*k) = (((0::hypreal) < k --> m<=n) & (k < 0 --> n<=m))";
   7.179 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym, 
   7.180 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym,
   7.181                                    hypreal_mult_less_cancel2]) 1);
   7.182  qed "hypreal_mult_le_cancel2";
   7.183  
   7.184  Goal "(k*m < k*n) = (((0::hypreal) < k & m<n) | (k < 0 & n<m))";
   7.185 -by (simp_tac (simpset() addsimps [inst "z" "k" hypreal_mult_commute, 
   7.186 +by (simp_tac (simpset() addsimps [inst "z" "k" hypreal_mult_commute,
   7.187                                    hypreal_mult_less_cancel2]) 1);
   7.188  qed "hypreal_mult_less_cancel1";
   7.189  
   7.190  Goal "!!k::hypreal. (k*m <= k*n) = ((0 < k --> m<=n) & (k < 0 --> n<=m))";
   7.191 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym, 
   7.192 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym,
   7.193                                    hypreal_mult_less_cancel1]) 1);
   7.194  qed "hypreal_mult_le_cancel1";
   7.195  
   7.196  Goal "!!k::hypreal. (k*m = k*n) = (k = 0 | m=n)";
   7.197  by (case_tac "k=0" 1);
   7.198 -by (auto_tac (claset(), simpset() addsimps [hypreal_mult_left_cancel]));  
   7.199 +by (auto_tac (claset(), simpset() addsimps [hypreal_mult_left_cancel]));
   7.200  qed "hypreal_mult_eq_cancel1";
   7.201  
   7.202  Goal "!!k::hypreal. (m*k = n*k) = (k = 0 | m=n)";
   7.203  by (case_tac "k=0" 1);
   7.204 -by (auto_tac (claset(), simpset() addsimps [hypreal_mult_right_cancel]));  
   7.205 +by (auto_tac (claset(), simpset() addsimps [hypreal_mult_right_cancel]));
   7.206  qed "hypreal_mult_eq_cancel2";
   7.207  
   7.208  Goal "!!k::hypreal. k~=0 ==> (k*m) / (k*n) = (m/n)";
   7.209  by (asm_simp_tac
   7.210 -    (simpset() addsimps [hypreal_divide_def, hypreal_inverse_distrib]) 1); 
   7.211 +    (simpset() addsimps [hypreal_divide_def, hypreal_inverse_distrib]) 1);
   7.212  by (subgoal_tac "k * m * (inverse k * inverse n) = \
   7.213  \                (k * inverse k) * (m * inverse n)" 1);
   7.214 -by (asm_full_simp_tac (simpset() addsimps []) 1); 
   7.215 -by (asm_full_simp_tac (HOL_ss addsimps hypreal_mult_ac) 1); 
   7.216 +by (asm_full_simp_tac (simpset() addsimps []) 1);
   7.217 +by (asm_full_simp_tac (HOL_ss addsimps hypreal_mult_ac) 1);
   7.218  qed "hypreal_mult_div_cancel1";
   7.219  
   7.220  (*For ExtractCommonTerm*)
   7.221  Goal "(k*m) / (k*n) = (if k = (0::hypreal) then 0 else m/n)";
   7.222 -by (simp_tac (simpset() addsimps [hypreal_mult_div_cancel1]) 1); 
   7.223 +by (simp_tac (simpset() addsimps [hypreal_mult_div_cancel1]) 1);
   7.224  qed "hypreal_mult_div_cancel_disj";
   7.225  
   7.226  
   7.227 @@ -204,19 +204,19 @@
   7.228    open Hyperreal_Numeral_Simprocs
   7.229  in
   7.230  
   7.231 -val rel_hypreal_number_of = [eq_hypreal_number_of, less_hypreal_number_of, 
   7.232 +val rel_hypreal_number_of = [eq_hypreal_number_of, less_hypreal_number_of,
   7.233                            le_hypreal_number_of_eq_not_less];
   7.234  
   7.235  structure CancelNumeralFactorCommon =
   7.236    struct
   7.237 -  val mk_coeff		= mk_coeff
   7.238 -  val dest_coeff	= dest_coeff 1
   7.239 +  val mk_coeff          = mk_coeff
   7.240 +  val dest_coeff        = dest_coeff 1
   7.241    val trans_tac         = Real_Numeral_Simprocs.trans_tac
   7.242 -  val norm_tac = 
   7.243 +  val norm_tac =
   7.244       ALLGOALS (simp_tac (HOL_ss addsimps hypreal_minus_from_mult_simps @ mult_1s))
   7.245       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@hypreal_mult_minus_simps))
   7.246       THEN ALLGOALS (simp_tac (HOL_ss addsimps hypreal_mult_ac))
   7.247 -  val numeral_simp_tac	= 
   7.248 +  val numeral_simp_tac  =
   7.249           ALLGOALS (simp_tac (HOL_ss addsimps rel_hypreal_number_of@bin_simps))
   7.250    val simplify_meta_eq  = simplify_meta_eq
   7.251    end
   7.252 @@ -261,26 +261,26 @@
   7.253    val neg_exchanges = true
   7.254  )
   7.255  
   7.256 -val hypreal_cancel_numeral_factors_relations = 
   7.257 +val hypreal_cancel_numeral_factors_relations =
   7.258    map prep_simproc
   7.259     [("hyprealeq_cancel_numeral_factor",
   7.260 -     prep_pats ["(l::hypreal) * m = n", "(l::hypreal) = m * n"], 
   7.261 +     ["(l::hypreal) * m = n", "(l::hypreal) = m * n"],
   7.262       EqCancelNumeralFactor.proc),
   7.263 -    ("hyprealless_cancel_numeral_factor", 
   7.264 -     prep_pats ["(l::hypreal) * m < n", "(l::hypreal) < m * n"], 
   7.265 +    ("hyprealless_cancel_numeral_factor",
   7.266 +     ["(l::hypreal) * m < n", "(l::hypreal) < m * n"],
   7.267       LessCancelNumeralFactor.proc),
   7.268 -    ("hyprealle_cancel_numeral_factor", 
   7.269 -     prep_pats ["(l::hypreal) * m <= n", "(l::hypreal) <= m * n"], 
   7.270 +    ("hyprealle_cancel_numeral_factor",
   7.271 +     ["(l::hypreal) * m <= n", "(l::hypreal) <= m * n"],
   7.272       LeCancelNumeralFactor.proc)];
   7.273  
   7.274  val hypreal_cancel_numeral_factors_divide = prep_simproc
   7.275 -	("hyprealdiv_cancel_numeral_factor", 
   7.276 -	 prep_pats ["((l::hypreal) * m) / n", "(l::hypreal) / (m * n)", 
   7.277 -                     "((number_of v)::hypreal) / (number_of w)"], 
   7.278 -	 DivCancelNumeralFactor.proc);
   7.279 +        ("hyprealdiv_cancel_numeral_factor",
   7.280 +         ["((l::hypreal) * m) / n", "(l::hypreal) / (m * n)",
   7.281 +          "((number_of v)::hypreal) / (number_of w)"],
   7.282 +         DivCancelNumeralFactor.proc);
   7.283  
   7.284 -val hypreal_cancel_numeral_factors = 
   7.285 -    hypreal_cancel_numeral_factors_relations @ 
   7.286 +val hypreal_cancel_numeral_factors =
   7.287 +    hypreal_cancel_numeral_factors_relations @
   7.288      [hypreal_cancel_numeral_factors_divide];
   7.289  
   7.290  end;
   7.291 @@ -292,7 +292,7 @@
   7.292  print_depth 22;
   7.293  set timing;
   7.294  set trace_simp;
   7.295 -fun test s = (Goal s; by (Simp_tac 1)); 
   7.296 +fun test s = (Goal s; by (Simp_tac 1));
   7.297  
   7.298  test "0 <= (y::hypreal) * -2";
   7.299  test "9*x = 12 * (y::hypreal)";
   7.300 @@ -333,11 +333,11 @@
   7.301  
   7.302  structure CancelFactorCommon =
   7.303    struct
   7.304 -  val mk_sum    	= long_mk_prod
   7.305 -  val dest_sum		= dest_prod
   7.306 -  val mk_coeff		= mk_coeff
   7.307 -  val dest_coeff	= dest_coeff
   7.308 -  val find_first	= find_first []
   7.309 +  val mk_sum            = long_mk_prod
   7.310 +  val dest_sum          = dest_prod
   7.311 +  val mk_coeff          = mk_coeff
   7.312 +  val dest_coeff        = dest_coeff
   7.313 +  val find_first        = find_first []
   7.314    val trans_tac         = Real_Numeral_Simprocs.trans_tac
   7.315    val norm_tac = ALLGOALS (simp_tac (HOL_ss addsimps mult_1s@hypreal_mult_ac))
   7.316    end;
   7.317 @@ -361,13 +361,11 @@
   7.318    val simplify_meta_eq  = cancel_simplify_meta_eq hypreal_mult_div_cancel_disj
   7.319  );
   7.320  
   7.321 -val hypreal_cancel_factor = 
   7.322 +val hypreal_cancel_factor =
   7.323    map prep_simproc
   7.324 -   [("hypreal_eq_cancel_factor",
   7.325 -     prep_pats ["(l::hypreal) * m = n", "(l::hypreal) = m * n"], 
   7.326 +   [("hypreal_eq_cancel_factor", ["(l::hypreal) * m = n", "(l::hypreal) = m * n"],
   7.327       EqCancelFactor.proc),
   7.328 -    ("hypreal_divide_cancel_factor", 
   7.329 -     prep_pats ["((l::hypreal) * m) / n", "(l::hypreal) / (m * n)"], 
   7.330 +    ("hypreal_divide_cancel_factor", ["((l::hypreal) * m) / n", "(l::hypreal) / (m * n)"],
   7.331       DivideCancelFactor.proc)];
   7.332  
   7.333  end;
   7.334 @@ -379,16 +377,16 @@
   7.335  print_depth 22;
   7.336  set timing;
   7.337  set trace_simp;
   7.338 -fun test s = (Goal s; by (Asm_simp_tac 1)); 
   7.339 +fun test s = (Goal s; by (Asm_simp_tac 1));
   7.340  
   7.341  test "x*k = k*(y::hypreal)";
   7.342 -test "k = k*(y::hypreal)"; 
   7.343 +test "k = k*(y::hypreal)";
   7.344  test "a*(b*c) = (b::hypreal)";
   7.345  test "a*(b*c) = d*(b::hypreal)*(x*a)";
   7.346  
   7.347  
   7.348  test "(x*k) / (k*(y::hypreal)) = (uu::hypreal)";
   7.349 -test "(k) / (k*(y::hypreal)) = (uu::hypreal)"; 
   7.350 +test "(k) / (k*(y::hypreal)) = (uu::hypreal)";
   7.351  test "(a*(b*c)) / ((b::hypreal)) = (uu::hypreal)";
   7.352  test "(a*(b*c)) / (d*(b::hypreal)*(x*a)) = (uu::hypreal)";
   7.353  
   7.354 @@ -401,106 +399,106 @@
   7.355  
   7.356  Goal "0<z ==> ((x::hypreal) <= y/z) = (x*z <= y)";
   7.357  by (subgoal_tac "(x*z <= y) = (x*z <= (y/z)*z)" 1);
   7.358 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.359 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.360  by (etac ssubst 1);
   7.361 -by (stac hypreal_mult_le_cancel2 1); 
   7.362 -by (Asm_simp_tac 1); 
   7.363 +by (stac hypreal_mult_le_cancel2 1);
   7.364 +by (Asm_simp_tac 1);
   7.365  qed "pos_hypreal_le_divide_eq";
   7.366  Addsimps [inst "z" "number_of ?w" pos_hypreal_le_divide_eq];
   7.367  
   7.368  Goal "z<0 ==> ((x::hypreal) <= y/z) = (y <= x*z)";
   7.369  by (subgoal_tac "(y <= x*z) = ((y/z)*z <= x*z)" 1);
   7.370 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.371 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.372  by (etac ssubst 1);
   7.373 -by (stac hypreal_mult_le_cancel2 1); 
   7.374 -by (Asm_simp_tac 1); 
   7.375 +by (stac hypreal_mult_le_cancel2 1);
   7.376 +by (Asm_simp_tac 1);
   7.377  qed "neg_hypreal_le_divide_eq";
   7.378  Addsimps [inst "z" "number_of ?w" neg_hypreal_le_divide_eq];
   7.379  
   7.380  Goal "0<z ==> (y/z <= (x::hypreal)) = (y <= x*z)";
   7.381  by (subgoal_tac "(y <= x*z) = ((y/z)*z <= x*z)" 1);
   7.382 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.383 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.384  by (etac ssubst 1);
   7.385 -by (stac hypreal_mult_le_cancel2 1); 
   7.386 -by (Asm_simp_tac 1); 
   7.387 +by (stac hypreal_mult_le_cancel2 1);
   7.388 +by (Asm_simp_tac 1);
   7.389  qed "pos_hypreal_divide_le_eq";
   7.390  Addsimps [inst "z" "number_of ?w" pos_hypreal_divide_le_eq];
   7.391  
   7.392  Goal "z<0 ==> (y/z <= (x::hypreal)) = (x*z <= y)";
   7.393  by (subgoal_tac "(x*z <= y) = (x*z <= (y/z)*z)" 1);
   7.394 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.395 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.396  by (etac ssubst 1);
   7.397 -by (stac hypreal_mult_le_cancel2 1); 
   7.398 -by (Asm_simp_tac 1); 
   7.399 +by (stac hypreal_mult_le_cancel2 1);
   7.400 +by (Asm_simp_tac 1);
   7.401  qed "neg_hypreal_divide_le_eq";
   7.402  Addsimps [inst "z" "number_of ?w" neg_hypreal_divide_le_eq];
   7.403  
   7.404  Goal "0<z ==> ((x::hypreal) < y/z) = (x*z < y)";
   7.405  by (subgoal_tac "(x*z < y) = (x*z < (y/z)*z)" 1);
   7.406 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.407 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.408  by (etac ssubst 1);
   7.409 -by (stac hypreal_mult_less_cancel2 1); 
   7.410 -by (Asm_simp_tac 1); 
   7.411 +by (stac hypreal_mult_less_cancel2 1);
   7.412 +by (Asm_simp_tac 1);
   7.413  qed "pos_hypreal_less_divide_eq";
   7.414  Addsimps [inst "z" "number_of ?w" pos_hypreal_less_divide_eq];
   7.415  
   7.416  Goal "z<0 ==> ((x::hypreal) < y/z) = (y < x*z)";
   7.417  by (subgoal_tac "(y < x*z) = ((y/z)*z < x*z)" 1);
   7.418 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.419 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.420  by (etac ssubst 1);
   7.421 -by (stac hypreal_mult_less_cancel2 1); 
   7.422 -by (Asm_simp_tac 1); 
   7.423 +by (stac hypreal_mult_less_cancel2 1);
   7.424 +by (Asm_simp_tac 1);
   7.425  qed "neg_hypreal_less_divide_eq";
   7.426  Addsimps [inst "z" "number_of ?w" neg_hypreal_less_divide_eq];
   7.427  
   7.428  Goal "0<z ==> (y/z < (x::hypreal)) = (y < x*z)";
   7.429  by (subgoal_tac "(y < x*z) = ((y/z)*z < x*z)" 1);
   7.430 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.431 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.432  by (etac ssubst 1);
   7.433 -by (stac hypreal_mult_less_cancel2 1); 
   7.434 -by (Asm_simp_tac 1); 
   7.435 +by (stac hypreal_mult_less_cancel2 1);
   7.436 +by (Asm_simp_tac 1);
   7.437  qed "pos_hypreal_divide_less_eq";
   7.438  Addsimps [inst "z" "number_of ?w" pos_hypreal_divide_less_eq];
   7.439  
   7.440  Goal "z<0 ==> (y/z < (x::hypreal)) = (x*z < y)";
   7.441  by (subgoal_tac "(x*z < y) = (x*z < (y/z)*z)" 1);
   7.442 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.443 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.444  by (etac ssubst 1);
   7.445 -by (stac hypreal_mult_less_cancel2 1); 
   7.446 -by (Asm_simp_tac 1); 
   7.447 +by (stac hypreal_mult_less_cancel2 1);
   7.448 +by (Asm_simp_tac 1);
   7.449  qed "neg_hypreal_divide_less_eq";
   7.450  Addsimps [inst "z" "number_of ?w" neg_hypreal_divide_less_eq];
   7.451  
   7.452  Goal "z~=0 ==> ((x::hypreal) = y/z) = (x*z = y)";
   7.453  by (subgoal_tac "(x*z = y) = (x*z = (y/z)*z)" 1);
   7.454 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.455 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.456  by (etac ssubst 1);
   7.457 -by (stac hypreal_mult_eq_cancel2 1); 
   7.458 -by (Asm_simp_tac 1); 
   7.459 +by (stac hypreal_mult_eq_cancel2 1);
   7.460 +by (Asm_simp_tac 1);
   7.461  qed "hypreal_eq_divide_eq";
   7.462  Addsimps [inst "z" "number_of ?w" hypreal_eq_divide_eq];
   7.463  
   7.464  Goal "z~=0 ==> (y/z = (x::hypreal)) = (y = x*z)";
   7.465  by (subgoal_tac "(y = x*z) = ((y/z)*z = x*z)" 1);
   7.466 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2); 
   7.467 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 2);
   7.468  by (etac ssubst 1);
   7.469 -by (stac hypreal_mult_eq_cancel2 1); 
   7.470 -by (Asm_simp_tac 1); 
   7.471 +by (stac hypreal_mult_eq_cancel2 1);
   7.472 +by (Asm_simp_tac 1);
   7.473  qed "hypreal_divide_eq_eq";
   7.474  Addsimps [inst "z" "number_of ?w" hypreal_divide_eq_eq];
   7.475  
   7.476  Goal "(m/k = n/k) = (k = 0 | m = (n::hypreal))";
   7.477  by (case_tac "k=0" 1);
   7.478 -by (asm_simp_tac (simpset() addsimps [HYPREAL_DIVIDE_ZERO]) 1); 
   7.479 -by (asm_simp_tac (simpset() addsimps [hypreal_divide_eq_eq, hypreal_eq_divide_eq, 
   7.480 -                                      hypreal_mult_eq_cancel2]) 1); 
   7.481 +by (asm_simp_tac (simpset() addsimps [HYPREAL_DIVIDE_ZERO]) 1);
   7.482 +by (asm_simp_tac (simpset() addsimps [hypreal_divide_eq_eq, hypreal_eq_divide_eq,
   7.483 +                                      hypreal_mult_eq_cancel2]) 1);
   7.484  qed "hypreal_divide_eq_cancel2";
   7.485  
   7.486  Goal "(k/m = k/n) = (k = 0 | m = (n::hypreal))";
   7.487  by (case_tac "m=0 | n = 0" 1);
   7.488 -by (auto_tac (claset(), 
   7.489 -              simpset() addsimps [HYPREAL_DIVIDE_ZERO, hypreal_divide_eq_eq, 
   7.490 -                                  hypreal_eq_divide_eq, hypreal_mult_eq_cancel1]));  
   7.491 +by (auto_tac (claset(),
   7.492 +              simpset() addsimps [HYPREAL_DIVIDE_ZERO, hypreal_divide_eq_eq,
   7.493 +                                  hypreal_eq_divide_eq, hypreal_mult_eq_cancel1]));
   7.494  qed "hypreal_divide_eq_cancel1";
   7.495  
   7.496  Goal "[| 0 < r; 0 < x|] ==> (inverse x < inverse (r::hypreal)) = (r < x)";
   7.497 @@ -508,35 +506,35 @@
   7.498  by (res_inst_tac [("t","r")] (hypreal_inverse_inverse RS subst) 1);
   7.499  by (res_inst_tac [("t","x")] (hypreal_inverse_inverse RS subst) 1);
   7.500  by (auto_tac (claset() addIs [hypreal_inverse_less_swap],
   7.501 -	      simpset() delsimps [hypreal_inverse_inverse]
   7.502 -			addsimps [hypreal_inverse_gt_0]));
   7.503 +              simpset() delsimps [hypreal_inverse_inverse]
   7.504 +                        addsimps [hypreal_inverse_gt_0]));
   7.505  qed "hypreal_inverse_less_iff";
   7.506  
   7.507  Goal "[| 0 < r; 0 < x|] ==> (inverse x <= inverse r) = (r <= (x::hypreal))";
   7.508 -by (asm_simp_tac (simpset() addsimps [linorder_not_less RS sym, 
   7.509 -                                      hypreal_inverse_less_iff]) 1); 
   7.510 +by (asm_simp_tac (simpset() addsimps [linorder_not_less RS sym,
   7.511 +                                      hypreal_inverse_less_iff]) 1);
   7.512  qed "hypreal_inverse_le_iff";
   7.513  
   7.514  (** Division by 1, -1 **)
   7.515  
   7.516  Goal "(x::hypreal)/1 = x";
   7.517 -by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1); 
   7.518 +by (simp_tac (simpset() addsimps [hypreal_divide_def]) 1);
   7.519  qed "hypreal_divide_1";
   7.520  Addsimps [hypreal_divide_1];
   7.521  
   7.522  Goal "x/-1 = -(x::hypreal)";
   7.523 -by (Simp_tac 1); 
   7.524 +by (Simp_tac 1);
   7.525  qed "hypreal_divide_minus1";
   7.526  Addsimps [hypreal_divide_minus1];
   7.527  
   7.528  Goal "-1/(x::hypreal) = - (1/x)";
   7.529 -by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_minus_inverse]) 1); 
   7.530 +by (simp_tac (simpset() addsimps [hypreal_divide_def, hypreal_minus_inverse]) 1);
   7.531  qed "hypreal_minus1_divide";
   7.532  Addsimps [hypreal_minus1_divide];
   7.533  
   7.534  Goal "[| (0::hypreal) < d1; 0 < d2 |] ==> EX e. 0 < e & e < d1 & e < d2";
   7.535 -by (res_inst_tac [("x","(min d1 d2)/2")] exI 1); 
   7.536 -by (asm_simp_tac (simpset() addsimps [min_def]) 1); 
   7.537 +by (res_inst_tac [("x","(min d1 d2)/2")] exI 1);
   7.538 +by (asm_simp_tac (simpset() addsimps [min_def]) 1);
   7.539  qed "hypreal_lbound_gt_zero";
   7.540  
   7.541  
   7.542 @@ -545,20 +543,20 @@
   7.543  (** The next several equations can make the simplifier loop! **)
   7.544  
   7.545  Goal "(x < - y) = (y < - (x::hypreal))";
   7.546 -by Auto_tac;  
   7.547 -qed "hypreal_less_minus"; 
   7.548 +by Auto_tac;
   7.549 +qed "hypreal_less_minus";
   7.550  
   7.551  Goal "(- x < y) = (- y < (x::hypreal))";
   7.552 -by Auto_tac;  
   7.553 -qed "hypreal_minus_less"; 
   7.554 +by Auto_tac;
   7.555 +qed "hypreal_minus_less";
   7.556  
   7.557  Goal "(x <= - y) = (y <= - (x::hypreal))";
   7.558 -by Auto_tac;  
   7.559 -qed "hypreal_le_minus"; 
   7.560 +by Auto_tac;
   7.561 +qed "hypreal_le_minus";
   7.562  
   7.563  Goal "(- x <= y) = (- y <= (x::hypreal))";
   7.564 -by Auto_tac;  
   7.565 -qed "hypreal_minus_le"; 
   7.566 +by Auto_tac;
   7.567 +qed "hypreal_minus_le";
   7.568  
   7.569  Goal "(x = - y) = (y = - (x::hypreal))";
   7.570  by Auto_tac;
   7.571 @@ -579,51 +577,51 @@
   7.572  Addsimps [hypreal_minus_eq_cancel];
   7.573  
   7.574  Goal "(-s <= -r) = ((r::hypreal) <= s)";
   7.575 -by (stac hypreal_minus_le 1); 
   7.576 -by (Simp_tac 1); 
   7.577 +by (stac hypreal_minus_le 1);
   7.578 +by (Simp_tac 1);
   7.579  qed "hypreal_le_minus_iff";
   7.580 -Addsimps [hypreal_le_minus_iff];          
   7.581 +Addsimps [hypreal_le_minus_iff];
   7.582  
   7.583  
   7.584  (*Distributive laws for literals*)
   7.585  Addsimps (map (inst "w" "number_of ?v")
   7.586 -	  [hypreal_add_mult_distrib, hypreal_add_mult_distrib2,
   7.587 -	   hypreal_diff_mult_distrib, hypreal_diff_mult_distrib2]);
   7.588 +          [hypreal_add_mult_distrib, hypreal_add_mult_distrib2,
   7.589 +           hypreal_diff_mult_distrib, hypreal_diff_mult_distrib2]);
   7.590  
   7.591 -Addsimps (map (inst "x" "number_of ?v") 
   7.592 -	  [hypreal_less_minus, hypreal_le_minus, hypreal_equation_minus]);
   7.593 -Addsimps (map (inst "y" "number_of ?v") 
   7.594 -	  [hypreal_minus_less, hypreal_minus_le, hypreal_minus_equation]);
   7.595 +Addsimps (map (inst "x" "number_of ?v")
   7.596 +          [hypreal_less_minus, hypreal_le_minus, hypreal_equation_minus]);
   7.597 +Addsimps (map (inst "y" "number_of ?v")
   7.598 +          [hypreal_minus_less, hypreal_minus_le, hypreal_minus_equation]);
   7.599  
   7.600 -Addsimps (map (simplify (simpset()) o inst "x" "1") 
   7.601 -	  [hypreal_less_minus, hypreal_le_minus, hypreal_equation_minus]);
   7.602 -Addsimps (map (simplify (simpset()) o inst "y" "1") 
   7.603 -	  [hypreal_minus_less, hypreal_minus_le, hypreal_minus_equation]);
   7.604 +Addsimps (map (simplify (simpset()) o inst "x" "1")
   7.605 +          [hypreal_less_minus, hypreal_le_minus, hypreal_equation_minus]);
   7.606 +Addsimps (map (simplify (simpset()) o inst "y" "1")
   7.607 +          [hypreal_minus_less, hypreal_minus_le, hypreal_minus_equation]);
   7.608  
   7.609  (*** Simprules combining x+y and 0 ***)
   7.610  
   7.611  Goal "(x+y = (0::hypreal)) = (y = -x)";
   7.612 -by Auto_tac;  
   7.613 +by Auto_tac;
   7.614  qed "hypreal_add_eq_0_iff";
   7.615  AddIffs [hypreal_add_eq_0_iff];
   7.616  
   7.617  Goal "(x+y < (0::hypreal)) = (y < -x)";
   7.618 -by Auto_tac;  
   7.619 +by Auto_tac;
   7.620  qed "hypreal_add_less_0_iff";
   7.621  AddIffs [hypreal_add_less_0_iff];
   7.622  
   7.623  Goal "((0::hypreal) < x+y) = (-x < y)";
   7.624 -by Auto_tac;  
   7.625 +by Auto_tac;
   7.626  qed "hypreal_0_less_add_iff";
   7.627  AddIffs [hypreal_0_less_add_iff];
   7.628  
   7.629  Goal "(x+y <= (0::hypreal)) = (y <= -x)";
   7.630 -by Auto_tac;  
   7.631 +by Auto_tac;
   7.632  qed "hypreal_add_le_0_iff";
   7.633  AddIffs [hypreal_add_le_0_iff];
   7.634  
   7.635  Goal "((0::hypreal) <= x+y) = (-x <= y)";
   7.636 -by Auto_tac;  
   7.637 +by Auto_tac;
   7.638  qed "hypreal_0_le_add_iff";
   7.639  AddIffs [hypreal_0_le_add_iff];
   7.640  
   7.641 @@ -633,12 +631,12 @@
   7.642  **)
   7.643  
   7.644  Goal "((0::hypreal) < x-y) = (y < x)";
   7.645 -by Auto_tac;  
   7.646 +by Auto_tac;
   7.647  qed "hypreal_0_less_diff_iff";
   7.648  AddIffs [hypreal_0_less_diff_iff];
   7.649  
   7.650  Goal "((0::hypreal) <= x-y) = (y <= x)";
   7.651 -by Auto_tac;  
   7.652 +by Auto_tac;
   7.653  qed "hypreal_0_le_diff_iff";
   7.654  AddIffs [hypreal_0_le_diff_iff];
   7.655  
   7.656 @@ -671,5 +669,3 @@
   7.657  
   7.658  (*Replaces "inverse #nn" by 1/#nn *)
   7.659  Addsimps [inst "x" "number_of ?w" hypreal_inverse_eq_divide];
   7.660 -
   7.661 -
     8.1 --- a/src/HOL/Hyperreal/HyperBin.ML	Tue Aug 06 11:20:47 2002 +0200
     8.2 +++ b/src/HOL/Hyperreal/HyperBin.ML	Tue Aug 06 11:22:05 2002 +0200
     8.3 @@ -13,7 +13,7 @@
     8.4  qed "hypreal_number_of";
     8.5  Addsimps [hypreal_number_of];
     8.6  
     8.7 -Goalw [hypreal_number_of_def] "Numeral0 = (0::hypreal)"; 
     8.8 +Goalw [hypreal_number_of_def] "Numeral0 = (0::hypreal)";
     8.9  by (Simp_tac 1);
    8.10  qed "hypreal_numeral_0_eq_0";
    8.11  
    8.12 @@ -25,7 +25,7 @@
    8.13  
    8.14  Goal "(number_of v :: hypreal) + number_of v' = number_of (bin_add v v')";
    8.15  by (simp_tac
    8.16 -    (HOL_ss addsimps [hypreal_number_of_def, 
    8.17 +    (HOL_ss addsimps [hypreal_number_of_def,
    8.18                        hypreal_of_real_add RS sym, add_real_number_of]) 1);
    8.19  qed "add_hypreal_number_of";
    8.20  Addsimps [add_hypreal_number_of];
    8.21 @@ -43,7 +43,7 @@
    8.22  Goalw [hypreal_number_of_def, hypreal_diff_def]
    8.23       "(number_of v :: hypreal) - number_of w = \
    8.24  \     number_of (bin_add v (bin_minus w))";
    8.25 -by (Simp_tac 1); 
    8.26 +by (Simp_tac 1);
    8.27  qed "diff_hypreal_number_of";
    8.28  Addsimps [diff_hypreal_number_of];
    8.29  
    8.30 @@ -52,8 +52,8 @@
    8.31  
    8.32  Goal "(number_of v :: hypreal) * number_of v' = number_of (bin_mult v v')";
    8.33  by (simp_tac
    8.34 -    (HOL_ss addsimps [hypreal_number_of_def, 
    8.35 -	              hypreal_of_real_mult RS sym, mult_real_number_of]) 1);
    8.36 +    (HOL_ss addsimps [hypreal_number_of_def,
    8.37 +                      hypreal_of_real_mult RS sym, mult_real_number_of]) 1);
    8.38  qed "mult_hypreal_number_of";
    8.39  Addsimps [mult_hypreal_number_of];
    8.40  
    8.41 @@ -64,8 +64,8 @@
    8.42  (*For specialist use: NOT as default simprules*)
    8.43  Goal "2 * z = (z+z::hypreal)";
    8.44  by (simp_tac (simpset ()
    8.45 -	      addsimps [lemma, hypreal_add_mult_distrib,
    8.46 -			hypreal_numeral_1_eq_1]) 1);
    8.47 +              addsimps [lemma, hypreal_add_mult_distrib,
    8.48 +                        hypreal_numeral_1_eq_1]) 1);
    8.49  qed "hypreal_mult_2";
    8.50  
    8.51  Goal "z * 2 = (z+z::hypreal)";
    8.52 @@ -80,8 +80,8 @@
    8.53  Goal "((number_of v :: hypreal) = number_of v') = \
    8.54  \     iszero (number_of (bin_add v (bin_minus v')))";
    8.55  by (simp_tac
    8.56 -    (HOL_ss addsimps [hypreal_number_of_def, 
    8.57 -	              hypreal_of_real_eq_iff, eq_real_number_of]) 1);
    8.58 +    (HOL_ss addsimps [hypreal_number_of_def,
    8.59 +                      hypreal_of_real_eq_iff, eq_real_number_of]) 1);
    8.60  qed "eq_hypreal_number_of";
    8.61  Addsimps [eq_hypreal_number_of];
    8.62  
    8.63 @@ -91,8 +91,8 @@
    8.64  Goal "((number_of v :: hypreal) < number_of v') = \
    8.65  \     neg (number_of (bin_add v (bin_minus v')))";
    8.66  by (simp_tac
    8.67 -    (HOL_ss addsimps [hypreal_number_of_def, hypreal_of_real_less_iff, 
    8.68 -		      less_real_number_of]) 1);
    8.69 +    (HOL_ss addsimps [hypreal_number_of_def, hypreal_of_real_less_iff,
    8.70 +                      less_real_number_of]) 1);
    8.71  qed "less_hypreal_number_of";
    8.72  Addsimps [less_hypreal_number_of];
    8.73  
    8.74 @@ -102,7 +102,7 @@
    8.75  Goal "(number_of x <= (number_of y::hypreal)) = \
    8.76  \     (~ number_of y < (number_of x::hypreal))";
    8.77  by (rtac (linorder_not_less RS sym) 1);
    8.78 -qed "le_hypreal_number_of_eq_not_less"; 
    8.79 +qed "le_hypreal_number_of_eq_not_less";
    8.80  Addsimps [le_hypreal_number_of_eq_not_less];
    8.81  
    8.82  (*** New versions of existing theorems involving 0, 1 ***)
    8.83 @@ -112,19 +112,19 @@
    8.84  qed "hypreal_minus_1_eq_m1";
    8.85  
    8.86  (*Maps 0 to Numeral0 and 1 to Numeral1 and -(Numeral1) to -1*)
    8.87 -val hypreal_numeral_ss = 
    8.88 -    real_numeral_ss addsimps [hypreal_numeral_0_eq_0 RS sym, 
    8.89 -                              hypreal_numeral_1_eq_1 RS sym, 
    8.90 -		              hypreal_minus_1_eq_m1];
    8.91 +val hypreal_numeral_ss =
    8.92 +    real_numeral_ss addsimps [hypreal_numeral_0_eq_0 RS sym,
    8.93 +                              hypreal_numeral_1_eq_1 RS sym,
    8.94 +                              hypreal_minus_1_eq_m1];
    8.95  
    8.96 -fun rename_numerals th = 
    8.97 +fun rename_numerals th =
    8.98      asm_full_simplify hypreal_numeral_ss (Thm.transfer (the_context ()) th);
    8.99  
   8.100  
   8.101  (** Simplification of arithmetic when nested to the right **)
   8.102  
   8.103  Goal "number_of v + (number_of w + z) = (number_of(bin_add v w) + z::hypreal)";
   8.104 -by Auto_tac; 
   8.105 +by Auto_tac;
   8.106  qed "hypreal_add_number_of_left";
   8.107  
   8.108  Goal "number_of v *(number_of w * z) = (number_of(bin_mult v w) * z::hypreal)";
   8.109 @@ -143,7 +143,7 @@
   8.110  qed "hypreal_add_number_of_diff2";
   8.111  
   8.112  Addsimps [hypreal_add_number_of_left, hypreal_mult_number_of_left,
   8.113 -	  hypreal_add_number_of_diff1, hypreal_add_number_of_diff2]; 
   8.114 +          hypreal_add_number_of_diff1, hypreal_add_number_of_diff2];
   8.115  
   8.116  
   8.117  (**** Simprocs for numeric literals ****)
   8.118 @@ -151,15 +151,15 @@
   8.119  (** Combining of literal coefficients in sums of products **)
   8.120  
   8.121  Goal "(x < y) = (x-y < (0::hypreal))";
   8.122 -by (simp_tac (simpset() addsimps [hypreal_diff_less_eq]) 1);   
   8.123 +by (simp_tac (simpset() addsimps [hypreal_diff_less_eq]) 1);
   8.124  qed "hypreal_less_iff_diff_less_0";
   8.125  
   8.126  Goal "(x = y) = (x-y = (0::hypreal))";
   8.127 -by (simp_tac (simpset() addsimps [hypreal_diff_eq_eq]) 1);   
   8.128 +by (simp_tac (simpset() addsimps [hypreal_diff_eq_eq]) 1);
   8.129  qed "hypreal_eq_iff_diff_eq_0";
   8.130  
   8.131  Goal "(x <= y) = (x-y <= (0::hypreal))";
   8.132 -by (simp_tac (simpset() addsimps [hypreal_diff_le_eq]) 1);   
   8.133 +by (simp_tac (simpset() addsimps [hypreal_diff_le_eq]) 1);
   8.134  qed "hypreal_le_iff_diff_le_0";
   8.135  
   8.136  
   8.137 @@ -172,12 +172,12 @@
   8.138  
   8.139  (** For cancel_numerals **)
   8.140  
   8.141 -val rel_iff_rel_0_rls = 
   8.142 +val rel_iff_rel_0_rls =
   8.143      map (inst "y" "?u+?v")
   8.144 -      [hypreal_less_iff_diff_less_0, hypreal_eq_iff_diff_eq_0, 
   8.145 +      [hypreal_less_iff_diff_less_0, hypreal_eq_iff_diff_eq_0,
   8.146         hypreal_le_iff_diff_le_0] @
   8.147      map (inst "y" "n")
   8.148 -      [hypreal_less_iff_diff_less_0, hypreal_eq_iff_diff_eq_0, 
   8.149 +      [hypreal_less_iff_diff_less_0, hypreal_eq_iff_diff_eq_0,
   8.150         hypreal_le_iff_diff_le_0];
   8.151  
   8.152  Goal "!!i::hypreal. (i*u + m = j*u + n) = ((i-j)*u + m = n)";
   8.153 @@ -217,7 +217,7 @@
   8.154  qed "hypreal_le_add_iff2";
   8.155  
   8.156  Goal "-1 * (z::hypreal) = -z";
   8.157 -by (simp_tac (simpset() addsimps [hypreal_minus_1_eq_m1 RS sym, 
   8.158 +by (simp_tac (simpset() addsimps [hypreal_minus_1_eq_m1 RS sym,
   8.159                                    hypreal_mult_minus_1]) 1);
   8.160  qed "hypreal_mult_minus1";
   8.161  Addsimps [hypreal_mult_minus1];
   8.162 @@ -236,7 +236,7 @@
   8.163  
   8.164  (*Maps 0 to Numeral0 and 1 to Numeral1 so that arithmetic in simprocs
   8.165    isn't complicated by the abstract 0 and 1.*)
   8.166 -val numeral_syms = [hypreal_numeral_0_eq_0 RS sym, 
   8.167 +val numeral_syms = [hypreal_numeral_0_eq_0 RS sym,
   8.168                      hypreal_numeral_1_eq_1 RS sym];
   8.169  
   8.170  (*Utilities*)
   8.171 @@ -271,7 +271,7 @@
   8.172    | dest_summing (pos, Const ("op -", _) $ t $ u, ts) =
   8.173          dest_summing (pos, t, dest_summing (not pos, u, ts))
   8.174    | dest_summing (pos, t, ts) =
   8.175 -	if pos then t::ts else uminus_const$t :: ts;
   8.176 +        if pos then t::ts else uminus_const$t :: ts;
   8.177  
   8.178  fun dest_sum t = dest_summing (true, t, []);
   8.179  
   8.180 @@ -289,29 +289,29 @@
   8.181  val dest_times = HOLogic.dest_bin "op *" hyprealT;
   8.182  
   8.183  fun dest_prod t =
   8.184 -      let val (t,u) = dest_times t 
   8.185 +      let val (t,u) = dest_times t
   8.186        in  dest_prod t @ dest_prod u  end
   8.187        handle TERM _ => [t];
   8.188  
   8.189 -(*DON'T do the obvious simplifications; that would create special cases*) 
   8.190 +(*DON'T do the obvious simplifications; that would create special cases*)
   8.191  fun mk_coeff (k, ts) = mk_times (mk_numeral k, ts);
   8.192  
   8.193  (*Express t as a product of (possibly) a numeral with other sorted terms*)
   8.194  fun dest_coeff sign (Const ("uminus", _) $ t) = dest_coeff (~sign) t
   8.195    | dest_coeff sign t =
   8.196      let val ts = sort Term.term_ord (dest_prod t)
   8.197 -	val (n, ts') = find_first_numeral [] ts
   8.198 +        val (n, ts') = find_first_numeral [] ts
   8.199                            handle TERM _ => (1, ts)
   8.200      in (sign*n, mk_prod ts') end;
   8.201  
   8.202  (*Find first coefficient-term THAT MATCHES u*)
   8.203 -fun find_first_coeff past u [] = raise TERM("find_first_coeff", []) 
   8.204 +fun find_first_coeff past u [] = raise TERM("find_first_coeff", [])
   8.205    | find_first_coeff past u (t::terms) =
   8.206 -	let val (n,u') = dest_coeff 1 t
   8.207 -	in  if u aconv u' then (n, rev past @ terms)
   8.208 -			  else find_first_coeff (t::past) u terms
   8.209 -	end
   8.210 -	handle TERM _ => find_first_coeff (t::past) u terms;
   8.211 +        let val (n,u') = dest_coeff 1 t
   8.212 +        in  if u aconv u' then (n, rev past @ terms)
   8.213 +                          else find_first_coeff (t::past) u terms
   8.214 +        end
   8.215 +        handle TERM _ => find_first_coeff (t::past) u terms;
   8.216  
   8.217  
   8.218  (*Simplify Numeral0+n, n+Numeral0, Numeral1*n, n*Numeral1*)
   8.219 @@ -323,29 +323,29 @@
   8.220  (*To perform binary arithmetic*)
   8.221  val bin_simps =
   8.222      [hypreal_numeral_0_eq_0 RS sym, hypreal_numeral_1_eq_1 RS sym,
   8.223 -     add_hypreal_number_of, hypreal_add_number_of_left, 
   8.224 -     minus_hypreal_number_of, 
   8.225 -     diff_hypreal_number_of, mult_hypreal_number_of, 
   8.226 +     add_hypreal_number_of, hypreal_add_number_of_left,
   8.227 +     minus_hypreal_number_of,
   8.228 +     diff_hypreal_number_of, mult_hypreal_number_of,
   8.229       hypreal_mult_number_of_left] @ bin_arith_simps @ bin_rel_simps;
   8.230  
   8.231  (*To evaluate binary negations of coefficients*)
   8.232  val hypreal_minus_simps = NCons_simps @
   8.233 -                   [hypreal_minus_1_eq_m1, minus_hypreal_number_of, 
   8.234 -		    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
   8.235 -		    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
   8.236 +                   [hypreal_minus_1_eq_m1, minus_hypreal_number_of,
   8.237 +                    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
   8.238 +                    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
   8.239  
   8.240  (*To let us treat subtraction as addition*)
   8.241 -val diff_simps = [hypreal_diff_def, hypreal_minus_add_distrib, 
   8.242 +val diff_simps = [hypreal_diff_def, hypreal_minus_add_distrib,
   8.243                    hypreal_minus_minus];
   8.244  
   8.245  (*push the unary minus down: - x * y = x * - y *)
   8.246 -val hypreal_minus_mult_eq_1_to_2 = 
   8.247 -    [hypreal_minus_mult_eq1 RS sym, hypreal_minus_mult_eq2] MRS trans 
   8.248 +val hypreal_minus_mult_eq_1_to_2 =
   8.249 +    [hypreal_minus_mult_eq1 RS sym, hypreal_minus_mult_eq2] MRS trans
   8.250      |> standard;
   8.251  
   8.252  (*to extract again any uncancelled minuses*)
   8.253 -val hypreal_minus_from_mult_simps = 
   8.254 -    [hypreal_minus_minus, hypreal_minus_mult_eq1 RS sym, 
   8.255 +val hypreal_minus_from_mult_simps =
   8.256 +    [hypreal_minus_minus, hypreal_minus_mult_eq1 RS sym,
   8.257       hypreal_minus_mult_eq2 RS sym];
   8.258  
   8.259  (*combine unary minus with numeric literals, however nested within a product*)
   8.260 @@ -353,31 +353,30 @@
   8.261      [hypreal_mult_assoc, hypreal_minus_mult_eq1, hypreal_minus_mult_eq_1_to_2];
   8.262  
   8.263  (*Final simplification: cancel + and *  *)
   8.264 -val simplify_meta_eq = 
   8.265 +val simplify_meta_eq =
   8.266      Int_Numeral_Simprocs.simplify_meta_eq
   8.267           [hypreal_add_zero_left, hypreal_add_zero_right,
   8.268 - 	  hypreal_mult_0, hypreal_mult_0_right, hypreal_mult_1, 
   8.269 +          hypreal_mult_0, hypreal_mult_0_right, hypreal_mult_1,
   8.270            hypreal_mult_1_right];
   8.271  
   8.272  val prep_simproc = Real_Numeral_Simprocs.prep_simproc;
   8.273 -val prep_pats = map Real_Numeral_Simprocs.prep_pat;
   8.274  
   8.275  structure CancelNumeralsCommon =
   8.276    struct
   8.277 -  val mk_sum    	= mk_sum
   8.278 -  val dest_sum		= dest_sum
   8.279 -  val mk_coeff		= mk_coeff
   8.280 -  val dest_coeff	= dest_coeff 1
   8.281 -  val find_first_coeff	= find_first_coeff []
   8.282 +  val mk_sum            = mk_sum
   8.283 +  val dest_sum          = dest_sum
   8.284 +  val mk_coeff          = mk_coeff
   8.285 +  val dest_coeff        = dest_coeff 1
   8.286 +  val find_first_coeff  = find_first_coeff []
   8.287    val trans_tac         = Real_Numeral_Simprocs.trans_tac
   8.288 -  val norm_tac = 
   8.289 +  val norm_tac =
   8.290       ALLGOALS (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
   8.291                                           hypreal_minus_simps@hypreal_add_ac))
   8.292       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@hypreal_mult_minus_simps))
   8.293       THEN ALLGOALS
   8.294                (simp_tac (HOL_ss addsimps hypreal_minus_from_mult_simps@
   8.295                                           hypreal_add_ac@hypreal_mult_ac))
   8.296 -  val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   8.297 +  val numeral_simp_tac  = ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   8.298    val simplify_meta_eq  = simplify_meta_eq
   8.299    end;
   8.300  
   8.301 @@ -409,53 +408,52 @@
   8.302    val bal_add2 = hypreal_le_add_iff2 RS trans
   8.303  );
   8.304  
   8.305 -val cancel_numerals = 
   8.306 +val cancel_numerals =
   8.307    map prep_simproc
   8.308     [("hyprealeq_cancel_numerals",
   8.309 -     prep_pats ["(l::hypreal) + m = n", "(l::hypreal) = m + n", 
   8.310 -		"(l::hypreal) - m = n", "(l::hypreal) = m - n", 
   8.311 -		"(l::hypreal) * m = n", "(l::hypreal) = m * n"], 
   8.312 +     ["(l::hypreal) + m = n", "(l::hypreal) = m + n",
   8.313 +      "(l::hypreal) - m = n", "(l::hypreal) = m - n",
   8.314 +      "(l::hypreal) * m = n", "(l::hypreal) = m * n"],
   8.315       EqCancelNumerals.proc),
   8.316 -    ("hyprealless_cancel_numerals", 
   8.317 -     prep_pats ["(l::hypreal) + m < n", "(l::hypreal) < m + n", 
   8.318 -		"(l::hypreal) - m < n", "(l::hypreal) < m - n", 
   8.319 -		"(l::hypreal) * m < n", "(l::hypreal) < m * n"], 
   8.320 +    ("hyprealless_cancel_numerals",
   8.321 +     ["(l::hypreal) + m < n", "(l::hypreal) < m + n",
   8.322 +      "(l::hypreal) - m < n", "(l::hypreal) < m - n",
   8.323 +      "(l::hypreal) * m < n", "(l::hypreal) < m * n"],
   8.324       LessCancelNumerals.proc),
   8.325 -    ("hyprealle_cancel_numerals", 
   8.326 -     prep_pats ["(l::hypreal) + m <= n", "(l::hypreal) <= m + n", 
   8.327 -		"(l::hypreal) - m <= n", "(l::hypreal) <= m - n", 
   8.328 -		"(l::hypreal) * m <= n", "(l::hypreal) <= m * n"], 
   8.329 +    ("hyprealle_cancel_numerals",
   8.330 +     ["(l::hypreal) + m <= n", "(l::hypreal) <= m + n",
   8.331 +      "(l::hypreal) - m <= n", "(l::hypreal) <= m - n",
   8.332 +      "(l::hypreal) * m <= n", "(l::hypreal) <= m * n"],
   8.333       LeCancelNumerals.proc)];
   8.334  
   8.335  
   8.336  structure CombineNumeralsData =
   8.337    struct
   8.338 -  val add		= op + : int*int -> int 
   8.339 -  val mk_sum    	= long_mk_sum    (*to work for e.g. 2*x + 3*x *)
   8.340 -  val dest_sum		= dest_sum
   8.341 -  val mk_coeff		= mk_coeff
   8.342 -  val dest_coeff	= dest_coeff 1
   8.343 -  val left_distrib	= left_hypreal_add_mult_distrib RS trans
   8.344 +  val add               = op + : int*int -> int
   8.345 +  val mk_sum            = long_mk_sum    (*to work for e.g. 2*x + 3*x *)
   8.346 +  val dest_sum          = dest_sum
   8.347 +  val mk_coeff          = mk_coeff
   8.348 +  val dest_coeff        = dest_coeff 1
   8.349 +  val left_distrib      = left_hypreal_add_mult_distrib RS trans
   8.350    val prove_conv        = Real_Numeral_Simprocs.prove_conv_nohyps
   8.351                                                  "hypreal_combine_numerals"
   8.352    val trans_tac         = Real_Numeral_Simprocs.trans_tac
   8.353 -  val norm_tac = 
   8.354 +  val norm_tac =
   8.355       ALLGOALS (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
   8.356                                           hypreal_minus_simps@hypreal_add_ac))
   8.357       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@hypreal_mult_minus_simps))
   8.358       THEN ALLGOALS (simp_tac (HOL_ss addsimps hypreal_minus_from_mult_simps@
   8.359                                                hypreal_add_ac@hypreal_mult_ac))
   8.360 -  val numeral_simp_tac	= ALLGOALS 
   8.361 +  val numeral_simp_tac  = ALLGOALS
   8.362                      (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   8.363    val simplify_meta_eq  = simplify_meta_eq
   8.364    end;
   8.365  
   8.366  structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
   8.367 -  
   8.368 -val combine_numerals = 
   8.369 -    prep_simproc ("hypreal_combine_numerals",
   8.370 -		  prep_pats ["(i::hypreal) + j", "(i::hypreal) - j"],
   8.371 -		  CombineNumerals.proc);
   8.372 +
   8.373 +val combine_numerals =
   8.374 +  prep_simproc
   8.375 +    ("hypreal_combine_numerals", ["(i::hypreal) + j", "(i::hypreal) - j"], CombineNumerals.proc);
   8.376  
   8.377  
   8.378  (** Declarations for ExtractCommonTerm **)
   8.379 @@ -465,16 +463,16 @@
   8.380    | long_mk_prod (t :: ts) = mk_times (t, mk_prod ts);
   8.381  
   8.382  (*Find first term that matches u*)
   8.383 -fun find_first past u []         = raise TERM("find_first", []) 
   8.384 +fun find_first past u []         = raise TERM("find_first", [])
   8.385    | find_first past u (t::terms) =
   8.386 -	if u aconv t then (rev past @ terms)
   8.387 +        if u aconv t then (rev past @ terms)
   8.388          else find_first (t::past) u terms
   8.389 -	handle TERM _ => find_first (t::past) u terms;
   8.390 +        handle TERM _ => find_first (t::past) u terms;
   8.391  
   8.392  (*Final simplification: cancel + and *  *)
   8.393 -fun cancel_simplify_meta_eq cancel_th th = 
   8.394 -    Int_Numeral_Simprocs.simplify_meta_eq 
   8.395 -        [hypreal_mult_1, hypreal_mult_1_right] 
   8.396 +fun cancel_simplify_meta_eq cancel_th th =
   8.397 +    Int_Numeral_Simprocs.simplify_meta_eq
   8.398 +        [hypreal_mult_1, hypreal_mult_1_right]
   8.399          (([th, cancel_th]) MRS trans);
   8.400  
   8.401  (*** Making constant folding work for 0 and 1 too ***)
   8.402 @@ -488,36 +486,33 @@
   8.403    val prove_conv      = Real_Numeral_Simprocs.prove_conv_nohyps
   8.404                            "hypreal_abstract_numerals"
   8.405    fun norm_tac simps  = ALLGOALS (simp_tac (HOL_ss addsimps simps))
   8.406 -  val simplify_meta_eq = Bin_Simprocs.simplify_meta_eq 
   8.407 +  val simplify_meta_eq = Bin_Simprocs.simplify_meta_eq
   8.408    end
   8.409  
   8.410 -structure HyperrealAbstractNumerals = 
   8.411 +structure HyperrealAbstractNumerals =
   8.412    AbstractNumeralsFun (HyperrealAbstractNumeralsData)
   8.413  
   8.414  (*For addition, we already have rules for the operand 0.
   8.415 -  Multiplication is omitted because there are already special rules for 
   8.416 +  Multiplication is omitted because there are already special rules for
   8.417    both 0 and 1 as operands.  Unary minus is trivial, just have - 1 = -1.
   8.418    For the others, having three patterns is a compromise between just having
   8.419    one (many spurious calls) and having nine (just too many!) *)
   8.420 -val eval_numerals = 
   8.421 +val eval_numerals =
   8.422    map prep_simproc
   8.423     [("hypreal_add_eval_numerals",
   8.424 -     prep_pats ["(m::hypreal) + 1", "(m::hypreal) + number_of v"], 
   8.425 +     ["(m::hypreal) + 1", "(m::hypreal) + number_of v"],
   8.426       HyperrealAbstractNumerals.proc add_hypreal_number_of),
   8.427      ("hypreal_diff_eval_numerals",
   8.428 -     prep_pats ["(m::hypreal) - 1", "(m::hypreal) - number_of v"], 
   8.429 +     ["(m::hypreal) - 1", "(m::hypreal) - number_of v"],
   8.430       HyperrealAbstractNumerals.proc diff_hypreal_number_of),
   8.431      ("hypreal_eq_eval_numerals",
   8.432 -     prep_pats ["(m::hypreal) = 0", "(m::hypreal) = 1",
   8.433 -                "(m::hypreal) = number_of v"], 
   8.434 +     ["(m::hypreal) = 0", "(m::hypreal) = 1", "(m::hypreal) = number_of v"],
   8.435       HyperrealAbstractNumerals.proc eq_hypreal_number_of),
   8.436      ("hypreal_less_eval_numerals",
   8.437 -     prep_pats ["(m::hypreal) < 0", "(m::hypreal) < 1", 
   8.438 -                "(m::hypreal) < number_of v"], 
   8.439 +     ["(m::hypreal) < 0", "(m::hypreal) < 1", "(m::hypreal) < number_of v"],
   8.440       HyperrealAbstractNumerals.proc less_hypreal_number_of),
   8.441      ("hypreal_le_eval_numerals",
   8.442 -     prep_pats ["(m::hypreal) <= 0", "(m::hypreal) <= 1", 
   8.443 -                "(m::hypreal) <= number_of v"],
   8.444 +     ["(m::hypreal) <= 0", "(m::hypreal) <= 1", "(m::hypreal) <= number_of v"],
   8.445       HyperrealAbstractNumerals.proc le_hypreal_number_of_eq_not_less)]
   8.446  
   8.447  end;
   8.448 @@ -533,7 +528,7 @@
   8.449  print_depth 22;
   8.450  set timing;
   8.451  set trace_simp;
   8.452 -fun test s = (Goal s, by (Simp_tac 1)); 
   8.453 +fun test s = (Goal s, by (Simp_tac 1));
   8.454  
   8.455  test "l + 2 + 2 + 2 + (l + 2) + (oo + 2) = (uu::hypreal)";
   8.456  test "2*u = (u::hypreal)";
   8.457 @@ -574,10 +569,10 @@
   8.458  
   8.459  structure Hyperreal_Times_Assoc_Data : ASSOC_FOLD_DATA =
   8.460  struct
   8.461 -  val ss		= HOL_ss
   8.462 -  val eq_reflection	= eq_reflection
   8.463 +  val ss                = HOL_ss
   8.464 +  val eq_reflection     = eq_reflection
   8.465    val sg_ref    = Sign.self_ref (Theory.sign_of (the_context ()))
   8.466 -  val T	     = Hyperreal_Numeral_Simprocs.hyprealT
   8.467 +  val T      = Hyperreal_Numeral_Simprocs.hyprealT
   8.468    val plus   = Const ("op *", [T,T] ---> T)
   8.469    val add_ac = hypreal_mult_ac
   8.470  end;
   8.471 @@ -595,32 +590,32 @@
   8.472  (** number_of related to hypreal_of_real **)
   8.473  
   8.474  Goal "(number_of w < hypreal_of_real z) = (number_of w < z)";
   8.475 -by (stac (hypreal_of_real_less_iff RS sym) 1); 
   8.476 -by (Simp_tac 1); 
   8.477 +by (stac (hypreal_of_real_less_iff RS sym) 1);
   8.478 +by (Simp_tac 1);
   8.479  qed "number_of_less_hypreal_of_real_iff";
   8.480  Addsimps [number_of_less_hypreal_of_real_iff];
   8.481  
   8.482  Goal "(number_of w <= hypreal_of_real z) = (number_of w <= z)";
   8.483 -by (stac (hypreal_of_real_le_iff RS sym) 1); 
   8.484 -by (Simp_tac 1); 
   8.485 +by (stac (hypreal_of_real_le_iff RS sym) 1);
   8.486 +by (Simp_tac 1);
   8.487  qed "number_of_le_hypreal_of_real_iff";
   8.488  Addsimps [number_of_le_hypreal_of_real_iff];
   8.489  
   8.490  Goal "(hypreal_of_real z = number_of w) = (z = number_of w)";
   8.491 -by (stac (hypreal_of_real_eq_iff RS sym) 1); 
   8.492 -by (Simp_tac 1); 
   8.493 +by (stac (hypreal_of_real_eq_iff RS sym) 1);
   8.494 +by (Simp_tac 1);
   8.495  qed "hypreal_of_real_eq_number_of_iff";
   8.496  Addsimps [hypreal_of_real_eq_number_of_iff];
   8.497  
   8.498  Goal "(hypreal_of_real z < number_of w) = (z < number_of w)";
   8.499 -by (stac (hypreal_of_real_less_iff RS sym) 1); 
   8.500 -by (Simp_tac 1); 
   8.501 +by (stac (hypreal_of_real_less_iff RS sym) 1);
   8.502 +by (Simp_tac 1);
   8.503  qed "hypreal_of_real_less_number_of_iff";
   8.504  Addsimps [hypreal_of_real_less_number_of_iff];
   8.505  
   8.506  Goal "(hypreal_of_real z <= number_of w) = (z <= number_of w)";
   8.507 -by (stac (hypreal_of_real_le_iff RS sym) 1); 
   8.508 -by (Simp_tac 1); 
   8.509 +by (stac (hypreal_of_real_le_iff RS sym) 1);
   8.510 +by (Simp_tac 1);
   8.511  qed "hypreal_of_real_le_number_of_iff";
   8.512  Addsimps [hypreal_of_real_le_number_of_iff];
   8.513  
   8.514 @@ -641,8 +636,8 @@
   8.515  (** <= monotonicity results: needed for arithmetic **)
   8.516  
   8.517  Goal "[| i <= j;  (0::hypreal) <= k |] ==> i*k <= j*k";
   8.518 -by (auto_tac (claset(), 
   8.519 -              simpset() addsimps [order_le_less, hypreal_mult_less_mono1]));  
   8.520 +by (auto_tac (claset(),
   8.521 +              simpset() addsimps [order_le_less, hypreal_mult_less_mono1]));
   8.522  qed "hypreal_mult_le_mono1";
   8.523  
   8.524  Goal "[| i <= j;  (0::hypreal) <= k |] ==> k*i <= k*j";
     9.1 --- a/src/HOL/Hyperreal/NSA.ML	Tue Aug 06 11:20:47 2002 +0200
     9.2 +++ b/src/HOL/Hyperreal/NSA.ML	Tue Aug 06 11:22:05 2002 +0200
     9.3 @@ -3,7 +3,7 @@
     9.4      Copyright   : 1998  University of Cambridge
     9.5      Description : Infinite numbers, Infinitesimals,
     9.6                    infinitely close relation  etc.
     9.7 -*) 
     9.8 +*)
     9.9  
    9.10  fun CLAIM_SIMP str thms =
    9.11                 prove_goal (the_context()) str
    9.12 @@ -28,31 +28,31 @@
    9.13  qed "SReal_mult";
    9.14  
    9.15  Goalw [SReal_def] "(x::hypreal): Reals ==> inverse x : Reals";
    9.16 -by (blast_tac (claset() addIs [hypreal_of_real_inverse RS sym]) 1); 
    9.17 +by (blast_tac (claset() addIs [hypreal_of_real_inverse RS sym]) 1);
    9.18  qed "SReal_inverse";
    9.19  
    9.20  Goal "[| (x::hypreal): Reals;  y: Reals |] ==> x/y: Reals";
    9.21  by (asm_simp_tac (simpset() addsimps [SReal_mult,SReal_inverse,
    9.22 -                                      hypreal_divide_def]) 1); 
    9.23 +                                      hypreal_divide_def]) 1);
    9.24  qed "SReal_divide";
    9.25  
    9.26  Goalw [SReal_def] "(x::hypreal): Reals ==> -x : Reals";
    9.27 -by (blast_tac (claset() addIs [hypreal_of_real_minus RS sym]) 1); 
    9.28 +by (blast_tac (claset() addIs [hypreal_of_real_minus RS sym]) 1);
    9.29  qed "SReal_minus";
    9.30  
    9.31  Goal "(-x : Reals) = ((x::hypreal): Reals)";
    9.32 -by Auto_tac;  
    9.33 -by (etac SReal_minus 2); 
    9.34 -by (dtac SReal_minus 1); 
    9.35 -by Auto_tac;  
    9.36 +by Auto_tac;
    9.37 +by (etac SReal_minus 2);
    9.38 +by (dtac SReal_minus 1);
    9.39 +by Auto_tac;
    9.40  qed "SReal_minus_iff";
    9.41 -Addsimps [SReal_minus_iff]; 
    9.42 +Addsimps [SReal_minus_iff];
    9.43  
    9.44  Goal "[| (x::hypreal) + y : Reals; y: Reals |] ==> x: Reals";
    9.45  by (dres_inst_tac [("x","y")] SReal_minus 1);
    9.46  by (dtac SReal_add 1);
    9.47 -by (assume_tac 1); 
    9.48 -by Auto_tac;  
    9.49 +by (assume_tac 1);
    9.50 +by Auto_tac;
    9.51  qed "SReal_add_cancel";
    9.52  
    9.53  Goalw [SReal_def] "(x::hypreal): Reals ==> abs x : Reals";
    9.54 @@ -73,18 +73,18 @@
    9.55  
    9.56  Goal "(0::hypreal) : Reals";
    9.57  by (stac (hypreal_numeral_0_eq_0 RS sym) 1);
    9.58 -by (rtac SReal_number_of 1); 
    9.59 +by (rtac SReal_number_of 1);
    9.60  qed "Reals_0";
    9.61  Addsimps [Reals_0];
    9.62  
    9.63  Goal "(1::hypreal) : Reals";
    9.64  by (stac (hypreal_numeral_1_eq_1 RS sym) 1);
    9.65 -by (rtac SReal_number_of 1); 
    9.66 +by (rtac SReal_number_of 1);
    9.67  qed "Reals_1";
    9.68  Addsimps [Reals_1];
    9.69  
    9.70  Goalw [hypreal_divide_def] "r : Reals ==> r/(number_of w::hypreal) : Reals";
    9.71 -by (blast_tac (claset() addSIs [SReal_number_of, SReal_mult, 
    9.72 +by (blast_tac (claset() addSIs [SReal_number_of, SReal_mult,
    9.73                                  SReal_inverse]) 1);
    9.74  qed "SReal_divide_number_of";
    9.75  
    9.76 @@ -118,9 +118,9 @@
    9.77  by (Blast_tac 1);
    9.78  qed "inv_hypreal_of_real_image";
    9.79  
    9.80 -Goalw [SReal_def] 
    9.81 +Goalw [SReal_def]
    9.82        "[| EX x. x: P; P <= Reals |] ==> EX Q. P = hypreal_of_real ` Q";
    9.83 -by (Best_tac 1); 
    9.84 +by (Best_tac 1);
    9.85  qed "SReal_hypreal_of_real_image";
    9.86  
    9.87  Goal "[| (x::hypreal): Reals; y: Reals;  x<y |] ==> EX r: Reals. x<r & r<y";
    9.88 @@ -133,7 +133,7 @@
    9.89  (*------------------------------------------------------------------
    9.90                     Completeness of Reals
    9.91   ------------------------------------------------------------------*)
    9.92 -Goal "P <= Reals ==> ((EX x:P. y < x) = \ 
    9.93 +Goal "P <= Reals ==> ((EX x:P. y < x) = \
    9.94  \     (EX X. hypreal_of_real X : P & y < hypreal_of_real X))";
    9.95  by (blast_tac (claset() addSDs [SReal_iff RS iffD1]) 1);
    9.96  by (flexflex_tac );
    9.97 @@ -153,20 +153,20 @@
    9.98  (*------------------------------------------------------
    9.99      lifting of ub and property of lub
   9.100   -------------------------------------------------------*)
   9.101 -Goalw [isUb_def,setle_def] 
   9.102 +Goalw [isUb_def,setle_def]
   9.103        "(isUb (Reals) (hypreal_of_real ` Q) (hypreal_of_real Y)) = \
   9.104  \      (isUb (UNIV :: real set) Q Y)";
   9.105  by Auto_tac;
   9.106  qed "hypreal_of_real_isUb_iff";
   9.107  
   9.108 -Goalw [isLub_def,leastP_def] 
   9.109 +Goalw [isLub_def,leastP_def]
   9.110       "isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y) \
   9.111  \     ==> isLub (UNIV :: real set) Q Y";
   9.112  by (auto_tac (claset() addIs [hypreal_of_real_isUb_iff RS iffD2],
   9.113                simpset() addsimps [hypreal_of_real_isUb_iff, setge_def]));
   9.114  qed "hypreal_of_real_isLub1";
   9.115  
   9.116 -Goalw [isLub_def,leastP_def] 
   9.117 +Goalw [isLub_def,leastP_def]
   9.118        "isLub (UNIV :: real set) Q Y \
   9.119  \      ==> isLub Reals (hypreal_of_real ` Q) (hypreal_of_real Y)";
   9.120  by (auto_tac (claset(),
   9.121 @@ -184,17 +184,17 @@
   9.122  qed "hypreal_of_real_isLub_iff";
   9.123  
   9.124  (* lemmas *)
   9.125 -Goalw [isUb_def] 
   9.126 +Goalw [isUb_def]
   9.127       "isUb Reals P Y ==> EX Yo. isUb Reals P (hypreal_of_real Yo)";
   9.128  by (auto_tac (claset(), simpset() addsimps [SReal_iff]));
   9.129  qed "lemma_isUb_hypreal_of_real";
   9.130  
   9.131 -Goalw [isLub_def,leastP_def,isUb_def] 
   9.132 +Goalw [isLub_def,leastP_def,isUb_def]
   9.133       "isLub Reals P Y ==> EX Yo. isLub Reals P (hypreal_of_real Yo)";
   9.134  by (auto_tac (claset(), simpset() addsimps [SReal_iff]));
   9.135  qed "lemma_isLub_hypreal_of_real";
   9.136  
   9.137 -Goalw [isLub_def,leastP_def,isUb_def] 
   9.138 +Goalw [isLub_def,leastP_def,isUb_def]
   9.139       "EX Yo. isLub Reals P (hypreal_of_real Yo) ==> EX Y. isLub Reals P Y";
   9.140  by Auto_tac;
   9.141  qed "lemma_isLub_hypreal_of_real2";
   9.142 @@ -203,7 +203,7 @@
   9.143  \     ==> EX t::hypreal. isLub Reals P t";
   9.144  by (ftac SReal_hypreal_of_real_image 1);
   9.145  by (Auto_tac THEN dtac lemma_isUb_hypreal_of_real 1);
   9.146 -by (auto_tac (claset() addSIs [reals_complete, lemma_isLub_hypreal_of_real2], 
   9.147 +by (auto_tac (claset() addSIs [reals_complete, lemma_isLub_hypreal_of_real2],
   9.148       simpset() addsimps [hypreal_of_real_isLub_iff,hypreal_of_real_isUb_iff]));
   9.149  qed "SReal_complete";
   9.150  
   9.151 @@ -215,7 +215,7 @@
   9.152  qed "HFinite_add";
   9.153  
   9.154  Goalw [HFinite_def] "[|x : HFinite; y : HFinite|] ==> x*y : HFinite";
   9.155 -by (Asm_full_simp_tac 1); 
   9.156 +by (Asm_full_simp_tac 1);
   9.157  by (blast_tac (claset() addSIs [SReal_mult,hrabs_mult_less]) 1);
   9.158  qed "HFinite_mult";
   9.159  
   9.160 @@ -256,13 +256,13 @@
   9.161  
   9.162  Goal "0 : HFinite";
   9.163  by (stac (hypreal_numeral_0_eq_0 RS sym) 1);
   9.164 -by (rtac HFinite_number_of 1); 
   9.165 +by (rtac HFinite_number_of 1);
   9.166  qed "HFinite_0";
   9.167  Addsimps [HFinite_0];
   9.168  
   9.169  Goal "1 : HFinite";
   9.170  by (stac (hypreal_numeral_1_eq_1 RS sym) 1);
   9.171 -by (rtac HFinite_number_of 1); 
   9.172 +by (rtac HFinite_number_of 1);
   9.173  qed "HFinite_1";
   9.174  Addsimps [HFinite_1];
   9.175  
   9.176 @@ -273,10 +273,10 @@
   9.177  by (auto_tac (claset() addSDs [not_hypreal_leE], simpset()));
   9.178  by (auto_tac (claset() addSIs [bexI] addIs [order_le_less_trans],
   9.179       simpset() addsimps [hrabs_eqI1,hrabs_eqI2,hrabs_minus_eqI1,HFinite_def]));
   9.180 -qed "HFinite_bounded"; 
   9.181 +qed "HFinite_bounded";
   9.182  
   9.183  (*------------------------------------------------------------------
   9.184 -       Set of infinitesimals is a subring of the hyperreals   
   9.185 +       Set of infinitesimals is a subring of the hyperreals
   9.186   ------------------------------------------------------------------*)
   9.187  Goalw [Infinitesimal_def]
   9.188        "x : Infinitesimal ==> ALL r: Reals. 0 < r --> abs x < r";
   9.189 @@ -289,20 +289,20 @@
   9.190  AddIffs [Infinitesimal_zero];
   9.191  
   9.192  Goal "x/(2::hypreal) + x/(2::hypreal) = x";
   9.193 -by Auto_tac;  
   9.194 +by Auto_tac;
   9.195  qed "hypreal_sum_of_halves";
   9.196  
   9.197  Goal "0 < r ==> 0 < r/(2::hypreal)";
   9.198 -by Auto_tac;  
   9.199 +by Auto_tac;
   9.200  qed "hypreal_half_gt_zero";
   9.201  
   9.202 -Goalw [Infinitesimal_def] 
   9.203 +Goalw [Infinitesimal_def]
   9.204       "[| x : Infinitesimal; y : Infinitesimal |] ==> (x+y) : Infinitesimal";
   9.205  by Auto_tac;
   9.206  by (rtac (hypreal_sum_of_halves RS subst) 1);
   9.207  by (dtac hypreal_half_gt_zero 1);
   9.208 -by (blast_tac (claset() addIs [hrabs_add_less, hrabs_add_less, 
   9.209 -                               SReal_divide_number_of]) 1); 
   9.210 +by (blast_tac (claset() addIs [hrabs_add_less, hrabs_add_less,
   9.211 +                               SReal_divide_number_of]) 1);
   9.212  qed "Infinitesimal_add";
   9.213  
   9.214  Goalw [Infinitesimal_def] "(-x:Infinitesimal) = (x:Infinitesimal)";
   9.215 @@ -315,11 +315,11 @@
   9.216      (simpset() addsimps [hypreal_diff_def, Infinitesimal_add]) 1);
   9.217  qed "Infinitesimal_diff";
   9.218  
   9.219 -Goalw [Infinitesimal_def] 
   9.220 +Goalw [Infinitesimal_def]
   9.221       "[| x : Infinitesimal; y : Infinitesimal |] ==> (x * y) : Infinitesimal";
   9.222  by Auto_tac;
   9.223  by (case_tac "y=0" 1);
   9.224 -by (cut_inst_tac [("u","abs x"),("v","1"),("x","abs y"),("y","r")] 
   9.225 +by (cut_inst_tac [("u","abs x"),("v","1"),("x","abs y"),("y","r")]
   9.226      hypreal_mult_less_mono 2);
   9.227  by Auto_tac;
   9.228  qed "Infinitesimal_mult";
   9.229 @@ -328,13 +328,13 @@
   9.230  by (auto_tac (claset() addSDs [HFiniteD],
   9.231                simpset() addsimps [Infinitesimal_def]));
   9.232  by (ftac hrabs_less_gt_zero 1);
   9.233 -by (dres_inst_tac [("x","r/t")] bspec 1); 
   9.234 +by (dres_inst_tac [("x","r/t")] bspec 1);
   9.235  by (blast_tac (claset() addIs [SReal_divide]) 1);
   9.236 -by (asm_full_simp_tac (simpset() addsimps [hypreal_0_less_divide_iff]) 1); 
   9.237 +by (asm_full_simp_tac (simpset() addsimps [hypreal_0_less_divide_iff]) 1);
   9.238  by (case_tac "x=0 | y=0" 1);
   9.239 -by (cut_inst_tac [("u","abs x"),("v","r/t"),("x","abs y")] 
   9.240 +by (cut_inst_tac [("u","abs x"),("v","r/t"),("x","abs y")]
   9.241      hypreal_mult_less_mono 2);
   9.242 -by (auto_tac (claset(), simpset() addsimps [hypreal_0_less_divide_iff]));  
   9.243 +by (auto_tac (claset(), simpset() addsimps [hypreal_0_less_divide_iff]));
   9.244  qed "Infinitesimal_HFinite_mult";
   9.245  
   9.246  Goal "[| x : Infinitesimal; y : HFinite |] ==> (y * x) : Infinitesimal";
   9.247 @@ -343,17 +343,17 @@
   9.248  qed "Infinitesimal_HFinite_mult2";
   9.249  
   9.250  (*** rather long proof ***)
   9.251 -Goalw [HInfinite_def,Infinitesimal_def] 
   9.252 +Goalw [HInfinite_def,Infinitesimal_def]
   9.253       "x: HInfinite ==> inverse x: Infinitesimal";
   9.254  by Auto_tac;
   9.255  by (eres_inst_tac [("x","inverse r")] ballE 1);
   9.256  by (stac hrabs_inverse 1);
   9.257 -by (forw_inst_tac [("x1","r"),("z","abs x")] 
   9.258 +by (forw_inst_tac [("x1","r"),("z","abs x")]
   9.259      (hypreal_inverse_gt_0 RS order_less_trans) 1);
   9.260  by (assume_tac 1);
   9.261  by (dtac ((hypreal_inverse_inverse RS sym) RS subst) 1);
   9.262  by (rtac (hypreal_inverse_less_iff RS iffD1) 1);
   9.263 -by (auto_tac (claset(), simpset() addsimps [SReal_inverse]));  
   9.264 +by (auto_tac (claset(), simpset() addsimps [SReal_inverse]));
   9.265  qed "HInfinite_inverse_Infinitesimal";
   9.266  
   9.267  
   9.268 @@ -362,13 +362,13 @@
   9.269  by Auto_tac;
   9.270  by (eres_inst_tac [("x","1")] ballE 1);
   9.271  by (eres_inst_tac [("x","r")] ballE 1);
   9.272 -by (case_tac "y=0" 1); 
   9.273 +by (case_tac "y=0" 1);
   9.274  by (cut_inst_tac [("x","1"),("y","abs x"),
   9.275                    ("u","r"),("v","abs y")] hypreal_mult_less_mono 2);
   9.276 -by (auto_tac (claset(), simpset() addsimps hypreal_mult_ac));  
   9.277 +by (auto_tac (claset(), simpset() addsimps hypreal_mult_ac));
   9.278  qed "HInfinite_mult";
   9.279  
   9.280 -Goalw [HInfinite_def] 
   9.281 +Goalw [HInfinite_def]
   9.282        "[|x: HInfinite; 0 <= y; 0 <= x|] ==> (x + y): HInfinite";
   9.283  by (auto_tac (claset() addSIs [hypreal_add_zero_less_le_mono],
   9.284                simpset() addsimps [hrabs_eqI1, hypreal_add_commute,
   9.285 @@ -401,7 +401,7 @@
   9.286                                 order_less_imp_le]) 1);
   9.287  qed "HInfinite_add_lt_zero";
   9.288  
   9.289 -Goal "[|a: HFinite; b: HFinite; c: HFinite|] \ 
   9.290 +Goal "[|a: HFinite; b: HFinite; c: HFinite|] \
   9.291  \     ==> a*a + b*b + c*c : HFinite";
   9.292  by (auto_tac (claset() addIs [HFinite_mult,HFinite_add], simpset()));
   9.293  qed "HFinite_sum_squares";
   9.294 @@ -423,7 +423,7 @@
   9.295  by (Blast_tac 1);
   9.296  qed "HFinite_diff_Infinitesimal_hrabs";
   9.297  
   9.298 -Goalw [Infinitesimal_def] 
   9.299 +Goalw [Infinitesimal_def]
   9.300        "[| e : Infinitesimal; abs x < e |] ==> x : Infinitesimal";
   9.301  by (auto_tac (claset() addSDs [bspec], simpset()));
   9.302  by (dres_inst_tac [("x","e")] (hrabs_ge_self RS order_le_less_trans) 1);
   9.303 @@ -431,11 +431,11 @@
   9.304  qed "hrabs_less_Infinitesimal";
   9.305  
   9.306  Goal "[| e : Infinitesimal; abs x <= e |] ==> x : Infinitesimal";
   9.307 -by (blast_tac (claset() addDs [order_le_imp_less_or_eq] 
   9.308 +by (blast_tac (claset() addDs [order_le_imp_less_or_eq]
   9.309                          addIs [hrabs_less_Infinitesimal]) 1);
   9.310  qed "hrabs_le_Infinitesimal";
   9.311  
   9.312 -Goalw [Infinitesimal_def] 
   9.313 +Goalw [Infinitesimal_def]
   9.314        "[| e : Infinitesimal; \
   9.315  \         e' : Infinitesimal; \
   9.316  \         e' < x ; x < e |] ==> x : Infinitesimal";
   9.317 @@ -451,16 +451,16 @@
   9.318      simpset() addsimps [hypreal_le_eq_less_or_eq]));
   9.319  qed "Infinitesimal_interval2";
   9.320  
   9.321 -Goalw [Infinitesimal_def] 
   9.322 +Goalw [Infinitesimal_def]
   9.323       "[| x ~: Infinitesimal;  y ~: Infinitesimal|] ==> (x*y) ~:Infinitesimal";
   9.324  by (Clarify_tac 1);
   9.325 -by (asm_full_simp_tac (simpset() addsimps [linorder_not_less]) 1); 
   9.326 +by (asm_full_simp_tac (simpset() addsimps [linorder_not_less]) 1);
   9.327  by (eres_inst_tac [("x","r*ra")] ballE 1);
   9.328  by (fast_tac (claset() addIs [SReal_mult]) 2);
   9.329  by (auto_tac (claset(), simpset() addsimps [hypreal_0_less_mult_iff]));
   9.330  by (cut_inst_tac [("x","ra"),("y","abs y"),
   9.331                    ("u","r"),("v","abs x")] hypreal_mult_le_mono 1);
   9.332 -by Auto_tac;  
   9.333 +by Auto_tac;
   9.334  qed "not_Infinitesimal_mult";
   9.335  
   9.336  Goal "x*y : Infinitesimal ==> x : Infinitesimal | y : Infinitesimal";
   9.337 @@ -480,20 +480,20 @@
   9.338  by (blast_tac (claset() addDs [HFinite_mult,not_Infinitesimal_mult]) 1);
   9.339  qed "HFinite_Infinitesimal_diff_mult";
   9.340  
   9.341 -Goalw [Infinitesimal_def,HFinite_def]  
   9.342 +Goalw [Infinitesimal_def,HFinite_def]
   9.343        "Infinitesimal <= HFinite";
   9.344 -by Auto_tac;  
   9.345 -by (res_inst_tac [("x","1")] bexI 1); 
   9.346 -by Auto_tac;  
   9.347 +by Auto_tac;
   9.348 +by (res_inst_tac [("x","1")] bexI 1);
   9.349 +by Auto_tac;
   9.350  qed "Infinitesimal_subset_HFinite";
   9.351  
   9.352  Goal "x: Infinitesimal ==> x * hypreal_of_real r : Infinitesimal";
   9.353 -by (etac (HFinite_hypreal_of_real RSN 
   9.354 +by (etac (HFinite_hypreal_of_real RSN
   9.355            (2,Infinitesimal_HFinite_mult)) 1);
   9.356  qed "Infinitesimal_hypreal_of_real_mult";
   9.357  
   9.358  Goal "x: Infinitesimal ==> hypreal_of_real r * x: Infinitesimal";
   9.359 -by (etac (HFinite_hypreal_of_real RSN 
   9.360 +by (etac (HFinite_hypreal_of_real RSN
   9.361            (2,Infinitesimal_HFinite_mult2)) 1);
   9.362  qed "Infinitesimal_hypreal_of_real_mult2";
   9.363  
   9.364 @@ -501,7 +501,7 @@
   9.365                     Infinitely close relation @=
   9.366   ----------------------------------------------------------------------*)
   9.367  
   9.368 -Goalw [Infinitesimal_def,approx_def] 
   9.369 +Goalw [Infinitesimal_def,approx_def]
   9.370          "(x:Infinitesimal) = (x @= 0)";
   9.371  by (Simp_tac 1);
   9.372  qed "mem_infmal_iff";
   9.373 @@ -525,33 +525,33 @@
   9.374  qed "approx_sym";
   9.375  
   9.376  Goalw [approx_def]  "[| x @= y; y @= z |] ==> x @= z";
   9.377 -by (dtac Infinitesimal_add 1); 
   9.378 -by (assume_tac 1); 
   9.379 -by Auto_tac;  
   9.380 +by (dtac Infinitesimal_add 1);
   9.381 +by (assume_tac 1);
   9.382 +by Auto_tac;
   9.383  qed "approx_trans";
   9.384  
   9.385  Goal "[| r @= x; s @= x |] ==> r @= s";
   9.386 -by (blast_tac (claset() addIs [approx_sym, approx_trans]) 1); 
   9.387 +by (blast_tac (claset() addIs [approx_sym, approx_trans]) 1);
   9.388  qed "approx_trans2";
   9.389  
   9.390  Goal "[| x @= r; x @= s|] ==> r @= s";
   9.391 -by (blast_tac (claset() addIs [approx_sym, approx_trans]) 1); 
   9.392 +by (blast_tac (claset() addIs [approx_sym, approx_trans]) 1);
   9.393  qed "approx_trans3";
   9.394  
   9.395 -Goal "(number_of w @= x) = (x @= number_of w)"; 
   9.396 -by (blast_tac (claset() addIs [approx_sym]) 1); 
   9.397 +Goal "(number_of w @= x) = (x @= number_of w)";
   9.398 +by (blast_tac (claset() addIs [approx_sym]) 1);
   9.399  qed "number_of_approx_reorient";
   9.400  
   9.401 -Goal "(0 @= x) = (x @= 0)"; 
   9.402 -by (blast_tac (claset() addIs [approx_sym]) 1); 
   9.403 +Goal "(0 @= x) = (x @= 0)";
   9.404 +by (blast_tac (claset() addIs [approx_sym]) 1);
   9.405  qed "zero_approx_reorient";
   9.406  
   9.407 -Goal "(1 @= x) = (x @= 1)"; 
   9.408 -by (blast_tac (claset() addIs [approx_sym]) 1); 
   9.409 +Goal "(1 @= x) = (x @= 1)";
   9.410 +by (blast_tac (claset() addIs [approx_sym]) 1);
   9.411  qed "one_approx_reorient";
   9.412  
   9.413  
   9.414 -(*** re-orientation, following HOL/Integ/Bin.ML 
   9.415 +(*** re-orientation, following HOL/Integ/Bin.ML
   9.416       We re-orient x @=y where x is 0, 1 or a numeral, unless y is as well!
   9.417   ***)
   9.418  
   9.419 @@ -560,7 +560,7 @@
   9.420  val meta_one_approx_reorient = one_approx_reorient RS eq_reflection;
   9.421  val meta_number_of_approx_reorient = number_of_approx_reorient RS eq_reflection;
   9.422  
   9.423 -(*reorientation simplification procedure: reorients (polymorphic) 
   9.424 +(*reorientation simplification procedure: reorients (polymorphic)
   9.425    0 = x, 1 = x, nnn = x provided x isn't 0, 1 or a numeral.*)
   9.426  fun reorient_proc sg _ (_ $ t $ u) =
   9.427    case u of
   9.428 @@ -568,15 +568,14 @@
   9.429      | Const("1", _) => None
   9.430      | Const("Numeral.number_of", _) $ _ => None
   9.431      | _ => Some (case t of
   9.432 -		Const("0", _) => meta_zero_approx_reorient
   9.433 -	      | Const("1", _) => meta_one_approx_reorient
   9.434 -	      | Const("Numeral.number_of", _) $ _ => 
   9.435 +                Const("0", _) => meta_zero_approx_reorient
   9.436 +              | Const("1", _) => meta_one_approx_reorient
   9.437 +              | Const("Numeral.number_of", _) $ _ =>
   9.438                                   meta_number_of_approx_reorient);
   9.439  
   9.440 -val approx_reorient_simproc = 
   9.441 -    Bin_Simprocs.prep_simproc ("reorient_simproc",
   9.442 -		  Bin_Simprocs.prep_pats ["0@=x", "1@=x", "number_of w @= x"], 
   9.443 -		  reorient_proc);
   9.444 +val approx_reorient_simproc =
   9.445 +  Bin_Simprocs.prep_simproc
   9.446 +    ("reorient_simproc", ["0@=x", "1@=x", "number_of w @= x"], reorient_proc);
   9.447  
   9.448  Addsimprocs [approx_reorient_simproc];
   9.449  
   9.450 @@ -588,17 +587,17 @@
   9.451  qed "Infinitesimal_approx_minus";
   9.452  
   9.453  Goalw [monad_def] "(x @= y) = (monad(x)=monad(y))";
   9.454 -by (auto_tac (claset() addDs [approx_sym] 
   9.455 +by (auto_tac (claset() addDs [approx_sym]
   9.456                         addSEs [approx_trans,equalityCE],
   9.457                simpset()));
   9.458  qed "approx_monad_iff";
   9.459  
   9.460  Goal "[| x: Infinitesimal; y: Infinitesimal |] ==> x @= y";
   9.461  by (asm_full_simp_tac (simpset() addsimps [mem_infmal_iff]) 1);
   9.462 -by (blast_tac (claset() addIs [approx_trans, approx_sym]) 1); 
   9.463 +by (blast_tac (claset() addIs [approx_trans, approx_sym]) 1);
   9.464  qed "Infinitesimal_approx";
   9.465  
   9.466 -val prem1::prem2::rest = 
   9.467 +val prem1::prem2::rest =
   9.468  goalw thy [approx_def] "[| a @= b; c @= d |] ==> a+c @= b+d";
   9.469  by (stac hypreal_minus_add_distrib 1);
   9.470  by (stac hypreal_add_assoc 1);
   9.471 @@ -627,13 +626,13 @@
   9.472  by (blast_tac (claset() addSIs [approx_add,approx_minus]) 1);
   9.473  qed "approx_add_minus";
   9.474  
   9.475 -Goalw [approx_def] "[| a @= b; c: HFinite|] ==> a*c @= b*c"; 
   9.476 +Goalw [approx_def] "[| a @= b; c: HFinite|] ==> a*c @= b*c";
   9.477  by (asm_full_simp_tac (simpset() addsimps [Infinitesimal_HFinite_mult,
   9.478 -    hypreal_minus_mult_eq1,hypreal_add_mult_distrib RS sym] 
   9.479 +    hypreal_minus_mult_eq1,hypreal_add_mult_distrib RS sym]
   9.480      delsimps [hypreal_minus_mult_eq1 RS sym]) 1);
   9.481  qed "approx_mult1";
   9.482  
   9.483 -Goal "[|a @= b; c: HFinite|] ==> c*a @= c*b"; 
   9.484 +Goal "[|a @= b; c: HFinite|] ==> c*a @= c*b";
   9.485  by (asm_simp_tac (simpset() addsimps [approx_mult1,hypreal_mult_commute]) 1);
   9.486  qed "approx_mult2";
   9.487  
   9.488 @@ -653,7 +652,7 @@
   9.489  by (Asm_simp_tac 1);
   9.490  qed "approx_eq_imp";
   9.491  
   9.492 -Goal "x: Infinitesimal ==> -x @= x"; 
   9.493 +Goal "x: Infinitesimal ==> -x @= x";
   9.494  by (fast_tac (HOL_cs addIs [Infinitesimal_minus_iff RS iffD2,
   9.495      mem_infmal_iff RS iffD1,approx_trans2]) 1);
   9.496  qed "Infinitesimal_minus_approx";
   9.497 @@ -706,26 +705,26 @@
   9.498  
   9.499  Goal "d + b  @= d + c ==> b @= c";
   9.500  by (dtac (approx_minus_iff RS iffD1) 1);
   9.501 -by (asm_full_simp_tac (simpset() addsimps 
   9.502 -    [hypreal_minus_add_distrib,approx_minus_iff RS sym] 
   9.503 +by (asm_full_simp_tac (simpset() addsimps
   9.504 +    [hypreal_minus_add_distrib,approx_minus_iff RS sym]
   9.505      @ hypreal_add_ac) 1);
   9.506  qed "approx_add_left_cancel";
   9.507  
   9.508  Goal "b + d @= c + d ==> b @= c";
   9.509  by (rtac approx_add_left_cancel 1);
   9.510 -by (asm_full_simp_tac (simpset() addsimps 
   9.511 +by (asm_full_simp_tac (simpset() addsimps
   9.512      [hypreal_add_commute]) 1);
   9.513  qed "approx_add_right_cancel";
   9.514  
   9.515  Goal "b @= c ==> d + b @= d + c";
   9.516  by (rtac (approx_minus_iff RS iffD2) 1);
   9.517 -by (asm_full_simp_tac (simpset() addsimps 
   9.518 -    [hypreal_minus_add_distrib,approx_minus_iff RS sym] 
   9.519 +by (asm_full_simp_tac (simpset() addsimps
   9.520 +    [hypreal_minus_add_distrib,approx_minus_iff RS sym]
   9.521      @ hypreal_add_ac) 1);
   9.522  qed "approx_add_mono1";
   9.523  
   9.524  Goal "b @= c ==> b + a @= c + a";
   9.525 -by (asm_simp_tac (simpset() addsimps 
   9.526 +by (asm_simp_tac (simpset() addsimps
   9.527      [hypreal_add_commute,approx_add_mono1]) 1);
   9.528  qed "approx_add_mono2";
   9.529  
   9.530 @@ -745,7 +744,7 @@
   9.531  Goal "[| x: HFinite; x @= y |] ==> y: HFinite";
   9.532  by (dtac (bex_Infinitesimal_iff2 RS iffD2) 1);
   9.533  by (Step_tac 1);
   9.534 -by (dtac (Infinitesimal_subset_HFinite RS subsetD 
   9.535 +by (dtac (Infinitesimal_subset_HFinite RS subsetD
   9.536            RS (HFinite_minus_iff RS iffD2)) 1);
   9.537  by (dtac HFinite_add 1);
   9.538  by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc]));
   9.539 @@ -757,11 +756,11 @@
   9.540  qed "approx_hypreal_of_real_HFinite";
   9.541  
   9.542  Goal "[|a @= b; c @= d; b: HFinite; d: HFinite|] ==> a*c @= b*d";
   9.543 -by (rtac approx_trans 1); 
   9.544 -by (rtac approx_mult2 2); 
   9.545 +by (rtac approx_trans 1);
   9.546 +by (rtac approx_mult2 2);
   9.547  by (rtac approx_mult1 1);
   9.548 -by (blast_tac (claset() addIs [approx_HFinite, approx_sym]) 2);  
   9.549 -by Auto_tac;  
   9.550 +by (blast_tac (claset() addIs [approx_HFinite, approx_sym]) 2);
   9.551 +by Auto_tac;
   9.552  qed "approx_mult_HFinite";
   9.553  
   9.554  Goal "[|a @= hypreal_of_real b; c @= hypreal_of_real d |] \
   9.555 @@ -800,44 +799,44 @@
   9.556  qed "approx_SReal_mult_cancel";
   9.557  
   9.558  Goal "[| a: Reals; a ~= 0|] ==> (a* w @= a*z) = (w @= z)";
   9.559 -by (auto_tac (claset() addSIs [approx_mult2,SReal_subset_HFinite RS subsetD] 
   9.560 +by (auto_tac (claset() addSIs [approx_mult2,SReal_subset_HFinite RS subsetD]
   9.561      addIs [approx_SReal_mult_cancel], simpset()));
   9.562  qed "approx_SReal_mult_cancel_iff1";
   9.563  Addsimps [approx_SReal_mult_cancel_iff1];
   9.564  
   9.565  Goal "[| z <= f; f @= g; g <= z |] ==> f @= z";
   9.566 -by (asm_full_simp_tac (simpset() addsimps [bex_Infinitesimal_iff2 RS sym]) 1); 
   9.567 -by Auto_tac;  
   9.568 +by (asm_full_simp_tac (simpset() addsimps [bex_Infinitesimal_iff2 RS sym]) 1);
   9.569 +by Auto_tac;
   9.570  by (res_inst_tac [("x","g+y-z")] bexI 1);
   9.571 -by (Simp_tac 1); 
   9.572 -by (rtac Infinitesimal_interval2 1); 
   9.573 -by (rtac Infinitesimal_zero 2); 
   9.574 -by Auto_tac;  
   9.575 +by (Simp_tac 1);
   9.576 +by (rtac Infinitesimal_interval2 1);
   9.577 +by (rtac Infinitesimal_zero 2);
   9.578 +by Auto_tac;
   9.579  qed "approx_le_bound";
   9.580  
   9.581  (*-----------------------------------------------------------------
   9.582      Zero is the only infinitesimal that is also a real
   9.583   -----------------------------------------------------------------*)
   9.584  
   9.585 -Goalw [Infinitesimal_def] 
   9.586 +Goalw [Infinitesimal_def]
   9.587       "[| x: Reals; y: Infinitesimal; 0 < x |] ==> y < x";
   9.588  by (rtac (hrabs_ge_self RS order_le_less_trans) 1);
   9.589 -by Auto_tac;  
   9.590 +by Auto_tac;
   9.591  qed "Infinitesimal_less_SReal";
   9.592  
   9.593  Goal "y: Infinitesimal ==> ALL r: Reals. 0 < r --> y < r";
   9.594  by (blast_tac (claset() addIs [Infinitesimal_less_SReal]) 1);
   9.595  qed "Infinitesimal_less_SReal2";
   9.596  
   9.597 -Goalw [Infinitesimal_def] 
   9.598 +Goalw [Infinitesimal_def]
   9.599       "[| 0 < y;  y: Reals|] ==> y ~: Infinitesimal";
   9.600  by (auto_tac (claset(), simpset() addsimps [hrabs_def]));
   9.601  qed "SReal_not_Infinitesimal";
   9.602  
   9.603  Goal "[| y < 0;  y : Reals |] ==> y ~: Infinitesimal";
   9.604 -by (stac (Infinitesimal_minus_iff RS sym) 1); 
   9.605 -by (rtac SReal_not_Infinitesimal 1); 
   9.606 -by Auto_tac;  
   9.607 +by (stac (Infinitesimal_minus_iff RS sym) 1);
   9.608 +by (rtac SReal_not_Infinitesimal 1);
   9.609 +by Auto_tac;
   9.610  qed "SReal_minus_not_Infinitesimal";
   9.611  
   9.612  Goal "Reals Int Infinitesimal = {0}";
   9.613 @@ -854,7 +853,7 @@
   9.614  
   9.615  Goal "[| x : Reals; x ~= 0 |] ==> x : HFinite - Infinitesimal";
   9.616  by (auto_tac (claset() addDs [SReal_Infinitesimal_zero,
   9.617 -                              SReal_subset_HFinite RS subsetD], 
   9.618 +                              SReal_subset_HFinite RS subsetD],
   9.619                simpset()));
   9.620  qed "SReal_HFinite_diff_Infinitesimal";
   9.621  
   9.622 @@ -864,9 +863,9 @@
   9.623  qed "hypreal_of_real_HFinite_diff_Infinitesimal";
   9.624  
   9.625  Goal "(hypreal_of_real x : Infinitesimal) = (x=0)";
   9.626 -by Auto_tac;  
   9.627 -by (rtac ccontr 1); 
   9.628 -by (rtac (hypreal_of_real_HFinite_diff_Infinitesimal RS DiffD2) 1); 
   9.629 +by Auto_tac;
   9.630 +by (rtac ccontr 1);
   9.631 +by (rtac (hypreal_of_real_HFinite_diff_Infinitesimal RS DiffD2) 1);
   9.632  by Auto_tac;
   9.633  qed "hypreal_of_real_Infinitesimal_iff_0";
   9.634  AddIffs [hypreal_of_real_Infinitesimal_iff_0];
   9.635 @@ -879,17 +878,17 @@
   9.636  (*again: 1 is a special case, but not 0 this time*)
   9.637  Goal "1 ~: Infinitesimal";
   9.638  by (stac (hypreal_numeral_1_eq_1 RS sym) 1);
   9.639 -by (rtac number_of_not_Infinitesimal 1); 
   9.640 -by (Simp_tac 1); 
   9.641 +by (rtac number_of_not_Infinitesimal 1);
   9.642 +by (Simp_tac 1);
   9.643  qed "one_not_Infinitesimal";
   9.644  Addsimps [one_not_Infinitesimal];
   9.645  
   9.646  Goal "[| y: Reals; x @= y; y~= 0 |] ==> x ~= 0";
   9.647  by (cut_inst_tac [("x","y")] hypreal_trichotomy 1);
   9.648 -by (Asm_full_simp_tac 1); 
   9.649 -by (blast_tac (claset() addDs 
   9.650 -		[approx_sym RS (mem_infmal_iff RS iffD2),
   9.651 -		 SReal_not_Infinitesimal, SReal_minus_not_Infinitesimal]) 1);
   9.652 +by (Asm_full_simp_tac 1);
   9.653 +by (blast_tac (claset() addDs
   9.654 +                [approx_sym RS (mem_infmal_iff RS iffD2),
   9.655 +                 SReal_not_Infinitesimal, SReal_minus_not_Infinitesimal]) 1);
   9.656  qed "approx_SReal_not_zero";
   9.657  
   9.658  Goal "[| x @= y; y : HFinite - Infinitesimal |] \
   9.659 @@ -900,24 +899,24 @@
   9.660  by (blast_tac (claset() addDs [approx_sym]) 1);
   9.661  qed "HFinite_diff_Infinitesimal_approx";
   9.662  
   9.663 -(*The premise y~=0 is essential; otherwise x/y =0 and we lose the 
   9.664 +(*The premise y~=0 is essential; otherwise x/y =0 and we lose the
   9.665    HFinite premise.*)
   9.666  Goal "[| y ~= 0;  y: Infinitesimal;  x/y : HFinite |] ==> x : Infinitesimal";
   9.667  by (dtac Infinitesimal_HFinite_mult2 1);
   9.668  by (assume_tac 1);
   9.669 -by (asm_full_simp_tac 
   9.670 +by (asm_full_simp_tac
   9.671      (simpset() addsimps [hypreal_divide_def, hypreal_mult_assoc]) 1);
   9.672  qed "Infinitesimal_ratio";
   9.673  
   9.674  (*------------------------------------------------------------------
   9.675 -       Standard Part Theorem: Every finite x: R* is infinitely 
   9.676 +       Standard Part Theorem: Every finite x: R* is infinitely
   9.677         close to a unique real number (i.e a member of Reals)
   9.678   ------------------------------------------------------------------*)
   9.679  (*------------------------------------------------------------------
   9.680           Uniqueness: Two infinitely close reals are equal
   9.681   ------------------------------------------------------------------*)
   9.682  
   9.683 -Goal "[|x: Reals; y: Reals|] ==> (x @= y) = (x = y)"; 
   9.684 +Goal "[|x: Reals; y: Reals|] ==> (x @= y) = (x = y)";
   9.685  by Auto_tac;
   9.686  by (rewtac approx_def);
   9.687  by (dres_inst_tac [("x","y")] SReal_minus 1);
   9.688 @@ -928,50 +927,50 @@
   9.689  qed "SReal_approx_iff";
   9.690  
   9.691  Goal "(number_of v @= number_of w) = (number_of v = (number_of w :: hypreal))";
   9.692 -by (rtac SReal_approx_iff 1); 
   9.693 -by Auto_tac;  
   9.694 +by (rtac SReal_approx_iff 1);
   9.695 +by Auto_tac;
   9.696  qed "number_of_approx_iff";
   9.697  Addsimps [number_of_approx_iff];
   9.698  
   9.699  (*And also for 0 @= #nn and 1 @= #nn, #nn @= 0 and #nn @= 1.*)
   9.700  Addsimps
   9.701   (map (simplify (simpset()))
   9.702 -      [inst "v" "Pls" number_of_approx_iff, 
   9.703 +      [inst "v" "Pls" number_of_approx_iff,
   9.704         inst "v" "Pls BIT True" number_of_approx_iff,
   9.705 -       inst "w" "Pls" number_of_approx_iff, 
   9.706 +       inst "w" "Pls" number_of_approx_iff,
   9.707         inst "w" "Pls BIT True" number_of_approx_iff]);
   9.708  
   9.709  
   9.710  Goal "~ (0 @= 1)";
   9.711 -by (stac SReal_approx_iff 1); 
   9.712 -by Auto_tac;  
   9.713 +by (stac SReal_approx_iff 1);
   9.714 +by Auto_tac;
   9.715  qed "not_0_approx_1";
   9.716  Addsimps [not_0_approx_1];
   9.717  
   9.718  Goal "~ (1 @= 0)";
   9.719 -by (stac SReal_approx_iff 1); 
   9.720 -by Auto_tac;  
   9.721 +by (stac SReal_approx_iff 1);
   9.722 +by Auto_tac;
   9.723  qed "not_1_approx_0";
   9.724  Addsimps [not_1_approx_0];
   9.725  
   9.726  Goal "(hypreal_of_real k @= hypreal_of_real m) = (k = m)";
   9.727 -by Auto_tac;  
   9.728 -by (rtac (inj_hypreal_of_real RS injD) 1); 
   9.729 -by (rtac (SReal_approx_iff RS iffD1) 1); 
   9.730 -by Auto_tac;  
   9.731 +by Auto_tac;
   9.732 +by (rtac (inj_hypreal_of_real RS injD) 1);
   9.733 +by (rtac (SReal_approx_iff RS iffD1) 1);
   9.734 +by Auto_tac;
   9.735  qed "hypreal_of_real_approx_iff";
   9.736  Addsimps [hypreal_of_real_approx_iff];
   9.737  
   9.738  Goal "(hypreal_of_real k @= number_of w) = (k = number_of w)";
   9.739 -by (stac (hypreal_of_real_approx_iff RS sym) 1); 
   9.740 -by Auto_tac;  
   9.741 +by (stac (hypreal_of_real_approx_iff RS sym) 1);
   9.742 +by Auto_tac;
   9.743  qed "hypreal_of_real_approx_number_of_iff";
   9.744  Addsimps [hypreal_of_real_approx_number_of_iff];
   9.745  
   9.746  (*And also for 0 and 1.*)
   9.747  Addsimps
   9.748   (map (simplify (simpset()))
   9.749 -      [inst "w" "Pls" hypreal_of_real_approx_number_of_iff, 
   9.750 +      [inst "w" "Pls" hypreal_of_real_approx_number_of_iff,
   9.751         inst "w" "Pls BIT True" hypreal_of_real_approx_number_of_iff]);
   9.752  
   9.753  Goal "[| r: Reals; s: Reals; r @= x; s @= x|] ==> r = s";
   9.754 @@ -1000,7 +999,7 @@
   9.755  Goal "x: HFinite ==> EX y. y: {s. s: Reals & s < x}";
   9.756  by (dtac HFiniteD 1 THEN Step_tac 1);
   9.757  by (dtac SReal_minus 1);
   9.758 -by (res_inst_tac [("x","-t")] exI 1); 
   9.759 +by (res_inst_tac [("x","-t")] exI 1);
   9.760  by (auto_tac (claset(), simpset() addsimps [hrabs_interval_iff]));
   9.761  qed "lemma_st_part_nonempty";
   9.762  
   9.763 @@ -1026,7 +1025,7 @@
   9.764  by (rtac ccontr 1 THEN dtac (linorder_not_le RS iffD2) 1);
   9.765  by (dres_inst_tac [("x","t")] SReal_add 1 THEN assume_tac 1);
   9.766  by (dres_inst_tac [("y","t + r")] (isLubD1 RS setleD) 1);
   9.767 -by Auto_tac;  
   9.768 +by Auto_tac;
   9.769  qed "lemma_st_part_le1";
   9.770  
   9.771  Goalw [setle_def] "!!x::hypreal. [| S *<= x; x < y |] ==> S *<= y";
   9.772 @@ -1035,7 +1034,7 @@
   9.773                simpset()));
   9.774  qed "hypreal_setle_less_trans";
   9.775  
   9.776 -Goalw [isUb_def] 
   9.777 +Goalw [isUb_def]
   9.778       "!!x::hypreal. [| isUb R S x; x < y; y: R |] ==> isUb R S y";
   9.779  by (blast_tac (claset() addIs [hypreal_setle_less_trans]) 1);
   9.780  qed "hypreal_gt_isUb";
   9.781 @@ -1057,7 +1056,7 @@
   9.782  \     ==> t + -r <= x";
   9.783  by (ftac isLubD1a 1);
   9.784  by (rtac ccontr 1 THEN dtac not_hypreal_leE 1);
   9.785 -by (dtac SReal_minus 1 THEN dres_inst_tac [("x","t")] 
   9.786 +by (dtac SReal_minus 1 THEN dres_inst_tac [("x","t")]
   9.787      SReal_add 1 THEN assume_tac 1);
   9.788  by (dtac lemma_st_part_gt_ub 1 THEN REPEAT(assume_tac 1));
   9.789  by (dtac isLub_le_isUb 1 THEN assume_tac 1);
   9.790 @@ -1066,7 +1065,7 @@
   9.791  qed "lemma_st_part_le2";
   9.792  
   9.793  Goal "((x::hypreal) <= t + r) = (x + -t <= r)";
   9.794 -by Auto_tac;  
   9.795 +by Auto_tac;
   9.796  qed "lemma_hypreal_le_swap";
   9.797  
   9.798  Goal "[| x: HFinite; \
   9.799 @@ -1078,7 +1077,7 @@
   9.800  qed "lemma_st_part1a";
   9.801  
   9.802  Goal "(t + -r <= x) = (-(x + -t) <= (r::hypreal))";
   9.803 -by Auto_tac;  
   9.804 +by Auto_tac;
   9.805  qed "lemma_hypreal_le_swap2";
   9.806  
   9.807  Goal "[| x: HFinite; \
   9.808 @@ -1157,10 +1156,10 @@
   9.809  by (blast_tac (claset() addDs [lemma_st_part_major2]) 1);
   9.810  qed "lemma_st_part_Ex";
   9.811  
   9.812 -Goalw [approx_def,Infinitesimal_def] 
   9.813 +Goalw [approx_def,Infinitesimal_def]
   9.814       "x:HFinite ==> EX t: Reals. x @= t";
   9.815  by (dtac lemma_st_part_Ex 1);
   9.816 -by Auto_tac;  
   9.817 +by Auto_tac;
   9.818  qed "st_part_Ex";
   9.819  
   9.820  (*--------------------------------
   9.821 @@ -1168,7 +1167,7 @@
   9.822   -------------------------------*)
   9.823  Goal "x:HFinite ==> EX! t. t: Reals & x @= t";
   9.824  by (dtac st_part_Ex 1 THEN Step_tac 1);
   9.825 -by (dtac approx_sym 2 THEN dtac approx_sym 2 
   9.826 +by (dtac approx_sym 2 THEN dtac approx_sym 2
   9.827      THEN dtac approx_sym 2);
   9.828  by (auto_tac (claset() addSIs [approx_unique_real], simpset()));
   9.829  qed "st_part_Ex1";
   9.830 @@ -1189,9 +1188,9 @@
   9.831  qed "HFinite_not_HInfinite";
   9.832  
   9.833  Goalw [HInfinite_def, HFinite_def] "x~: HFinite ==> x: HInfinite";
   9.834 -by Auto_tac;  
   9.835 +by Auto_tac;
   9.836  by (dres_inst_tac [("x","r + 1")] bspec 1);
   9.837 -by (auto_tac (claset(), simpset() addsimps [SReal_add]));   
   9.838 +by (auto_tac (claset(), simpset() addsimps [SReal_add]));
   9.839  qed "not_HFinite_HInfinite";
   9.840  
   9.841  Goal "x : HInfinite | x : HFinite";
   9.842 @@ -1237,7 +1236,7 @@
   9.843  by (dtac Infinitesimal_HFinite_mult2 1);
   9.844  by (assume_tac 1);
   9.845  by (asm_full_simp_tac
   9.846 -   (simpset() addsimps [not_Infinitesimal_not_zero, hypreal_mult_inverse]) 1); 
   9.847 +   (simpset() addsimps [not_Infinitesimal_not_zero, hypreal_mult_inverse]) 1);
   9.848  qed "HFinite_not_Infinitesimal_inverse";
   9.849  
   9.850  Goal "[| x @= y; y :  HFinite - Infinitesimal |] \
   9.851 @@ -1249,7 +1248,7 @@
   9.852  by (REPEAT(dtac HFinite_inverse2 1));
   9.853  by (dtac approx_mult2 1 THEN assume_tac 1);
   9.854  by Auto_tac;
   9.855 -by (dres_inst_tac [("c","inverse x")] approx_mult1 1 
   9.856 +by (dres_inst_tac [("c","inverse x")] approx_mult1 1
   9.857      THEN assume_tac 1);
   9.858  by (auto_tac (claset() addIs [approx_sym],
   9.859      simpset() addsimps [hypreal_mult_assoc]));
   9.860 @@ -1261,8 +1260,8 @@
   9.861  
   9.862  Goal "[| x: HFinite - Infinitesimal; \
   9.863  \        h : Infinitesimal |] ==> inverse(x + h) @= inverse x";
   9.864 -by (auto_tac (claset() addIs [approx_inverse, approx_sym, 
   9.865 -                              Infinitesimal_add_approx_self], 
   9.866 +by (auto_tac (claset() addIs [approx_inverse, approx_sym,
   9.867 +                              Infinitesimal_add_approx_self],
   9.868                simpset()));
   9.869  qed "inverse_add_Infinitesimal_approx";
   9.870  
   9.871 @@ -1273,7 +1272,7 @@
   9.872  qed "inverse_add_Infinitesimal_approx2";
   9.873  
   9.874  Goal "[| x : HFinite - Infinitesimal; \
   9.875 -\        h : Infinitesimal |] ==> inverse(x + h) + -inverse x @= h"; 
   9.876 +\        h : Infinitesimal |] ==> inverse(x + h) + -inverse x @= h";
   9.877  by (rtac approx_trans2 1);
   9.878  by (auto_tac (claset() addIs [inverse_add_Infinitesimal_approx],
   9.879                simpset() addsimps [mem_infmal_iff,
   9.880 @@ -1297,7 +1296,7 @@
   9.881  Addsimps [HFinite_square_iff];
   9.882  
   9.883  Goal "(x*x : HInfinite) = (x : HInfinite)";
   9.884 -by (auto_tac (claset(), simpset() addsimps 
   9.885 +by (auto_tac (claset(), simpset() addsimps
   9.886      [HInfinite_HFinite_iff]));
   9.887  qed "HInfinite_square_iff";
   9.888  Addsimps [HInfinite_square_iff];
   9.889 @@ -1366,7 +1365,7 @@
   9.890   ------------------------------------------------------------------*)
   9.891  Goal "x @= y ==> {x,y}<=monad x";
   9.892  by (Simp_tac 1);
   9.893 -by (asm_full_simp_tac (simpset() addsimps 
   9.894 +by (asm_full_simp_tac (simpset() addsimps
   9.895      [approx_monad_iff]) 1);
   9.896  qed "approx_subset_monad";
   9.897  
   9.898 @@ -1393,15 +1392,15 @@
   9.899  qed "approx_mem_monad_zero";
   9.900  
   9.901  Goal "[| x @= y; x: Infinitesimal |] ==> abs x @= abs y";
   9.902 -by (dtac (Infinitesimal_monad_zero_iff RS iffD1) 1); 
   9.903 -by (blast_tac (claset() addIs [approx_mem_monad_zero, 
   9.904 +by (dtac (Infinitesimal_monad_zero_iff RS iffD1) 1);
   9.905 +by (blast_tac (claset() addIs [approx_mem_monad_zero,
   9.906       monad_zero_hrabs_iff RS iffD1, mem_monad_approx, approx_trans3]) 1);
   9.907  qed "Infinitesimal_approx_hrabs";
   9.908  
   9.909  Goal "[| 0 < x;  x ~:Infinitesimal;  e :Infinitesimal |] ==> e < x";
   9.910  by (rtac ccontr 1);
   9.911  by (auto_tac (claset()
   9.912 -               addIs [Infinitesimal_zero RSN (2, Infinitesimal_interval)] 
   9.913 +               addIs [Infinitesimal_zero RSN (2, Infinitesimal_interval)]
   9.914                 addSDs [hypreal_leI, order_le_imp_less_or_eq],
   9.915                simpset()));
   9.916  qed "less_Infinitesimal_less";
   9.917 @@ -1410,14 +1409,14 @@
   9.918  by (dtac (mem_monad_approx RS approx_sym) 1);
   9.919  by (etac (bex_Infinitesimal_iff2 RS iffD2 RS bexE) 1);
   9.920  by (dres_inst_tac [("e","-xa")] less_Infinitesimal_less 1);
   9.921 -by Auto_tac;  
   9.922 +by Auto_tac;
   9.923  qed "Ball_mem_monad_gt_zero";
   9.924  
   9.925  Goal "[| x < 0; x ~: Infinitesimal; u: monad x |] ==> u < 0";
   9.926  by (dtac (mem_monad_approx RS approx_sym) 1);
   9.927  by (etac (bex_Infinitesimal_iff RS iffD2 RS bexE) 1);
   9.928  by (cut_inst_tac [("x","-x"),("e","xa")] less_Infinitesimal_less 1);
   9.929 -by Auto_tac;  
   9.930 +by Auto_tac;
   9.931  qed "Ball_mem_monad_less_zero";
   9.932  
   9.933  Goal "[|0 < x; x ~: Infinitesimal; x @= y|] ==> 0 < y";
   9.934 @@ -1480,25 +1479,25 @@
   9.935  by (auto_tac (claset() addIs [approx_trans2], simpset()));
   9.936  qed "hrabs_add_minus_Infinitesimal_cancel";
   9.937  
   9.938 -(* interesting slightly counterintuitive theorem: necessary 
   9.939 -   for proving that an open interval is an NS open set 
   9.940 +(* interesting slightly counterintuitive theorem: necessary
   9.941 +   for proving that an open interval is an NS open set
   9.942  *)
   9.943 -Goalw [Infinitesimal_def] 
   9.944 +Goalw [Infinitesimal_def]
   9.945       "[| x < y;  u: Infinitesimal |] \
   9.946  \     ==> hypreal_of_real x + u < hypreal_of_real y";
   9.947 -by (dtac (hypreal_of_real_less_iff RS iffD2) 1); 
   9.948 +by (dtac (hypreal_of_real_less_iff RS iffD2) 1);
   9.949  by (dtac (hypreal_less_minus_iff RS iffD1) 1 THEN Step_tac 1);
   9.950  by (rtac (hypreal_less_minus_iff RS iffD2) 1);
   9.951  by (dres_inst_tac [("x","hypreal_of_real y + -hypreal_of_real x")] bspec 1);
   9.952  by (auto_tac (claset(),
   9.953 -              simpset() addsimps [hypreal_add_commute, 
   9.954 +              simpset() addsimps [hypreal_add_commute,
   9.955                                    hrabs_interval_iff,
   9.956                                    SReal_add, SReal_minus]));
   9.957  qed "Infinitesimal_add_hypreal_of_real_less";
   9.958  
   9.959  Goal "[| x: Infinitesimal; abs(hypreal_of_real r) < hypreal_of_real y |] \
   9.960  \     ==> abs (hypreal_of_real r + x) < hypreal_of_real y";
   9.961 -by (dres_inst_tac [("x","hypreal_of_real r")] 
   9.962 +by (dres_inst_tac [("x","hypreal_of_real r")]
   9.963      approx_hrabs_add_Infinitesimal 1);
   9.964  by (dtac (approx_sym RS (bex_Infinitesimal_iff2 RS iffD2)) 1);
   9.965  by (auto_tac (claset() addSIs [Infinitesimal_add_hypreal_of_real_less],
   9.966 @@ -1517,11 +1516,11 @@
   9.967  \     ==> hypreal_of_real x <= hypreal_of_real y";
   9.968  by (EVERY1 [rtac notI, rtac contrapos_np, assume_tac]);
   9.969  by (res_inst_tac [("C","-u")] hypreal_less_add_right_cancel 1);
   9.970 -by (Asm_full_simp_tac 1); 
   9.971 -by (dtac (Infinitesimal_minus_iff RS iffD2) 1); 
   9.972 -by (dtac Infinitesimal_add_hypreal_of_real_less 1); 
   9.973 -by (assume_tac 1); 
   9.974 -by Auto_tac;  
   9.975 +by (Asm_full_simp_tac 1);
   9.976 +by (dtac (Infinitesimal_minus_iff RS iffD2) 1);
   9.977 +by (dtac Infinitesimal_add_hypreal_of_real_less 1);
   9.978 +by (assume_tac 1);
   9.979 +by Auto_tac;
   9.980  qed "Infinitesimal_add_cancel_hypreal_of_real_le";
   9.981  
   9.982  Goal "[| u: Infinitesimal;  hypreal_of_real x + u <= hypreal_of_real y |] \
   9.983 @@ -1533,10 +1532,10 @@
   9.984  Goal "[| u: Infinitesimal; v: Infinitesimal; \
   9.985  \        hypreal_of_real x + u <= hypreal_of_real y + v |] \
   9.986  \     ==> hypreal_of_real x <= hypreal_of_real y";
   9.987 -by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); 
   9.988 -by Auto_tac;  
   9.989 +by (asm_full_simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
   9.990 +by Auto_tac;
   9.991  by (dres_inst_tac [("u","v-u")] Infinitesimal_add_hypreal_of_real_less 1);
   9.992 -by (auto_tac (claset(), simpset() addsimps [Infinitesimal_diff]));   
   9.993 +by (auto_tac (claset(), simpset() addsimps [Infinitesimal_diff]));
   9.994  qed "hypreal_of_real_le_add_Infininitesimal_cancel";
   9.995  
   9.996  Goal "[| u: Infinitesimal; v: Infinitesimal; \
   9.997 @@ -1555,22 +1554,22 @@
   9.998  
   9.999  (*used once, in NSDERIV_inverse*)
  9.1000  Goal "[| h: Infinitesimal; x ~= 0 |] ==> hypreal_of_real x + h ~= 0";
  9.1001 -by Auto_tac;  
  9.1002 +by Auto_tac;
  9.1003  qed "Infinitesimal_add_not_zero";
  9.1004  
  9.1005  Goal "x*x + y*y : Infinitesimal ==> x*x : Infinitesimal";
  9.1006 -by (rtac Infinitesimal_interval2 1); 
  9.1007 -by (rtac hypreal_le_square 3); 
  9.1008 -by (rtac hypreal_self_le_add_pos 3); 
  9.1009 -by Auto_tac;  
  9.1010 +by (rtac Infinitesimal_interval2 1);
  9.1011 +by (rtac hypreal_le_square 3);
  9.1012 +by (rtac hypreal_self_le_add_pos 3);
  9.1013 +by Auto_tac;
  9.1014  qed "Infinitesimal_square_cancel";
  9.1015  Addsimps [Infinitesimal_square_cancel];
  9.1016  
  9.1017  Goal "x*x + y*y : HFinite ==> x*x : HFinite";
  9.1018 -by (rtac HFinite_bounded 1); 
  9.1019 -by (rtac hypreal_self_le_add_pos 2); 
  9.1020 -by (rtac (hypreal_le_square) 2); 
  9.1021 -by (assume_tac 1); 
  9.1022 +by (rtac HFinite_bounded 1);
  9.1023 +by (rtac hypreal_self_le_add_pos 2);
  9.1024 +by (rtac (hypreal_le_square) 2);
  9.1025 +by (assume_tac 1);
  9.1026  qed "HFinite_square_cancel";
  9.1027  Addsimps [HFinite_square_cancel];
  9.1028  
  9.1029 @@ -1595,9 +1594,9 @@
  9.1030  Addsimps [Infinitesimal_sum_square_cancel];
  9.1031  
  9.1032  Goal "x*x + y*y + z*z : HFinite ==> x*x : HFinite";
  9.1033 -by (blast_tac (claset() addIs [hypreal_self_le_add_pos2, HFinite_bounded, 
  9.1034 +by (blast_tac (claset() addIs [hypreal_self_le_add_pos2, HFinite_bounded,
  9.1035                                 hypreal_le_square,
  9.1036 -		               HFinite_number_of]) 1);
  9.1037 +                               HFinite_number_of]) 1);
  9.1038  qed "HFinite_sum_square_cancel";
  9.1039  Addsimps [HFinite_sum_square_cancel];
  9.1040  
  9.1041 @@ -1635,9 +1634,9 @@
  9.1042  Goal "x: monad (hypreal_of_real  a) ==> x: HFinite";
  9.1043  by (dtac (mem_monad_approx RS approx_sym) 1);
  9.1044  by (dtac (bex_Infinitesimal_iff2 RS iffD2) 1);
  9.1045 -by (step_tac (claset() addSDs 
  9.1046 +by (step_tac (claset() addSDs
  9.1047         [Infinitesimal_subset_HFinite RS subsetD]) 1);
  9.1048 -by (etac (SReal_hypreal_of_real RS (SReal_subset_HFinite 
  9.1049 +by (etac (SReal_hypreal_of_real RS (SReal_subset_HFinite
  9.1050           RS subsetD) RS HFinite_add) 1);
  9.1051  qed "mem_monad_SReal_HFinite";
  9.1052  
  9.1053 @@ -1673,7 +1672,7 @@
  9.1054  qed "st_hypreal_of_real";
  9.1055  
  9.1056  Goal "[| x: HFinite; y: HFinite; st x = st y |] ==> x @= y";
  9.1057 -by (auto_tac (claset() addSDs [st_approx_self] 
  9.1058 +by (auto_tac (claset() addSDs [st_approx_self]
  9.1059                addSEs [approx_trans3], simpset()));
  9.1060  qed "st_eq_approx";
  9.1061  
  9.1062 @@ -1699,7 +1698,7 @@
  9.1063  by (dtac st_SReal_eq 1);
  9.1064  by (rtac approx_st_eq 1);
  9.1065  by (auto_tac (claset() addIs  [HFinite_add],
  9.1066 -    simpset() addsimps [Infinitesimal_add_approx_self 
  9.1067 +    simpset() addsimps [Infinitesimal_add_approx_self
  9.1068      RS approx_sym]));
  9.1069  qed "st_Infinitesimal_add_SReal";
  9.1070  
  9.1071 @@ -1711,7 +1710,7 @@
  9.1072  
  9.1073  Goal "x: HFinite ==> \
  9.1074  \     EX e: Infinitesimal. x = st(x) + e";
  9.1075 -by (blast_tac (claset() addSDs [(st_approx_self RS 
  9.1076 +by (blast_tac (claset() addSDs [(st_approx_self RS
  9.1077      approx_sym),bex_Infinitesimal_iff2 RS iffD2]) 1);
  9.1078  qed "HFinite_st_Infinitesimal_add";
  9.1079  
  9.1080 @@ -1744,7 +1743,7 @@
  9.1081  by (forward_tac [HFinite_minus_iff RS iffD2] 1);
  9.1082  by (rtac hypreal_add_minus_eq_minus 1);
  9.1083  by (dtac (st_add RS sym) 1 THEN assume_tac 1);
  9.1084 -by Auto_tac;  
  9.1085 +by Auto_tac;
  9.1086  qed "st_minus";
  9.1087  
  9.1088  Goalw [hypreal_diff_def]
  9.1089 @@ -1776,7 +1775,7 @@
  9.1090  by (Asm_full_simp_tac 2);
  9.1091  by (thin_tac "x = st x + e" 1);
  9.1092  by (thin_tac "y = st y + ea" 1);
  9.1093 -by (asm_full_simp_tac (simpset() addsimps 
  9.1094 +by (asm_full_simp_tac (simpset() addsimps
  9.1095      [hypreal_add_mult_distrib,hypreal_add_mult_distrib2]) 1);
  9.1096  by (REPEAT(dtac st_SReal 1));
  9.1097  by (full_simp_tac (simpset() addsimps [hypreal_add_assoc]) 1);
  9.1098 @@ -1788,7 +1787,7 @@
  9.1099  qed "st_mult";
  9.1100  
  9.1101  Goal "x: Infinitesimal ==> st x = 0";
  9.1102 -by (stac (hypreal_numeral_0_eq_0 RS sym) 1); 
  9.1103 +by (stac (hypreal_numeral_0_eq_0 RS sym) 1);
  9.1104  by (rtac (st_number_of RS subst) 1);
  9.1105  by (rtac approx_st_eq 1);
  9.1106  by (auto_tac (claset() addIs [Infinitesimal_subset_HFinite RS subsetD],
  9.1107 @@ -1805,14 +1804,14 @@
  9.1108  by (auto_tac (claset(),
  9.1109         simpset() addsimps [st_mult RS sym, st_not_Infinitesimal,
  9.1110                             HFinite_inverse]));
  9.1111 -by (stac hypreal_mult_inverse 1); 
  9.1112 -by Auto_tac;  
  9.1113 +by (stac hypreal_mult_inverse 1);
  9.1114 +by Auto_tac;
  9.1115  qed "st_inverse";
  9.1116  
  9.1117  Goal "[| x: HFinite; y: HFinite; st y ~= 0 |] \
  9.1118  \     ==> st(x/y) = (st x) / (st y)";
  9.1119  by (auto_tac (claset(),
  9.1120 -      simpset() addsimps [hypreal_divide_def, st_mult, st_not_Infinitesimal, 
  9.1121 +      simpset() addsimps [hypreal_divide_def, st_mult, st_not_Infinitesimal,
  9.1122                            HFinite_inverse, st_inverse]));
  9.1123  qed "st_divide";
  9.1124  Addsimps [st_divide];
  9.1125 @@ -1846,23 +1845,23 @@
  9.1126  by (ftac HFinite_st_Infinitesimal_add 1);
  9.1127  by (Step_tac 1);
  9.1128  by (rtac Infinitesimal_add_st_le_cancel 1);
  9.1129 -by (res_inst_tac [("x","ea"),("y","e")] 
  9.1130 +by (res_inst_tac [("x","ea"),("y","e")]
  9.1131               Infinitesimal_diff 3);
  9.1132  by (auto_tac (claset(), simpset() addsimps [hypreal_add_assoc RS sym]));
  9.1133  qed "st_le";
  9.1134  
  9.1135  Goal "[| 0 <= x;  x: HFinite |] ==> 0 <= st x";
  9.1136 -by (stac (hypreal_numeral_0_eq_0 RS sym) 1); 
  9.1137 +by (stac (hypreal_numeral_0_eq_0 RS sym) 1);
  9.1138  by (rtac (st_number_of RS subst) 1);
  9.1139 -by (rtac st_le 1); 
  9.1140 -by Auto_tac; 
  9.1141 +by (rtac st_le 1);
  9.1142 +by Auto_tac;
  9.1143  qed "st_zero_le";
  9.1144  
  9.1145  Goal "[| x <= 0;  x: HFinite |] ==> st x <= 0";
  9.1146 -by (stac (hypreal_numeral_0_eq_0 RS sym) 1); 
  9.1147 +by (stac (hypreal_numeral_0_eq_0 RS sym) 1);
  9.1148  by (rtac (st_number_of RS subst) 1);
  9.1149 -by (rtac st_le 1); 
  9.1150 -by Auto_tac; 
  9.1151 +by (rtac st_le 1);
  9.1152 +by Auto_tac;
  9.1153  qed "st_zero_ge";
  9.1154  
  9.1155  Goal "x: HFinite ==> abs(st x) = st(abs x)";
  9.1156 @@ -1891,12 +1890,12 @@
  9.1157  by Auto_tac;
  9.1158  qed "lemma_free2";
  9.1159  
  9.1160 -Goalw [HFinite_def] 
  9.1161 +Goalw [HFinite_def]
  9.1162      "x : HFinite ==> EX X: Rep_hypreal x. \
  9.1163  \    EX u. {n. abs (X n) < u}:  FreeUltrafilterNat";
  9.1164 -by (auto_tac (claset(), simpset() addsimps 
  9.1165 +by (auto_tac (claset(), simpset() addsimps
  9.1166      [hrabs_interval_iff]));
  9.1167 -by (auto_tac (claset(), simpset() addsimps 
  9.1168 +by (auto_tac (claset(), simpset() addsimps
  9.1169      [hypreal_less_def,SReal_iff,hypreal_minus,
  9.1170       hypreal_of_real_def]));
  9.1171  by (dtac FreeUltrafilterNat_Rep_hypreal 1 THEN assume_tac 1);
  9.1172 @@ -1905,14 +1904,14 @@
  9.1173  by (Ultra_tac 1 THEN arith_tac 1);
  9.1174  qed "HFinite_FreeUltrafilterNat";
  9.1175  
  9.1176 -Goalw [HFinite_def] 
  9.1177 +Goalw [HFinite_def]
  9.1178       "EX X: Rep_hypreal x. \
  9.1179  \      EX u. {n. abs (X n) < u}: FreeUltrafilterNat\
  9.1180  \      ==>  x : HFinite";
  9.1181 -by (auto_tac (claset(), simpset() addsimps 
  9.1182 +by (auto_tac (claset(), simpset() addsimps
  9.1183      [hrabs_interval_iff]));
  9.1184  by (res_inst_tac [("x","hypreal_of_real u")] bexI 1);
  9.1185 -by (auto_tac (claset() addSIs [exI], simpset() addsimps 
  9.1186 +by (auto_tac (claset() addSIs [exI], simpset() addsimps
  9.1187      [hypreal_less_def,SReal_iff,hypreal_minus,
  9.1188       hypreal_of_real_def]));
  9.1189  by (ALLGOALS(Ultra_tac THEN' arith_tac));
  9.1190 @@ -1945,7 +1944,7 @@
  9.1191  qed "lemma_FreeUltrafilterNat_one";
  9.1192  
  9.1193  (*-------------------------------------
  9.1194 -  Exclude this type of sets from free 
  9.1195 +  Exclude this type of sets from free
  9.1196    ultrafilter for Infinite numbers!
  9.1197   -------------------------------------*)
  9.1198  Goal "[| xa: Rep_hypreal x; \
  9.1199 @@ -1961,11 +1960,11 @@
  9.1200  \          ALL u. {n. u < abs (X n)}:  FreeUltrafilterNat";
  9.1201  by (cut_facts_tac [(prem RS (HInfinite_HFinite_iff RS iffD1))] 1);
  9.1202  by (cut_inst_tac [("x","x")] Rep_hypreal_nonempty 1);
  9.1203 -by (auto_tac (claset(), simpset() delsimps [Rep_hypreal_nonempty] 
  9.1204 +by (auto_tac (claset(), simpset() delsimps [Rep_hypreal_nonempty]
  9.1205      addsimps [HFinite_FreeUltrafilterNat_iff,Bex_def]));
  9.1206  by (REPEAT(dtac spec 1));
  9.1207  by Auto_tac;
  9.1208 -by (dres_inst_tac [("x","u")] spec 1 THEN 
  9.1209 +by (dres_inst_tac [("x","u")] spec 1 THEN
  9.1210      REPEAT(dtac FreeUltrafilterNat_Compl_mem 1));
  9.1211  by (dtac FreeUltrafilterNat_Int 1 THEN assume_tac 1);
  9.1212  
  9.1213 @@ -2019,7 +2018,7 @@
  9.1214  by Auto_tac;
  9.1215  qed "lemma_free5";
  9.1216  
  9.1217 -Goalw [Infinitesimal_def] 
  9.1218 +Goalw [Infinitesimal_def]
  9.1219            "x : Infinitesimal ==> EX X: Rep_hypreal x. \
  9.1220  \          ALL u. 0 < u --> {n. abs (X n) < u}:  FreeUltrafilterNat";
  9.1221  by (auto_tac (claset(), simpset() addsimps [hrabs_interval_iff]));
  9.1222 @@ -2028,13 +2027,13 @@
  9.1223  by (dtac (hypreal_of_real_less_iff RS iffD2) 1);
  9.1224  by (dres_inst_tac [("x","hypreal_of_real u")] bspec 1);
  9.1225  by Auto_tac;
  9.1226 -by (auto_tac (claset(), 
  9.1227 +by (auto_tac (claset(),
  9.1228                simpset() addsimps [hypreal_less_def, hypreal_minus,
  9.1229                                    hypreal_of_real_def]));
  9.1230  by (Ultra_tac 1 THEN arith_tac 1);
  9.1231  qed "Infinitesimal_FreeUltrafilterNat";
  9.1232  
  9.1233 -Goalw [Infinitesimal_def] 
  9.1234 +Goalw [Infinitesimal_def]
  9.1235       "EX X: Rep_hypreal x. \
  9.1236  \           ALL u. 0 < u --> {n. abs (X n) < u} : FreeUltrafilterNat \
  9.1237  \     ==> x : Infinitesimal";
  9.1238 @@ -2042,7 +2041,7 @@
  9.1239                simpset() addsimps [hrabs_interval_iff,abs_interval_iff]));
  9.1240  by (auto_tac (claset(),
  9.1241                simpset() addsimps [SReal_iff]));
  9.1242 -by (auto_tac (claset() addSIs [exI] 
  9.1243 +by (auto_tac (claset() addSIs [exI]
  9.1244                                 addIs [FreeUltrafilterNat_subset],
  9.1245      simpset() addsimps [hypreal_less_def, hypreal_minus,hypreal_of_real_def]));
  9.1246  qed "FreeUltrafilterNat_Infinitesimal";
  9.1247 @@ -2059,37 +2058,37 @@
  9.1248  
  9.1249  Goal "(ALL r. 0 < r --> x < r) = (ALL n. x < inverse(real (Suc n)))";
  9.1250  by (auto_tac (claset(), simpset() addsimps [real_of_nat_Suc_gt_zero]));
  9.1251 -by (blast_tac (claset() addSDs [reals_Archimedean] 
  9.1252 +by (blast_tac (claset() addSDs [reals_Archimedean]
  9.1253                          addIs [order_less_trans]) 1);
  9.1254  qed "lemma_Infinitesimal";
  9.1255  
  9.1256  Goal "(ALL r: Reals. 0 < r --> x < r) = \
  9.1257  \     (ALL n. x < inverse(hypreal_of_nat (Suc n)))";
  9.1258  by (Step_tac 1);
  9.1259 -by (dres_inst_tac [("x","inverse (hypreal_of_real(real (Suc n)))")] 
  9.1260 +by (dres_inst_tac [("x","inverse (hypreal_of_real(real (Suc n)))")]
  9.1261      bspec 1);
  9.1262 -by (full_simp_tac (simpset() addsimps [SReal_inverse]) 1); 
  9.1263 -by (rtac (real_of_nat_Suc_gt_zero RS real_inverse_gt_0 RS 
  9.1264 +by (full_simp_tac (simpset() addsimps [SReal_inverse]) 1);
  9.1265 +by (rtac (real_of_nat_Suc_gt_zero RS real_inverse_gt_0 RS
  9.1266            (hypreal_of_real_less_iff RS iffD2) RSN(2,impE)) 1);
  9.1267  by (assume_tac 2);
  9.1268 -by (asm_full_simp_tac (simpset() addsimps 
  9.1269 +by (asm_full_simp_tac (simpset() addsimps
  9.1270         [real_of_nat_Suc_gt_zero, hypreal_of_nat_def]) 1);
  9.1271  by (auto_tac (claset() addSDs [reals_Archimedean],
  9.1272                simpset() addsimps [SReal_iff]));
  9.1273  by (dtac (hypreal_of_real_less_iff RS iffD2) 1);
  9.1274 -by (asm_full_simp_tac (simpset() addsimps 
  9.1275 +by (asm_full_simp_tac (simpset() addsimps
  9.1276           [real_of_nat_Suc_gt_zero, hypreal_of_nat_def])1);
  9.1277  by (blast_tac (claset() addIs [order_less_trans]) 1);
  9.1278  qed "lemma_Infinitesimal2";
  9.1279  
  9.1280 -Goalw [Infinitesimal_def] 
  9.1281 +Goalw [Infinitesimal_def]
  9.1282       "Infinitesimal = {x. ALL n. abs x < inverse (hypreal_of_nat (Suc n))}";
  9.1283  by (auto_tac (claset(), simpset() addsimps [lemma_Infinitesimal2]));
  9.1284  qed "Infinitesimal_hypreal_of_nat_iff";
  9.1285  
  9.1286  
  9.1287  (*-------------------------------------------------------------------------
  9.1288 -       Proof that omega is an infinite number and 
  9.1289 +       Proof that omega is an infinite number and
  9.1290         hence that epsilon is an infinitesimal number.
  9.1291   -------------------------------------------------------------------------*)
  9.1292  Goal "{n. n < Suc m} = {n. n < m} Un {n. n = m}";
  9.1293 @@ -2097,7 +2096,7 @@
  9.1294  qed "Suc_Un_eq";
  9.1295  
  9.1296  (*-------------------------------------------
  9.1297 -  Prove that any segment is finite and 
  9.1298 +  Prove that any segment is finite and
  9.1299    hence cannot belong to FreeUltrafilterNat
  9.1300   -------------------------------------------*)
  9.1301  Goal "finite {n::nat. n < m}";
  9.1302 @@ -2122,8 +2121,8 @@
  9.1303  qed "lemma_real_le_Un_eq";
  9.1304  
  9.1305  Goal "finite {n::nat. real n <= u}";
  9.1306 -by (auto_tac (claset(), 
  9.1307 -              simpset() addsimps [lemma_real_le_Un_eq,lemma_finite_omega_set, 
  9.1308 +by (auto_tac (claset(),
  9.1309 +              simpset() addsimps [lemma_real_le_Un_eq,lemma_finite_omega_set,
  9.1310                                    finite_real_of_nat_less_real]));
  9.1311  qed "finite_real_of_nat_le_real";
  9.1312  
  9.1313 @@ -2140,14 +2139,14 @@
  9.1314  Goal "{n. u < real n} : FreeUltrafilterNat";
  9.1315  by (rtac ccontr 1 THEN dtac FreeUltrafilterNat_Compl_mem 1);
  9.1316  by (subgoal_tac "- {n::nat. u < real n} = {n. real n <= u}" 1);
  9.1317 -by (Force_tac 2); 
  9.1318 +by (Force_tac 2);
  9.1319  by (asm_full_simp_tac (simpset() addsimps
  9.1320 -        [finite_real_of_nat_le_real RS FreeUltrafilterNat_finite]) 1); 
  9.1321 +        [finite_real_of_nat_le_real RS FreeUltrafilterNat_finite]) 1);
  9.1322  qed "FreeUltrafilterNat_nat_gt_real";
  9.1323  
  9.1324  (*--------------------------------------------------------------
  9.1325 - The complement of {n. abs(real n) <= u} = 
  9.1326 - {n. u < abs (real n)} is in FreeUltrafilterNat 
  9.1327 + The complement of {n. abs(real n) <= u} =
  9.1328 + {n. u < abs (real n)} is in FreeUltrafilterNat
  9.1329   by property of (free) ultrafilters
  9.1330   --------------------------------------------------------------*)
  9.1331  Goal "- {n::nat. real n <= u} = {n. u < real n}";
  9.1332 @@ -2170,13 +2169,13 @@
  9.1333  qed "FreeUltrafilterNat_omega";
  9.1334  
  9.1335  Goalw [omega_def] "omega: HInfinite";
  9.1336 -by (auto_tac (claset() addSIs [FreeUltrafilterNat_HInfinite], 
  9.1337 +by (auto_tac (claset() addSIs [FreeUltrafilterNat_HInfinite],
  9.1338                simpset()));
  9.1339 -by (rtac bexI 1); 
  9.1340 -by (rtac lemma_hyprel_refl 2); 
  9.1341 -by Auto_tac;  
  9.1342 -by (simp_tac (simpset() addsimps [real_of_nat_Suc, real_diff_less_eq RS sym, 
  9.1343 -                                  FreeUltrafilterNat_omega]) 1); 
  9.1344 +by (rtac bexI 1);
  9.1345 +by (rtac lemma_hyprel_refl 2);
  9.1346 +by Auto_tac;
  9.1347 +by (simp_tac (simpset() addsimps [real_of_nat_Suc, real_diff_less_eq RS sym,
  9.1348 +                                  FreeUltrafilterNat_omega]) 1);
  9.1349  qed "HInfinite_omega";
  9.1350  
  9.1351  (*-----------------------------------------------
  9.1352 @@ -2201,24 +2200,24 @@
  9.1353  Addsimps [epsilon_approx_zero];
  9.1354  
  9.1355  (*------------------------------------------------------------------------
  9.1356 -  Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given 
  9.1357 +  Needed for proof that we define a hyperreal [<X(n)] @= hypreal_of_real a given
  9.1358    that ALL n. |X n - a| < 1/n. Used in proof of NSLIM => LIM.
  9.1359   -----------------------------------------------------------------------*)
  9.1360  
  9.1361  Goal "0 < u  ==> \
  9.1362  \     (u < inverse (real(Suc n))) = (real(Suc n) < inverse u)";
  9.1363  by (asm_full_simp_tac (simpset() addsimps [real_inverse_eq_divide]) 1);
  9.1364 -by (stac pos_real_less_divide_eq 1); 
  9.1365 -by (assume_tac 1); 
  9.1366 -by (stac pos_real_less_divide_eq 1); 
  9.1367 -by (simp_tac (simpset() addsimps [real_mult_commute]) 2); 
  9.1368 -by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1); 
  9.1369 +by (stac pos_real_less_divide_eq 1);
  9.1370 +by (assume_tac 1);
  9.1371 +by (stac pos_real_less_divide_eq 1);
  9.1372 +by (simp_tac (simpset() addsimps [real_mult_commute]) 2);
  9.1373 +by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1);
  9.1374  qed "real_of_nat_less_inverse_iff";
  9.1375  
  9.1376  Goal "0 < u ==> finite {n. u < inverse(real(Suc n))}";
  9.1377  by (asm_simp_tac (simpset() addsimps [real_of_nat_less_inverse_iff]) 1);
  9.1378 -by (asm_simp_tac (simpset() addsimps [real_of_nat_Suc, 
  9.1379 -                         real_less_diff_eq RS sym]) 1); 
  9.1380 +by (asm_simp_tac (simpset() addsimps [real_of_nat_Suc,
  9.1381 +                         real_less_diff_eq RS sym]) 1);
  9.1382  by (rtac finite_real_of_nat_less_real 1);
  9.1383  qed "finite_inverse_real_of_posnat_gt_real";
  9.1384  
  9.1385 @@ -2229,28 +2228,28 @@
  9.1386  qed "lemma_real_le_Un_eq2";
  9.1387  
  9.1388  Goal "(inverse (real(Suc n)) <= r) = (1 <= r * real(Suc n))";
  9.1389 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); 
  9.1390 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
  9.1391  by (simp_tac (simpset() addsimps [real_inverse_eq_divide]) 1);
  9.1392 -by (stac pos_real_less_divide_eq 1); 
  9.1393 -by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1); 
  9.1394 -by (simp_tac (simpset() addsimps [real_mult_commute]) 1); 
  9.1395 +by (stac pos_real_less_divide_eq 1);
  9.1396 +by (simp_tac (simpset() addsimps [real_of_nat_Suc_gt_zero]) 1);
  9.1397 +by (simp_tac (simpset() addsimps [real_mult_commute]) 1);
  9.1398  qed "real_of_nat_inverse_le_iff";
  9.1399  
  9.1400  Goal "(u = inverse (real(Suc n))) = (real(Suc n) = inverse u)";
  9.1401  by (auto_tac (claset(),
  9.1402 -      simpset() addsimps [real_inverse_inverse, real_of_nat_Suc_gt_zero, 
  9.1403 -			  real_not_refl2 RS not_sym]));
  9.1404 +      simpset() addsimps [real_inverse_inverse, real_of_nat_Suc_gt_zero,
  9.1405 +                          real_not_refl2 RS not_sym]));
  9.1406  qed "real_of_nat_inverse_eq_iff";
  9.1407  
  9.1408  Goal "finite {n::nat. u = inverse(real(Suc n))}";
  9.1409  by (asm_simp_tac (simpset() addsimps [real_of_nat_inverse_eq_iff]) 1);
  9.1410  by (cut_inst_tac [("x","inverse u - 1")] lemma_finite_omega_set 1);
  9.1411 -by (asm_full_simp_tac (simpset() addsimps [real_of_nat_Suc, 
  9.1412 -                         real_diff_eq_eq RS sym, eq_commute]) 1); 
  9.1413 +by (asm_full_simp_tac (simpset() addsimps [real_of_nat_Suc,
  9.1414 +                         real_diff_eq_eq RS sym, eq_commute]) 1);
  9.1415  qed "lemma_finite_omega_set2";
  9.1416  
  9.1417  Goal "0 < u ==> finite {n. u <= inverse(real(Suc n))}";
  9.1418 -by (auto_tac (claset(), 
  9.1419 +by (auto_tac (claset(),
  9.1420        simpset() addsimps [lemma_real_le_Un_eq2,lemma_finite_omega_set2,
  9.1421                            finite_inverse_real_of_posnat_gt_real]));
  9.1422  qed "finite_inverse_real_of_posnat_ge_real";
  9.1423 @@ -2263,7 +2262,7 @@
  9.1424  
  9.1425  (*--------------------------------------------------------------
  9.1426      The complement of  {n. u <= inverse(real(Suc n))} =
  9.1427 -    {n. inverse(real(Suc n)) < u} is in FreeUltrafilterNat 
  9.1428 +    {n. inverse(real(Suc n)) < u} is in FreeUltrafilterNat
  9.1429      by property of (free) ultrafilters
  9.1430   --------------------------------------------------------------*)
  9.1431  Goal "- {n. u <= inverse(real(Suc n))} = \
  9.1432 @@ -2284,44 +2283,44 @@
  9.1433        for which a particular property holds. The theorem is
  9.1434        used in proofs about equivalence of nonstandard and
  9.1435        standard neighbourhoods. Also used for equivalence of
  9.1436 -      nonstandard ans standard definitions of pointwise 
  9.1437 +      nonstandard ans standard definitions of pointwise
  9.1438        limit (the theorem was previously in REALTOPOS.thy).
  9.1439   -------------------------------------------------------------*)
  9.1440  (*-----------------------------------------------------
  9.1441 -    |X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x|: Infinitesimal 
  9.1442 +    |X(n) - x| < 1/n ==> [<X n>] - hypreal_of_real x|: Infinitesimal
  9.1443   -----------------------------------------------------*)
  9.1444 -Goal "ALL n. abs(X n + -x) < inverse(real(Suc n)) \ 
  9.1445 +Goal "ALL n. abs(X n + -x) < inverse(real(Suc n)) \
  9.1446  \    ==> Abs_hypreal(hyprel``{X}) + -hypreal_of_real x : Infinitesimal";
  9.1447 -by (auto_tac (claset() addSIs [bexI] 
  9.1448 +by (auto_tac (claset() addSIs [bexI]
  9.1449             addDs [FreeUltrafilterNat_inverse_real_of_posnat,
  9.1450 -                  FreeUltrafilterNat_all,FreeUltrafilterNat_Int] 
  9.1451 +                  FreeUltrafilterNat_all,FreeUltrafilterNat_Int]
  9.1452             addIs [order_less_trans, FreeUltrafilterNat_subset],
  9.1453 -      simpset() addsimps [hypreal_minus, 
  9.1454 +      simpset() addsimps [hypreal_minus,
  9.1455                            hypreal_of_real_def,hypreal_add,
  9.1456                        Infinitesimal_FreeUltrafilterNat_iff,hypreal_inverse]));
  9.1457  qed "real_seq_to_hypreal_Infinitesimal";
  9.1458  
  9.1459 -Goal "ALL n. abs(X n + -x) < inverse(real(Suc n)) \ 
  9.1460 +Goal "ALL n. abs(X n + -x) < inverse(real(Suc n)) \
  9.1461  \     ==> Abs_hypreal(hyprel``{X}) @= hypreal_of_real x";
  9.1462  by (stac approx_minus_iff 1);
  9.1463  by (rtac (mem_infmal_iff RS subst) 1);
  9.1464  by (etac real_seq_to_hypreal_Infinitesimal 1);
  9.1465  qed "real_seq_to_hypreal_approx";
  9.1466  
  9.1467 -Goal "ALL n. abs(x + -X n) < inverse(real(Suc n)) \ 
  9.1468 +Goal "ALL n. abs(x + -X n) < inverse(real(Suc n)) \
  9.1469  \              ==> Abs_hypreal(hyprel``{X}) @= hypreal_of_real x";
  9.1470  by (asm_full_simp_tac (simpset() addsimps [abs_minus_add_cancel,
  9.1471          real_seq_to_hypreal_approx]) 1);
  9.1472  qed "real_seq_to_hypreal_approx2";
  9.1473  
  9.1474 -Goal "ALL n. abs(X n + -Y n) < inverse(real(Suc n)) \ 
  9.1475 +Goal "ALL n. abs(X n + -Y n) < inverse(real(Suc n)) \
  9.1476  \     ==> Abs_hypreal(hyprel``{X}) + \
  9.1477  \         -Abs_hypreal(hyprel``{Y}) : Infinitesimal";
  9.1478 -by (auto_tac (claset() addSIs [bexI] 
  9.1479 +by (auto_tac (claset() addSIs [bexI]
  9.1480                    addDs [FreeUltrafilterNat_inverse_real_of_posnat,
  9.1481 -                         FreeUltrafilterNat_all,FreeUltrafilterNat_Int] 
  9.1482 +                         FreeUltrafilterNat_all,FreeUltrafilterNat_Int]
  9.1483          addIs [order_less_trans, FreeUltrafilterNat_subset],
  9.1484 -     simpset() addsimps 
  9.1485 -            [Infinitesimal_FreeUltrafilterNat_iff,hypreal_minus,hypreal_add, 
  9.1486 +     simpset() addsimps
  9.1487 +            [Infinitesimal_FreeUltrafilterNat_iff,hypreal_minus,hypreal_add,
  9.1488               hypreal_inverse]));
  9.1489  qed "real_seq_to_hypreal_Infinitesimal2";
    10.1 --- a/src/HOL/Hyperreal/hypreal_arith0.ML	Tue Aug 06 11:20:47 2002 +0200
    10.2 +++ b/src/HOL/Hyperreal/hypreal_arith0.ML	Tue Aug 06 11:22:05 2002 +0200
    10.3 @@ -44,11 +44,6 @@
    10.4       "(i <= j) & (k < l)  ==> i + k < j + (l::hypreal)",
    10.5       "(i < j) & (k < l)   ==> i + k < j + (l::hypreal)"];
    10.6  
    10.7 -val hypreal_arith_simproc_pats =
    10.8 -  map (fn s => Thm.read_cterm (Theory.sign_of (the_context ()))
    10.9 -       (s, HOLogic.boolT))
   10.10 -      ["(m::hypreal) < n", "(m::hypreal) <= n", "(m::hypreal) = n"];
   10.11 -
   10.12  fun cvar(th,_ $ (_ $ _ $ var)) = cterm_of (#sign(rep_thm th)) var;
   10.13  
   10.14  val hypreal_mult_mono_thms =
   10.15 @@ -59,8 +54,10 @@
   10.16  
   10.17  in
   10.18  
   10.19 -val fast_hypreal_arith_simproc = mk_simproc
   10.20 -  "fast_hypreal_arith" hypreal_arith_simproc_pats Fast_Arith.lin_arith_prover;
   10.21 +val fast_hypreal_arith_simproc =
   10.22 +  Simplifier.simproc (Theory.sign_of (the_context ()))
   10.23 +    "fast_hypreal_arith" ["(m::hypreal) < n", "(m::hypreal) <= n", "(m::hypreal) = n"]
   10.24 +    Fast_Arith.lin_arith_prover;
   10.25  
   10.26  val hypreal_arith_setup =
   10.27   [Fast_Arith.map_data (fn {add_mono_thms, mult_mono_thms, inj_thms, lessD, simpset} =>
    11.1 --- a/src/HOL/Integ/Bin.ML	Tue Aug 06 11:20:47 2002 +0200
    11.2 +++ b/src/HOL/Integ/Bin.ML	Tue Aug 06 11:22:05 2002 +0200
    11.3 @@ -348,9 +348,8 @@
    11.4    (*version without the hyps argument*)
    11.5    fun prove_conv_nohyps name tacs sg = prove_conv name tacs sg []
    11.6  
    11.7 -  fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc
    11.8 -  fun prep_pat s = HOLogic.read_cterm (Theory.sign_of (the_context())) s
    11.9 -  val prep_pats = map prep_pat
   11.10 +  fun prep_simproc (name, pats, proc) =
   11.11 +    Simplifier.simproc (Theory.sign_of (the_context())) name pats proc;
   11.12  
   11.13    fun is_numeral (Const("Numeral.number_of", _) $ w) = true
   11.14      | is_numeral _ = false
   11.15 @@ -380,19 +379,19 @@
   11.16    val eval_numerals = 
   11.17      map prep_simproc
   11.18       [("int_add_eval_numerals",
   11.19 -       prep_pats ["(m::int) + 1", "(m::int) + number_of v"], 
   11.20 +       ["(m::int) + 1", "(m::int) + number_of v"], 
   11.21         IntAbstractNumerals.proc (number_of_add RS sym)),
   11.22        ("int_diff_eval_numerals",
   11.23 -       prep_pats ["(m::int) - 1", "(m::int) - number_of v"], 
   11.24 +       ["(m::int) - 1", "(m::int) - number_of v"], 
   11.25         IntAbstractNumerals.proc diff_number_of_eq),
   11.26        ("int_eq_eval_numerals",
   11.27 -       prep_pats ["(m::int) = 0", "(m::int) = 1", "(m::int) = number_of v"], 
   11.28 +       ["(m::int) = 0", "(m::int) = 1", "(m::int) = number_of v"], 
   11.29         IntAbstractNumerals.proc eq_number_of_eq),
   11.30        ("int_less_eval_numerals",
   11.31 -       prep_pats ["(m::int) < 0", "(m::int) < 1", "(m::int) < number_of v"], 
   11.32 +       ["(m::int) < 0", "(m::int) < 1", "(m::int) < number_of v"], 
   11.33         IntAbstractNumerals.proc less_number_of_eq_neg),
   11.34        ("int_le_eval_numerals",
   11.35 -       prep_pats ["(m::int) <= 0", "(m::int) <= 1", "(m::int) <= number_of v"],
   11.36 +       ["(m::int) <= 0", "(m::int) <= 1", "(m::int) <= number_of v"],
   11.37         IntAbstractNumerals.proc le_number_of_eq_not_less)]
   11.38  
   11.39    (*reorientation simprules using ==, for the following simproc*)
   11.40 @@ -413,9 +412,7 @@
   11.41  		| Const("Numeral.number_of", _) $ _ => meta_number_of_reorient)
   11.42  
   11.43    val reorient_simproc = 
   11.44 -      prep_simproc ("reorient_simproc",
   11.45 -	            prep_pats ["0=x", "1=x", "number_of w = x"], 
   11.46 -                    reorient_proc)
   11.47 +      prep_simproc ("reorient_simproc", ["0=x", "1=x", "number_of w = x"], reorient_proc)
   11.48  
   11.49    end;
   11.50  
    12.1 --- a/src/HOL/Integ/int_arith1.ML	Tue Aug 06 11:20:47 2002 +0200
    12.2 +++ b/src/HOL/Integ/int_arith1.ML	Tue Aug 06 11:22:05 2002 +0200
    12.3 @@ -34,15 +34,15 @@
    12.4  (** For cancel_numerals **)
    12.5  
    12.6  val rel_iff_rel_0_rls = map (inst "y" "?u+?v")
    12.7 -                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0, 
    12.8 -			   zle_iff_zdiff_zle_0] @
    12.9 -		        map (inst "y" "n")
   12.10 -                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0, 
   12.11 -			   zle_iff_zdiff_zle_0];
   12.12 +                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0,
   12.13 +                           zle_iff_zdiff_zle_0] @
   12.14 +                        map (inst "y" "n")
   12.15 +                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0,
   12.16 +                           zle_iff_zdiff_zle_0];
   12.17  
   12.18  Goal "!!i::int. (i*u + m = j*u + n) = ((i-j)*u + m = n)";
   12.19  by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]@
   12.20 -		                     zadd_ac@rel_iff_rel_0_rls) 1);
   12.21 +                                     zadd_ac@rel_iff_rel_0_rls) 1);
   12.22  qed "eq_add_iff1";
   12.23  
   12.24  Goal "!!i::int. (i*u + m = j*u + n) = (m = (j-i)*u + n)";
   12.25 @@ -79,7 +79,7 @@
   12.26  val numeral_syms = [int_numeral_0_eq_0 RS sym, int_numeral_1_eq_1 RS sym];
   12.27  val numeral_sym_ss = HOL_ss addsimps numeral_syms;
   12.28  
   12.29 -fun rename_numerals th = 
   12.30 +fun rename_numerals th =
   12.31      simplify numeral_sym_ss (Thm.transfer (the_context ()) th);
   12.32  
   12.33  (*Utilities*)
   12.34 @@ -89,14 +89,14 @@
   12.35  (*Decodes a binary INTEGER*)
   12.36  fun dest_numeral (Const("0", _)) = 0
   12.37    | dest_numeral (Const("1", _)) = 1
   12.38 -  | dest_numeral (Const("Numeral.number_of", _) $ w) = 
   12.39 +  | dest_numeral (Const("Numeral.number_of", _) $ w) =
   12.40       (HOLogic.dest_binum w
   12.41        handle TERM _ => raise TERM("Int_Numeral_Simprocs.dest_numeral:1", [w]))
   12.42    | dest_numeral t = raise TERM("Int_Numeral_Simprocs.dest_numeral:2", [t]);
   12.43  
   12.44  fun find_first_numeral past (t::terms) =
   12.45 -	((dest_numeral t, rev past @ terms)
   12.46 -	 handle TERM _ => find_first_numeral (t::past) terms)
   12.47 +        ((dest_numeral t, rev past @ terms)
   12.48 +         handle TERM _ => find_first_numeral (t::past) terms)
   12.49    | find_first_numeral past [] = raise TERM("find_first_numeral", []);
   12.50  
   12.51  val zero = mk_numeral 0;
   12.52 @@ -121,7 +121,7 @@
   12.53    | dest_summing (pos, Const ("op -", _) $ t $ u, ts) =
   12.54          dest_summing (pos, t, dest_summing (not pos, u, ts))
   12.55    | dest_summing (pos, t, ts) =
   12.56 -	if pos then t::ts else uminus_const$t :: ts;
   12.57 +        if pos then t::ts else uminus_const$t :: ts;
   12.58  
   12.59  fun dest_sum t = dest_summing (true, t, []);
   12.60  
   12.61 @@ -139,29 +139,29 @@
   12.62  val dest_times = HOLogic.dest_bin "op *" HOLogic.intT;
   12.63  
   12.64  fun dest_prod t =
   12.65 -      let val (t,u) = dest_times t 
   12.66 +      let val (t,u) = dest_times t
   12.67        in  dest_prod t @ dest_prod u  end
   12.68        handle TERM _ => [t];
   12.69  
   12.70 -(*DON'T do the obvious simplifications; that would create special cases*) 
   12.71 +(*DON'T do the obvious simplifications; that would create special cases*)
   12.72  fun mk_coeff (k, ts) = mk_times (mk_numeral k, ts);
   12.73  
   12.74  (*Express t as a product of (possibly) a numeral with other sorted terms*)
   12.75  fun dest_coeff sign (Const ("uminus", _) $ t) = dest_coeff (~sign) t
   12.76    | dest_coeff sign t =
   12.77      let val ts = sort Term.term_ord (dest_prod t)
   12.78 -	val (n, ts') = find_first_numeral [] ts
   12.79 +        val (n, ts') = find_first_numeral [] ts
   12.80                            handle TERM _ => (1, ts)
   12.81      in (sign*n, mk_prod ts') end;
   12.82  
   12.83  (*Find first coefficient-term THAT MATCHES u*)
   12.84 -fun find_first_coeff past u [] = raise TERM("find_first_coeff", []) 
   12.85 +fun find_first_coeff past u [] = raise TERM("find_first_coeff", [])
   12.86    | find_first_coeff past u (t::terms) =
   12.87 -	let val (n,u') = dest_coeff 1 t
   12.88 -	in  if u aconv u' then (n, rev past @ terms)
   12.89 -			  else find_first_coeff (t::past) u terms
   12.90 -	end
   12.91 -	handle TERM _ => find_first_coeff (t::past) u terms;
   12.92 +        let val (n,u') = dest_coeff 1 t
   12.93 +        in  if u aconv u' then (n, rev past @ terms)
   12.94 +                          else find_first_coeff (t::past) u terms
   12.95 +        end
   12.96 +        handle TERM _ => find_first_coeff (t::past) u terms;
   12.97  
   12.98  
   12.99  (*Simplify Numeral0+n, n+Numeral0, Numeral1*n, n*Numeral1*)
  12.100 @@ -172,24 +172,24 @@
  12.101  (*To perform binary arithmetic.  The "left" rewriting handles patterns
  12.102    created by the simprocs, such as 3 * (5 * x). *)
  12.103  val bin_simps = [int_numeral_0_eq_0 RS sym, int_numeral_1_eq_1 RS sym,
  12.104 -                 add_number_of_left, mult_number_of_left] @ 
  12.105 +                 add_number_of_left, mult_number_of_left] @
  12.106                  bin_arith_simps @ bin_rel_simps;
  12.107  
  12.108  (*To evaluate binary negations of coefficients*)
  12.109  val zminus_simps = NCons_simps @
  12.110 -                   [zminus_1_eq_m1, number_of_minus RS sym, 
  12.111 -		    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
  12.112 -		    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
  12.113 +                   [zminus_1_eq_m1, number_of_minus RS sym,
  12.114 +                    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
  12.115 +                    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
  12.116  
  12.117  (*To let us treat subtraction as addition*)
  12.118  val diff_simps = [zdiff_def, zminus_zadd_distrib, zminus_zminus];
  12.119  
  12.120  (*push the unary minus down: - x * y = x * - y *)
  12.121 -val int_minus_mult_eq_1_to_2 = 
  12.122 +val int_minus_mult_eq_1_to_2 =
  12.123      [zmult_zminus, zmult_zminus_right RS sym] MRS trans |> standard;
  12.124  
  12.125  (*to extract again any uncancelled minuses*)
  12.126 -val int_minus_from_mult_simps = 
  12.127 +val int_minus_from_mult_simps =
  12.128      [zminus_zminus, zmult_zminus, zmult_zminus_right];
  12.129  
  12.130  (*combine unary minus with numeric literals, however nested within a product*)
  12.131 @@ -206,19 +206,19 @@
  12.132  
  12.133  structure CancelNumeralsCommon =
  12.134    struct
  12.135 -  val mk_sum    	= mk_sum
  12.136 -  val dest_sum		= dest_sum
  12.137 -  val mk_coeff		= mk_coeff
  12.138 -  val dest_coeff	= dest_coeff 1
  12.139 -  val find_first_coeff	= find_first_coeff []
  12.140 +  val mk_sum            = mk_sum
  12.141 +  val dest_sum          = dest_sum
  12.142 +  val mk_coeff          = mk_coeff
  12.143 +  val dest_coeff        = dest_coeff 1
  12.144 +  val find_first_coeff  = find_first_coeff []
  12.145    val trans_tac         = trans_tac
  12.146 -  val norm_tac = 
  12.147 +  val norm_tac =
  12.148       ALLGOALS (simp_tac (HOL_ss addsimps numeral_syms@add_0s@mult_1s@
  12.149                                           diff_simps@zminus_simps@zadd_ac))
  12.150       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@int_mult_minus_simps))
  12.151       THEN ALLGOALS (simp_tac (HOL_ss addsimps int_minus_from_mult_simps@
  12.152                                                zadd_ac@zmult_ac))
  12.153 -  val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
  12.154 +  val numeral_simp_tac  = ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
  12.155    val simplify_meta_eq  = simplify_meta_eq (add_0s@mult_1s)
  12.156    end;
  12.157  
  12.158 @@ -250,55 +250,51 @@
  12.159    val bal_add2 = le_add_iff2 RS trans
  12.160  );
  12.161  
  12.162 -val cancel_numerals = 
  12.163 +val cancel_numerals =
  12.164    map Bin_Simprocs.prep_simproc
  12.165     [("inteq_cancel_numerals",
  12.166 -     Bin_Simprocs.prep_pats
  12.167 -               ["(l::int) + m = n", "(l::int) = m + n", 
  12.168 -		"(l::int) - m = n", "(l::int) = m - n", 
  12.169 -		"(l::int) * m = n", "(l::int) = m * n"], 
  12.170 +     ["(l::int) + m = n", "(l::int) = m + n",
  12.171 +      "(l::int) - m = n", "(l::int) = m - n",
  12.172 +      "(l::int) * m = n", "(l::int) = m * n"],
  12.173       EqCancelNumerals.proc),
  12.174 -    ("intless_cancel_numerals", 
  12.175 -     Bin_Simprocs.prep_pats
  12.176 -               ["(l::int) + m < n", "(l::int) < m + n", 
  12.177 -		"(l::int) - m < n", "(l::int) < m - n", 
  12.178 -		"(l::int) * m < n", "(l::int) < m * n"], 
  12.179 +    ("intless_cancel_numerals",
  12.180 +     ["(l::int) + m < n", "(l::int) < m + n",
  12.181 +      "(l::int) - m < n", "(l::int) < m - n",
  12.182 +      "(l::int) * m < n", "(l::int) < m * n"],
  12.183       LessCancelNumerals.proc),
  12.184 -    ("intle_cancel_numerals", 
  12.185 -     Bin_Simprocs.prep_pats
  12.186 -               ["(l::int) + m <= n", "(l::int) <= m + n", 
  12.187 -		"(l::int) - m <= n", "(l::int) <= m - n", 
  12.188 -		"(l::int) * m <= n", "(l::int) <= m * n"], 
  12.189 +    ("intle_cancel_numerals",
  12.190 +     ["(l::int) + m <= n", "(l::int) <= m + n",
  12.191 +      "(l::int) - m <= n", "(l::int) <= m - n",
  12.192 +      "(l::int) * m <= n", "(l::int) <= m * n"],
  12.193       LeCancelNumerals.proc)];
  12.194  
  12.195  
  12.196  structure CombineNumeralsData =
  12.197    struct
  12.198 -  val add		= op + : int*int -> int 
  12.199 -  val mk_sum    	= long_mk_sum    (*to work for e.g. 2*x + 3*x *)
  12.200 -  val dest_sum		= dest_sum
  12.201 -  val mk_coeff		= mk_coeff
  12.202 -  val dest_coeff	= dest_coeff 1
  12.203 -  val left_distrib	= left_zadd_zmult_distrib RS trans
  12.204 +  val add               = op + : int*int -> int
  12.205 +  val mk_sum            = long_mk_sum    (*to work for e.g. 2*x + 3*x *)
  12.206 +  val dest_sum          = dest_sum
  12.207 +  val mk_coeff          = mk_coeff
  12.208 +  val dest_coeff        = dest_coeff 1
  12.209 +  val left_distrib      = left_zadd_zmult_distrib RS trans
  12.210    val prove_conv        = Bin_Simprocs.prove_conv_nohyps "int_combine_numerals"
  12.211    val trans_tac          = trans_tac
  12.212 -  val norm_tac = 
  12.213 +  val norm_tac =
  12.214       ALLGOALS (simp_tac (HOL_ss addsimps numeral_syms@add_0s@mult_1s@
  12.215                                           diff_simps@zminus_simps@zadd_ac))
  12.216       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@int_mult_minus_simps))
  12.217       THEN ALLGOALS (simp_tac (HOL_ss addsimps int_minus_from_mult_simps@
  12.218                                                zadd_ac@zmult_ac))
  12.219 -  val numeral_simp_tac	= ALLGOALS 
  12.220 +  val numeral_simp_tac  = ALLGOALS
  12.221                      (simp_tac (HOL_ss addsimps add_0s@bin_simps))
  12.222    val simplify_meta_eq  = simplify_meta_eq (add_0s@mult_1s)
  12.223    end;
  12.224  
  12.225  structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
  12.226 -  
  12.227 -val combine_numerals = Bin_Simprocs.prep_simproc
  12.228 -                 ("int_combine_numerals",
  12.229 -		  Bin_Simprocs.prep_pats ["(i::int) + j", "(i::int) - j"],
  12.230 -		  CombineNumerals.proc);
  12.231 +
  12.232 +val combine_numerals =
  12.233 +  Bin_Simprocs.prep_simproc
  12.234 +    ("int_combine_numerals", ["(i::int) + j", "(i::int) - j"], CombineNumerals.proc);
  12.235  
  12.236  end;
  12.237  
  12.238 @@ -312,7 +308,7 @@
  12.239  print_depth 22;
  12.240  set timing;
  12.241  set trace_simp;
  12.242 -fun test s = (Goal s, by (Simp_tac 1)); 
  12.243 +fun test s = (Goal s, by (Simp_tac 1));
  12.244  
  12.245  test "l + 2 + 2 + 2 + (l + 2) + (oo + 2) = (uu::int)";
  12.246  
  12.247 @@ -355,10 +351,10 @@
  12.248  
  12.249  structure Int_Times_Assoc_Data : ASSOC_FOLD_DATA =
  12.250  struct
  12.251 -  val ss		= HOL_ss
  12.252 -  val eq_reflection	= eq_reflection
  12.253 +  val ss                = HOL_ss
  12.254 +  val eq_reflection     = eq_reflection
  12.255    val sg_ref = Sign.self_ref (Theory.sign_of (the_context ()))
  12.256 -  val T	     = HOLogic.intT
  12.257 +  val T      = HOLogic.intT
  12.258    val plus   = Const ("op *", [HOLogic.intT,HOLogic.intT] ---> HOLogic.intT);
  12.259    val add_ac = zmult_ac
  12.260  end;
  12.261 @@ -372,10 +368,10 @@
  12.262  
  12.263  structure Nat_Times_Assoc_Data : ASSOC_FOLD_DATA =
  12.264  struct
  12.265 -  val ss		= HOL_ss
  12.266 -  val eq_reflection	= eq_reflection
  12.267 +  val ss                = HOL_ss
  12.268 +  val eq_reflection     = eq_reflection
  12.269    val sg_ref = Sign.self_ref (Theory.sign_of (the_context ()))
  12.270 -  val T	     = HOLogic.natT
  12.271 +  val T      = HOLogic.natT
  12.272    val plus   = Const ("op *", [HOLogic.natT,HOLogic.natT] ---> HOLogic.natT);
  12.273    val add_ac = mult_ac
  12.274  end;
  12.275 @@ -399,19 +395,19 @@
  12.276  local
  12.277  
  12.278  (* reduce contradictory <= to False *)
  12.279 -val add_rules = 
  12.280 -    simp_thms @ bin_arith_simps @ bin_rel_simps @ 
  12.281 +val add_rules =
  12.282 +    simp_thms @ bin_arith_simps @ bin_rel_simps @
  12.283      [int_numeral_0_eq_0, int_numeral_1_eq_1,
  12.284       zminus_0, zadd_0, zadd_0_right, zdiff_def,
  12.285 -     zadd_zminus_inverse, zadd_zminus_inverse2, 
  12.286 -     zmult_0, zmult_0_right, 
  12.287 +     zadd_zminus_inverse, zadd_zminus_inverse2,
  12.288 +     zmult_0, zmult_0_right,
  12.289       zmult_1, zmult_1_right,
  12.290       zmult_zminus, zmult_zminus_right,
  12.291       zminus_zadd_distrib, zminus_zminus, zmult_assoc,
  12.292       int_0, int_1, zadd_int RS sym, int_Suc];
  12.293  
  12.294  val simprocs = [Int_Times_Assoc.conv, Int_Numeral_Simprocs.combine_numerals]@
  12.295 -               Int_Numeral_Simprocs.cancel_numerals @ 
  12.296 +               Int_Numeral_Simprocs.cancel_numerals @
  12.297                 Bin_Simprocs.eval_numerals;
  12.298  
  12.299  val add_mono_thms_int =
  12.300 @@ -440,16 +436,12 @@
  12.301  
  12.302  end;
  12.303  
  12.304 -let
  12.305 -val int_arith_simproc_pats =
  12.306 -  map (fn s => Thm.read_cterm (Theory.sign_of (the_context())) (s, HOLogic.boolT))
  12.307 -      ["(m::int) < n","(m::int) <= n", "(m::int) = n"];
  12.308 +val fast_int_arith_simproc =
  12.309 +  Simplifier.simproc (Theory.sign_of (the_context()))
  12.310 +  "fast_int_arith" ["(m::int) < n","(m::int) <= n", "(m::int) = n"] Fast_Arith.lin_arith_prover;
  12.311  
  12.312 -val fast_int_arith_simproc = mk_simproc
  12.313 -  "fast_int_arith" int_arith_simproc_pats Fast_Arith.lin_arith_prover;
  12.314 -in
  12.315  Addsimprocs [fast_int_arith_simproc]
  12.316 -end;
  12.317 +
  12.318  
  12.319  (* Some test data
  12.320  Goal "!!a::int. [| a <= b; c <= d; x+y<z |] ==> a+c <= b+d";
    13.1 --- a/src/HOL/Integ/int_factor_simprocs.ML	Tue Aug 06 11:20:47 2002 +0200
    13.2 +++ b/src/HOL/Integ/int_factor_simprocs.ML	Tue Aug 06 11:22:05 2002 +0200
    13.3 @@ -12,26 +12,26 @@
    13.4  
    13.5  Goal "!!k::int. (k*m <= k*n) = ((0 < k --> m<=n) & (k < 0 --> n<=m))";
    13.6  by (stac zmult_zle_cancel1 1);
    13.7 -by Auto_tac;  
    13.8 +by Auto_tac;
    13.9  qed "int_mult_le_cancel1";
   13.10  
   13.11  Goal "!!k::int. (k*m < k*n) = ((0 < k & m<n) | (k < 0 & n<m))";
   13.12  by (stac zmult_zless_cancel1 1);
   13.13 -by Auto_tac;  
   13.14 +by Auto_tac;
   13.15  qed "int_mult_less_cancel1";
   13.16  
   13.17  Goal "!!k::int. (k*m = k*n) = (k = 0 | m=n)";
   13.18 -by Auto_tac;  
   13.19 +by Auto_tac;
   13.20  qed "int_mult_eq_cancel1";
   13.21  
   13.22  Goal "!!k::int. k~=0 ==> (k*m) div (k*n) = (m div n)";
   13.23 -by (stac zdiv_zmult_zmult1 1); 
   13.24 -by Auto_tac;  
   13.25 +by (stac zdiv_zmult_zmult1 1);
   13.26 +by Auto_tac;
   13.27  qed "int_mult_div_cancel1";
   13.28  
   13.29  (*For ExtractCommonTermFun, cancelling common factors*)
   13.30  Goal "(k*m) div (k*n) = (if k = (0::int) then 0 else m div n)";
   13.31 -by (simp_tac (simpset() addsimps [int_mult_div_cancel1]) 1); 
   13.32 +by (simp_tac (simpset() addsimps [int_mult_div_cancel1]) 1);
   13.33  qed "int_mult_div_cancel_disj";
   13.34  
   13.35  local
   13.36 @@ -40,15 +40,15 @@
   13.37  
   13.38  structure CancelNumeralFactorCommon =
   13.39    struct
   13.40 -  val mk_coeff		= mk_coeff
   13.41 -  val dest_coeff	= dest_coeff 1
   13.42 +  val mk_coeff          = mk_coeff
   13.43 +  val dest_coeff        = dest_coeff 1
   13.44    val trans_tac         = trans_tac
   13.45 -  val norm_tac = 
   13.46 +  val norm_tac =
   13.47       ALLGOALS (simp_tac (HOL_ss addsimps int_minus_from_mult_simps@mult_1s))
   13.48       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@int_mult_minus_simps))
   13.49       THEN ALLGOALS
   13.50              (simp_tac (HOL_ss addsimps zmult_ac))
   13.51 -  val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps bin_simps))
   13.52 +  val numeral_simp_tac  = ALLGOALS (simp_tac (HOL_ss addsimps bin_simps))
   13.53    val simplify_meta_eq  = simplify_meta_eq mult_1s
   13.54    end
   13.55  
   13.56 @@ -88,19 +88,15 @@
   13.57    val neg_exchanges = true
   13.58  )
   13.59  
   13.60 -val int_cancel_numeral_factors = 
   13.61 +val int_cancel_numeral_factors =
   13.62    map Bin_Simprocs.prep_simproc
   13.63 -   [("inteq_cancel_numeral_factors",
   13.64 -     Bin_Simprocs.prep_pats ["(l::int) * m = n", "(l::int) = m * n"], 
   13.65 +   [("inteq_cancel_numeral_factors", ["(l::int) * m = n", "(l::int) = m * n"],
   13.66       EqCancelNumeralFactor.proc),
   13.67 -    ("intless_cancel_numeral_factors", 
   13.68 -     Bin_Simprocs.prep_pats ["(l::int) * m < n", "(l::int) < m * n"], 
   13.69 +    ("intless_cancel_numeral_factors", ["(l::int) * m < n", "(l::int) < m * n"],
   13.70       LessCancelNumeralFactor.proc),
   13.71 -    ("intle_cancel_numeral_factors", 
   13.72 -     Bin_Simprocs.prep_pats ["(l::int) * m <= n", "(l::int) <= m * n"], 
   13.73 +    ("intle_cancel_numeral_factors", ["(l::int) * m <= n", "(l::int) <= m * n"],
   13.74       LeCancelNumeralFactor.proc),
   13.75 -    ("intdiv_cancel_numeral_factors", 
   13.76 -     Bin_Simprocs.prep_pats ["((l::int) * m) div n", "(l::int) div (m * n)"], 
   13.77 +    ("intdiv_cancel_numeral_factors", ["((l::int) * m) div n", "(l::int) div (m * n)"],
   13.78       DivCancelNumeralFactor.proc)];
   13.79  
   13.80  end;
   13.81 @@ -112,7 +108,7 @@
   13.82  print_depth 22;
   13.83  set timing;
   13.84  set trace_simp;
   13.85 -fun test s = (Goal s; by (Simp_tac 1)); 
   13.86 +fun test s = (Goal s; by (Simp_tac 1));
   13.87  
   13.88  test "9*x = 12 * (y::int)";
   13.89  test "(9*x) div (12 * (y::int)) = z";
   13.90 @@ -156,25 +152,25 @@
   13.91    | long_mk_prod (t :: ts) = mk_times (t, mk_prod ts);
   13.92  
   13.93  (*Find first term that matches u*)
   13.94 -fun find_first past u []         = raise TERM("find_first", []) 
   13.95 +fun find_first past u []         = raise TERM("find_first", [])
   13.96    | find_first past u (t::terms) =
   13.97 -	if u aconv t then (rev past @ terms)
   13.98 +        if u aconv t then (rev past @ terms)
   13.99          else find_first (t::past) u terms
  13.100 -	handle TERM _ => find_first (t::past) u terms;
  13.101 +        handle TERM _ => find_first (t::past) u terms;
  13.102  
  13.103  (*Final simplification: cancel + and *  *)
  13.104 -fun cancel_simplify_meta_eq cancel_th th = 
  13.105 -    Int_Numeral_Simprocs.simplify_meta_eq 
  13.106 -        [zmult_1, zmult_1_right] 
  13.107 +fun cancel_simplify_meta_eq cancel_th th =
  13.108 +    Int_Numeral_Simprocs.simplify_meta_eq
  13.109 +        [zmult_1, zmult_1_right]
  13.110          (([th, cancel_th]) MRS trans);
  13.111  
  13.112  structure CancelFactorCommon =
  13.113    struct
  13.114 -  val mk_sum    	= long_mk_prod
  13.115 -  val dest_sum		= dest_prod
  13.116 -  val mk_coeff		= mk_coeff
  13.117 -  val dest_coeff	= dest_coeff
  13.118 -  val find_first	= find_first []
  13.119 +  val mk_sum            = long_mk_prod
  13.120 +  val dest_sum          = dest_prod
  13.121 +  val mk_coeff          = mk_coeff
  13.122 +  val dest_coeff        = dest_coeff
  13.123 +  val find_first        = find_first []
  13.124    val trans_tac         = trans_tac
  13.125    val norm_tac = ALLGOALS (simp_tac (HOL_ss addsimps mult_1s@zmult_ac))
  13.126    end;
  13.127 @@ -195,13 +191,10 @@
  13.128    val simplify_meta_eq  = cancel_simplify_meta_eq int_mult_div_cancel_disj
  13.129  );
  13.130  
  13.131 -val int_cancel_factor = 
  13.132 +val int_cancel_factor =
  13.133    map Bin_Simprocs.prep_simproc
  13.134 -   [("int_eq_cancel_factor",
  13.135 -     Bin_Simprocs.prep_pats ["(l::int) * m = n", "(l::int) = m * n"], 
  13.136 -     EqCancelFactor.proc),
  13.137 -    ("int_divide_cancel_factor", 
  13.138 -     Bin_Simprocs.prep_pats ["((l::int) * m) div n", "(l::int) div (m * n)"], 
  13.139 +   [("int_eq_cancel_factor", ["(l::int) * m = n", "(l::int) = m * n"], EqCancelFactor.proc),
  13.140 +    ("int_divide_cancel_factor", ["((l::int) * m) div n", "(l::int) div (m * n)"],
  13.141       DivideCancelFactor.proc)];
  13.142  
  13.143  end;
  13.144 @@ -213,15 +206,15 @@
  13.145  print_depth 22;
  13.146  set timing;
  13.147  set trace_simp;
  13.148 -fun test s = (Goal s; by (Asm_simp_tac 1)); 
  13.149 +fun test s = (Goal s; by (Asm_simp_tac 1));
  13.150  
  13.151  test "x*k = k*(y::int)";
  13.152 -test "k = k*(y::int)"; 
  13.153 +test "k = k*(y::int)";
  13.154  test "a*(b*c) = (b::int)";
  13.155  test "a*(b*c) = d*(b::int)*(x*a)";
  13.156  
  13.157  test "(x*k) div (k*(y::int)) = (uu::int)";
  13.158 -test "(k) div (k*(y::int)) = (uu::int)"; 
  13.159 +test "(k) div (k*(y::int)) = (uu::int)";
  13.160  test "(a*(b*c)) div ((b::int)) = (uu::int)";
  13.161  test "(a*(b*c)) div (d*(b::int)*(x*a)) = (uu::int)";
  13.162  *)
    14.1 --- a/src/HOL/Integ/nat_bin.ML	Tue Aug 06 11:20:47 2002 +0200
    14.2 +++ b/src/HOL/Integ/nat_bin.ML	Tue Aug 06 11:22:05 2002 +0200
    14.3 @@ -238,12 +238,8 @@
    14.4  
    14.5  val nat_eval_numerals = 
    14.6    map Bin_Simprocs.prep_simproc
    14.7 -   [("nat_div_eval_numerals",
    14.8 -     Bin_Simprocs.prep_pats ["(Suc 0) div m"],
    14.9 -     NatAbstractNumerals.proc div_nat_number_of),
   14.10 -    ("nat_mod_eval_numerals",
   14.11 -     Bin_Simprocs.prep_pats ["(Suc 0) mod m"],
   14.12 -     NatAbstractNumerals.proc mod_nat_number_of)];
   14.13 +   [("nat_div_eval_numerals", ["(Suc 0) div m"], NatAbstractNumerals.proc div_nat_number_of),
   14.14 +    ("nat_mod_eval_numerals", ["(Suc 0) mod m"], NatAbstractNumerals.proc mod_nat_number_of)];
   14.15  
   14.16  Addsimprocs nat_eval_numerals;
   14.17  
    15.1 --- a/src/HOL/Integ/nat_simprocs.ML	Tue Aug 06 11:20:47 2002 +0200
    15.2 +++ b/src/HOL/Integ/nat_simprocs.ML	Tue Aug 06 11:22:05 2002 +0200
    15.3 @@ -67,38 +67,38 @@
    15.4  (** For cancel_numeral_factors **)
    15.5  
    15.6  Goal "(0::nat) < k ==> (k*m <= k*n) = (m<=n)";
    15.7 -by Auto_tac;  
    15.8 +by Auto_tac;
    15.9  qed "nat_mult_le_cancel1";
   15.10  
   15.11  Goal "(0::nat) < k ==> (k*m < k*n) = (m<n)";
   15.12 -by Auto_tac;  
   15.13 +by Auto_tac;
   15.14  qed "nat_mult_less_cancel1";
   15.15  
   15.16  Goal "(0::nat) < k ==> (k*m = k*n) = (m=n)";
   15.17 -by Auto_tac;  
   15.18 +by Auto_tac;
   15.19  qed "nat_mult_eq_cancel1";
   15.20  
   15.21  Goal "(0::nat) < k ==> (k*m) div (k*n) = (m div n)";
   15.22 -by Auto_tac;  
   15.23 +by Auto_tac;
   15.24  qed "nat_mult_div_cancel1";
   15.25  
   15.26  
   15.27  (** For cancel_factor **)
   15.28  
   15.29  Goal "(k*m <= k*n) = ((0::nat) < k --> m<=n)";
   15.30 -by Auto_tac;  
   15.31 +by Auto_tac;
   15.32  qed "nat_mult_le_cancel_disj";
   15.33  
   15.34  Goal "(k*m < k*n) = ((0::nat) < k & m<n)";
   15.35 -by Auto_tac;  
   15.36 +by Auto_tac;
   15.37  qed "nat_mult_less_cancel_disj";
   15.38  
   15.39  Goal "(k*m = k*n) = (k = (0::nat) | m=n)";
   15.40 -by Auto_tac;  
   15.41 +by Auto_tac;
   15.42  qed "nat_mult_eq_cancel_disj";
   15.43  
   15.44  Goal "(k*m) div (k*n) = (if k = (0::nat) then 0 else m div n)";
   15.45 -by (simp_tac (simpset() addsimps [nat_mult_div_cancel1]) 1); 
   15.46 +by (simp_tac (simpset() addsimps [nat_mult_div_cancel1]) 1);
   15.47  qed "nat_mult_div_cancel_disj";
   15.48  
   15.49  
   15.50 @@ -110,7 +110,7 @@
   15.51         [numeral_0_eq_0 RS sym, numeral_1_eq_1 RS sym, numeral_2_eq_2 RS sym];
   15.52  val numeral_sym_ss = HOL_ss addsimps numeral_syms;
   15.53  
   15.54 -fun rename_numerals th = 
   15.55 +fun rename_numerals th =
   15.56      simplify numeral_sym_ss (Thm.transfer (the_context ()) th);
   15.57  
   15.58  (*Utilities*)
   15.59 @@ -164,13 +164,12 @@
   15.60  val bin_simps = [numeral_0_eq_0 RS sym, numeral_1_eq_1 RS sym,
   15.61                   add_nat_number_of, nat_number_of_add_left,
   15.62                   diff_nat_number_of, le_nat_number_of_eq_not_less,
   15.63 -                 less_nat_number_of, mult_nat_number_of, 
   15.64 +                 less_nat_number_of, mult_nat_number_of,
   15.65                   thm "Let_number_of", nat_number_of] @
   15.66                  bin_arith_simps @ bin_rel_simps;
   15.67  
   15.68 -fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
   15.69 -fun prep_pat s = HOLogic.read_cterm (Theory.sign_of (the_context ())) s;
   15.70 -val prep_pats = map prep_pat;
   15.71 +fun prep_simproc (name, pats, proc) =
   15.72 +  Simplifier.simproc (Theory.sign_of (the_context ())) name pats proc;
   15.73  
   15.74  
   15.75  (*** CancelNumerals simprocs ***)
   15.76 @@ -218,7 +217,7 @@
   15.77  
   15.78  (*And these help the simproc return False when appropriate, which helps
   15.79    the arith prover.*)
   15.80 -val contra_rules = [add_Suc, add_Suc_right, Zero_not_Suc, Suc_not_Zero, 
   15.81 +val contra_rules = [add_Suc, add_Suc_right, Zero_not_Suc, Suc_not_Zero,
   15.82                      le_0_eq];
   15.83  
   15.84  val simplify_meta_eq =
   15.85 @@ -240,7 +239,7 @@
   15.86  
   15.87  fun prod_has_numeral t = exists is_numeral (dest_prod t);
   15.88  
   15.89 -fun restricted_dest_Sucs_sum t = 
   15.90 +fun restricted_dest_Sucs_sum t =
   15.91      if exists prod_has_numeral (dest_sum (ignore_Sucs t))
   15.92      then dest_Sucs_sum t
   15.93      else raise TERM("Nat_Numeral_Simprocs.restricted_dest_Sucs_sum", [t]);
   15.94 @@ -307,24 +306,24 @@
   15.95  val cancel_numerals =
   15.96    map prep_simproc
   15.97     [("nateq_cancel_numerals",
   15.98 -     prep_pats ["(l::nat) + m = n", "(l::nat) = m + n",
   15.99 -                "(l::nat) * m = n", "(l::nat) = m * n",
  15.100 -                "Suc m = n", "m = Suc n"],
  15.101 +     ["(l::nat) + m = n", "(l::nat) = m + n",
  15.102 +      "(l::nat) * m = n", "(l::nat) = m * n",
  15.103 +      "Suc m = n", "m = Suc n"],
  15.104       EqCancelNumerals.proc),
  15.105      ("natless_cancel_numerals",
  15.106 -     prep_pats ["(l::nat) + m < n", "(l::nat) < m + n",
  15.107 -                "(l::nat) * m < n", "(l::nat) < m * n",
  15.108 -                "Suc m < n", "m < Suc n"],
  15.109 +     ["(l::nat) + m < n", "(l::nat) < m + n",
  15.110 +      "(l::nat) * m < n", "(l::nat) < m * n",
  15.111 +      "Suc m < n", "m < Suc n"],
  15.112       LessCancelNumerals.proc),
  15.113      ("natle_cancel_numerals",
  15.114 -     prep_pats ["(l::nat) + m <= n", "(l::nat) <= m + n",
  15.115 -                "(l::nat) * m <= n", "(l::nat) <= m * n",
  15.116 -                "Suc m <= n", "m <= Suc n"],
  15.117 +     ["(l::nat) + m <= n", "(l::nat) <= m + n",
  15.118 +      "(l::nat) * m <= n", "(l::nat) <= m * n",
  15.119 +      "Suc m <= n", "m <= Suc n"],
  15.120       LeCancelNumerals.proc),
  15.121      ("natdiff_cancel_numerals",
  15.122 -     prep_pats ["((l::nat) + m) - n", "(l::nat) - (m + n)",
  15.123 -                "(l::nat) * m - n", "(l::nat) - m * n",
  15.124 -                "Suc m - n", "m - Suc n"],
  15.125 +     ["((l::nat) + m) - n", "(l::nat) - (m + n)",
  15.126 +      "(l::nat) * m - n", "(l::nat) - m * n",
  15.127 +      "Suc m - n", "m - Suc n"],
  15.128       DiffCancelNumerals.proc)];
  15.129  
  15.130  
  15.131 @@ -332,13 +331,13 @@
  15.132  
  15.133  structure CombineNumeralsData =
  15.134    struct
  15.135 -  val add		= op + : int*int -> int 
  15.136 +  val add               = op + : int*int -> int
  15.137    val mk_sum            = long_mk_sum    (*to work for e.g. 2*x + 3*x *)
  15.138    val dest_sum          = restricted_dest_Sucs_sum
  15.139    val mk_coeff          = mk_coeff
  15.140    val dest_coeff        = dest_coeff
  15.141    val left_distrib      = left_add_mult_distrib RS trans
  15.142 -  val prove_conv	= Bin_Simprocs.prove_conv_nohyps "nat_combine_numerals"
  15.143 +  val prove_conv        = Bin_Simprocs.prove_conv_nohyps "nat_combine_numerals"
  15.144    val trans_tac          = trans_tac
  15.145    val norm_tac = ALLGOALS
  15.146                     (simp_tac (HOL_ss addsimps numeral_syms@add_0s@mult_1s@
  15.147 @@ -353,22 +352,20 @@
  15.148  structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
  15.149  
  15.150  val combine_numerals =
  15.151 -    prep_simproc ("nat_combine_numerals",
  15.152 -                  prep_pats ["(i::nat) + j", "Suc (i + j)"],
  15.153 -                  CombineNumerals.proc);
  15.154 +  prep_simproc ("nat_combine_numerals", ["(i::nat) + j", "Suc (i + j)"], CombineNumerals.proc);
  15.155  
  15.156  
  15.157  (*** Applying CancelNumeralFactorFun ***)
  15.158  
  15.159  structure CancelNumeralFactorCommon =
  15.160    struct
  15.161 -  val mk_coeff		= mk_coeff
  15.162 -  val dest_coeff	= dest_coeff
  15.163 +  val mk_coeff          = mk_coeff
  15.164 +  val dest_coeff        = dest_coeff
  15.165    val trans_tac         = trans_tac
  15.166 -  val norm_tac = ALLGOALS 
  15.167 +  val norm_tac = ALLGOALS
  15.168                      (simp_tac (HOL_ss addsimps [Suc_eq_add_numeral_1]@mult_1s))
  15.169                   THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@mult_ac))
  15.170 -  val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps bin_simps))
  15.171 +  val numeral_simp_tac  = ALLGOALS (simp_tac (HOL_ss addsimps bin_simps))
  15.172    val simplify_meta_eq  = simplify_meta_eq
  15.173    end
  15.174  
  15.175 @@ -408,19 +405,19 @@
  15.176    val neg_exchanges = true
  15.177  )
  15.178  
  15.179 -val cancel_numeral_factors = 
  15.180 +val cancel_numeral_factors =
  15.181    map prep_simproc
  15.182     [("nateq_cancel_numeral_factors",
  15.183 -     prep_pats ["(l::nat) * m = n", "(l::nat) = m * n"], 
  15.184 +     ["(l::nat) * m = n", "(l::nat) = m * n"],
  15.185       EqCancelNumeralFactor.proc),
  15.186 -    ("natless_cancel_numeral_factors", 
  15.187 -     prep_pats ["(l::nat) * m < n", "(l::nat) < m * n"], 
  15.188 +    ("natless_cancel_numeral_factors",
  15.189 +     ["(l::nat) * m < n", "(l::nat) < m * n"],
  15.190       LessCancelNumeralFactor.proc),
  15.191 -    ("natle_cancel_numeral_factors", 
  15.192 -     prep_pats ["(l::nat) * m <= n", "(l::nat) <= m * n"], 
  15.193 +    ("natle_cancel_numeral_factors",
  15.194 +     ["(l::nat) * m <= n", "(l::nat) <= m * n"],
  15.195       LeCancelNumeralFactor.proc),
  15.196 -    ("natdiv_cancel_numeral_factors", 
  15.197 -     prep_pats ["((l::nat) * m) div n", "(l::nat) div (m * n)"], 
  15.198 +    ("natdiv_cancel_numeral_factors",
  15.199 +     ["((l::nat) * m) div n", "(l::nat) div (m * n)"],
  15.200       DivCancelNumeralFactor.proc)];
  15.201  
  15.202  
  15.203 @@ -432,24 +429,24 @@
  15.204    | long_mk_prod (t :: ts) = mk_times (t, mk_prod ts);
  15.205  
  15.206  (*Find first term that matches u*)
  15.207 -fun find_first past u []         = raise TERM("find_first", []) 
  15.208 +fun find_first past u []         = raise TERM("find_first", [])
  15.209    | find_first past u (t::terms) =
  15.210 -	if u aconv t then (rev past @ terms)
  15.211 +        if u aconv t then (rev past @ terms)
  15.212          else find_first (t::past) u terms
  15.213 -	handle TERM _ => find_first (t::past) u terms;
  15.214 +        handle TERM _ => find_first (t::past) u terms;
  15.215  
  15.216  (*Final simplification: cancel + and *  *)
  15.217 -fun cancel_simplify_meta_eq cancel_th th = 
  15.218 -    Int_Numeral_Simprocs.simplify_meta_eq  [zmult_1, zmult_1_right] 
  15.219 +fun cancel_simplify_meta_eq cancel_th th =
  15.220 +    Int_Numeral_Simprocs.simplify_meta_eq  [zmult_1, zmult_1_right]
  15.221          (([th, cancel_th]) MRS trans);
  15.222  
  15.223  structure CancelFactorCommon =
  15.224    struct
  15.225 -  val mk_sum    	= long_mk_prod
  15.226 -  val dest_sum		= dest_prod
  15.227 -  val mk_coeff		= mk_coeff
  15.228 -  val dest_coeff	= dest_coeff
  15.229 -  val find_first	= find_first []
  15.230 +  val mk_sum            = long_mk_prod
  15.231 +  val dest_sum          = dest_prod
  15.232 +  val mk_coeff          = mk_coeff
  15.233 +  val dest_coeff        = dest_coeff
  15.234 +  val find_first        = find_first []
  15.235    val trans_tac         = trans_tac
  15.236    val norm_tac = ALLGOALS (simp_tac (HOL_ss addsimps mult_1s@mult_ac))
  15.237    end;
  15.238 @@ -486,19 +483,19 @@
  15.239    val simplify_meta_eq  = cancel_simplify_meta_eq nat_mult_div_cancel_disj
  15.240  );
  15.241  
  15.242 -val cancel_factor = 
  15.243 +val cancel_factor =
  15.244    map prep_simproc
  15.245     [("nat_eq_cancel_factor",
  15.246 -     prep_pats ["(l::nat) * m = n", "(l::nat) = m * n"], 
  15.247 +     ["(l::nat) * m = n", "(l::nat) = m * n"],
  15.248       EqCancelFactor.proc),
  15.249      ("nat_less_cancel_factor",
  15.250 -     prep_pats ["(l::nat) * m < n", "(l::nat) < m * n"], 
  15.251 +     ["(l::nat) * m < n", "(l::nat) < m * n"],
  15.252       LessCancelFactor.proc),
  15.253      ("nat_le_cancel_factor",
  15.254 -     prep_pats ["(l::nat) * m <= n", "(l::nat) <= m * n"], 
  15.255 +     ["(l::nat) * m <= n", "(l::nat) <= m * n"],
  15.256       LeCancelFactor.proc),
  15.257 -    ("nat_divide_cancel_factor", 
  15.258 -     prep_pats ["((l::nat) * m) div n", "(l::nat) div (m * n)"], 
  15.259 +    ("nat_divide_cancel_factor",
  15.260 +     ["((l::nat) * m) div n", "(l::nat) div (m * n)"],
  15.261       DivideCancelFactor.proc)];
  15.262  
  15.263  end;
  15.264 @@ -576,22 +573,22 @@
  15.265  
  15.266  (*cancel_factor*)
  15.267  test "x*k = k*(y::nat)";
  15.268 -test "k = k*(y::nat)"; 
  15.269 +test "k = k*(y::nat)";
  15.270  test "a*(b*c) = (b::nat)";
  15.271  test "a*(b*c) = d*(b::nat)*(x*a)";
  15.272  
  15.273  test "x*k < k*(y::nat)";
  15.274 -test "k < k*(y::nat)"; 
  15.275 +test "k < k*(y::nat)";
  15.276  test "a*(b*c) < (b::nat)";
  15.277  test "a*(b*c) < d*(b::nat)*(x*a)";
  15.278  
  15.279  test "x*k <= k*(y::nat)";
  15.280 -test "k <= k*(y::nat)"; 
  15.281 +test "k <= k*(y::nat)";
  15.282  test "a*(b*c) <= (b::nat)";
  15.283  test "a*(b*c) <= d*(b::nat)*(x*a)";
  15.284  
  15.285  test "(x*k) div (k*(y::nat)) = (uu::nat)";
  15.286 -test "(k) div (k*(y::nat)) = (uu::nat)"; 
  15.287 +test "(k) div (k*(y::nat)) = (uu::nat)";
  15.288  test "(a*(b*c)) div ((b::nat)) = (uu::nat)";
  15.289  test "(a*(b*c)) div (d*(b::nat)*(x*a)) = (uu::nat)";
  15.290  *)
  15.291 @@ -603,7 +600,7 @@
  15.292  
  15.293  (* reduce contradictory <= to False *)
  15.294  val add_rules =
  15.295 -  [thm "Let_number_of", thm "Let_0", thm "Let_1", nat_0, nat_1, 
  15.296 +  [thm "Let_number_of", thm "Let_0", thm "Let_1", nat_0, nat_1,
  15.297     add_nat_number_of, diff_nat_number_of, mult_nat_number_of,
  15.298     eq_nat_number_of, less_nat_number_of, le_nat_number_of_eq_not_less,
  15.299     le_Suc_number_of,le_number_of_Suc,
    16.1 --- a/src/HOL/List.thy	Tue Aug 06 11:20:47 2002 +0200
    16.2 +++ b/src/HOL/List.thy	Tue Aug 06 11:22:05 2002 +0200
    16.3 @@ -1,7 +1,7 @@
    16.4 -(* Title:HOL/List.thy
    16.5 -   ID: $Id$
    16.6 -   Author: Tobias Nipkow
    16.7 -   Copyright 1994 TU Muenchen
    16.8 +(*  Title:      HOL/List.thy
    16.9 +    ID:         $Id$
   16.10 +    Author:     Tobias Nipkow
   16.11 +    License:    GPL (GNU GENERAL PUBLIC LICENSE)
   16.12  *)
   16.13  
   16.14  header {* The datatype of finite lists *}
   16.15 @@ -367,50 +367,50 @@
   16.16  val append1_eq_conv = thm "append1_eq_conv";
   16.17  val append_same_eq = thm "append_same_eq";
   16.18  
   16.19 -val list_eq_pattern =
   16.20 -Thm.read_cterm (Theory.sign_of (the_context ())) ("(xs::'a list) = ys",HOLogic.boolT)
   16.21 -
   16.22  fun last (cons as Const("List.list.Cons",_) $ _ $ xs) =
   16.23 -(case xs of Const("List.list.Nil",_) => cons | _ => last xs)
   16.24 -| last (Const("List.op @",_) $ _ $ ys) = last ys
   16.25 -| last t = t
   16.26 +  (case xs of Const("List.list.Nil",_) => cons | _ => last xs)
   16.27 +  | last (Const("List.op @",_) $ _ $ ys) = last ys
   16.28 +  | last t = t;
   16.29  
   16.30  fun list1 (Const("List.list.Cons",_) $ _ $ Const("List.list.Nil",_)) = true
   16.31 -| list1 _ = false
   16.32 +  | list1 _ = false;
   16.33  
   16.34  fun butlast ((cons as Const("List.list.Cons",_) $ x) $ xs) =
   16.35 -(case xs of Const("List.list.Nil",_) => xs | _ => cons $ butlast xs)
   16.36 -| butlast ((app as Const("List.op @",_) $ xs) $ ys) = app $ butlast ys
   16.37 -| butlast xs = Const("List.list.Nil",fastype_of xs)
   16.38 +  (case xs of Const("List.list.Nil",_) => xs | _ => cons $ butlast xs)
   16.39 +  | butlast ((app as Const("List.op @",_) $ xs) $ ys) = app $ butlast ys
   16.40 +  | butlast xs = Const("List.list.Nil",fastype_of xs);
   16.41  
   16.42  val rearr_tac =
   16.43 -simp_tac (HOL_basic_ss addsimps [append_assoc,append_Nil,append_Cons])
   16.44 +  simp_tac (HOL_basic_ss addsimps [append_assoc, append_Nil, append_Cons]);
   16.45  
   16.46  fun list_eq sg _ (F as (eq as Const(_,eqT)) $ lhs $ rhs) =
   16.47 -let
   16.48 -val lastl = last lhs and lastr = last rhs
   16.49 -fun rearr conv =
   16.50 -let val lhs1 = butlast lhs and rhs1 = butlast rhs
   16.51 -val Type(_,listT::_) = eqT
   16.52 -val appT = [listT,listT] ---> listT
   16.53 -val app = Const("List.op @",appT)
   16.54 -val F2 = eq $ (app$lhs1$lastl) $ (app$rhs1$lastr)
   16.55 -val ct = cterm_of sg (HOLogic.mk_Trueprop(HOLogic.mk_eq(F,F2)))
   16.56 -val thm = prove_goalw_cterm [] ct (K [rearr_tac 1])
   16.57 -handle ERROR =>
   16.58 -error("The error(s) above occurred while trying to prove " ^
   16.59 -string_of_cterm ct)
   16.60 -in Some((conv RS (thm RS trans)) RS eq_reflection) end
   16.61 +  let
   16.62 +    val lastl = last lhs and lastr = last rhs;
   16.63 +    fun rearr conv =
   16.64 +      let
   16.65 +        val lhs1 = butlast lhs and rhs1 = butlast rhs;
   16.66 +        val Type(_,listT::_) = eqT
   16.67 +        val appT = [listT,listT] ---> listT
   16.68 +        val app = Const("List.op @",appT)
   16.69 +        val F2 = eq $ (app$lhs1$lastl) $ (app$rhs1$lastr)
   16.70 +        val ct = cterm_of sg (HOLogic.mk_Trueprop(HOLogic.mk_eq(F,F2)))
   16.71 +        val thm = prove_goalw_cterm [] ct (K [rearr_tac 1])
   16.72 +          handle ERROR =>
   16.73 +            error("The error(s) above occurred while trying to prove " ^
   16.74 +              string_of_cterm ct);
   16.75 +      in Some ((conv RS (thm RS trans)) RS eq_reflection) end;
   16.76  
   16.77 -in if list1 lastl andalso list1 lastr
   16.78 - then rearr append1_eq_conv
   16.79 - else
   16.80 - if lastl aconv lastr
   16.81 - then rearr append_same_eq
   16.82 - else None
   16.83 -end
   16.84 +  in
   16.85 +    if list1 lastl andalso list1 lastr then rearr append1_eq_conv
   16.86 +    else if lastl aconv lastr then rearr append_same_eq
   16.87 +    else None
   16.88 +  end;
   16.89 +
   16.90  in
   16.91 -val list_eq_simproc = mk_simproc "list_eq" [list_eq_pattern] list_eq
   16.92 +
   16.93 +val list_eq_simproc =
   16.94 +  Simplifier.simproc (Theory.sign_of (the_context ())) "list_eq" ["(xs::'a list) = ys"] list_eq;
   16.95 +
   16.96  end;
   16.97  
   16.98  Addsimprocs [list_eq_simproc];
   16.99 @@ -1364,6 +1364,7 @@
  16.100                  drop_Cons'[of "number_of v",standard]
  16.101                  nth_Cons'[of _ _ "number_of v",standard]
  16.102  
  16.103 +
  16.104  subsection {* Characters and strings *}
  16.105  
  16.106  datatype nibble =
    17.1 --- a/src/HOL/Modelcheck/EindhovenSyn.ML	Tue Aug 06 11:20:47 2002 +0200
    17.2 +++ b/src/HOL/Modelcheck/EindhovenSyn.ML	Tue Aug 06 11:22:05 2002 +0200
    17.3 @@ -24,16 +24,9 @@
    17.4    by (rtac refl 1);
    17.5  qed "pair_eta_expand";
    17.6  
    17.7 -local
    17.8 -  val lhss = [read_cterm (sign_of thy) ("f::'a*'b=>'c", TVar (("'a", 0), []))];
    17.9 -  val rew = mk_meta_eq pair_eta_expand;
   17.10 -
   17.11 -  fun proc _ _ (Abs _) = Some rew
   17.12 -    | proc _ _ _ = None;
   17.13 -in
   17.14 -  val pair_eta_expand_proc = Simplifier.mk_simproc "pair_eta_expand" lhss proc;
   17.15 -end;
   17.16 -
   17.17 +val pair_eta_expand_proc =
   17.18 +  Simplifier.simproc (Theory.sign_of (the_context ())) "pair_eta_expand" ["f::'a*'b=>'c"]
   17.19 +  (fn _ => fn _ => fn t => case t of Abs _ => Some (mk_meta_eq pair_eta_expand) | _ => None);
   17.20  
   17.21  val Eindhoven_ss =
   17.22    simpset() addsimprocs [pair_eta_expand_proc] addsimps [Let_def];
    18.1 --- a/src/HOL/Modelcheck/MuckeSyn.ML	Tue Aug 06 11:20:47 2002 +0200
    18.2 +++ b/src/HOL/Modelcheck/MuckeSyn.ML	Tue Aug 06 11:22:05 2002 +0200
    18.3 @@ -153,16 +153,9 @@
    18.4    by (rtac refl 1);
    18.5  qed "pair_eta_expand";
    18.6  
    18.7 -local
    18.8 -  val lhss = [read_cterm (sign_of thy) ("f::'a*'b=>'c", TVar (("'a", 0), []))];
    18.9 -  val rew = mk_meta_eq pair_eta_expand;
   18.10 -
   18.11 -  fun proc _ _ (Abs _) = Some rew
   18.12 -    | proc _ _ _ = None;
   18.13 -in
   18.14 -  val pair_eta_expand_proc = Simplifier.mk_simproc "pair_eta_expand" lhss proc;
   18.15 -end;
   18.16 -
   18.17 +val pair_eta_expand_proc =
   18.18 +  Simplifier.simproc (Theory.sign_of (the_context ())) "pair_eta_expand" ["f::'a*'b=>'c"]
   18.19 +  (fn _ => fn _ => fn t => case t of Abs _ => Some (mk_meta_eq pair_eta_expand) | _ => None);
   18.20  
   18.21  val Mucke_ss = simpset() addsimprocs [pair_eta_expand_proc] addsimps [Let_def];
   18.22  
    19.1 --- a/src/HOL/Product_Type.thy	Tue Aug 06 11:20:47 2002 +0200
    19.2 +++ b/src/HOL/Product_Type.thy	Tue Aug 06 11:22:05 2002 +0200
    19.3 @@ -29,13 +29,11 @@
    19.4  *}
    19.5  
    19.6  ML_setup {*
    19.7 -  local
    19.8 -    val unit_pat = Thm.cterm_of (Theory.sign_of (the_context ())) (Free ("x", HOLogic.unitT));
    19.9 -    val unit_meta_eq = standard (mk_meta_eq (thm "unit_eq"));
   19.10 -    fun proc _ _ t =
   19.11 -      if HOLogic.is_unit t then None
   19.12 -      else Some unit_meta_eq
   19.13 -  in val unit_eq_proc = Simplifier.mk_simproc "unit_eq" [unit_pat] proc end;
   19.14 +  val unit_eq_proc =
   19.15 +    let val unit_meta_eq = mk_meta_eq (thm "unit_eq") in
   19.16 +      Simplifier.simproc (Theory.sign_of (the_context ())) "unit_eq" ["x::unit"]
   19.17 +      (fn _ => fn _ => fn t => if HOLogic.is_unit t then None else Some unit_meta_eq)
   19.18 +    end;
   19.19  
   19.20    Addsimprocs [unit_eq_proc];
   19.21  *}
   19.22 @@ -341,12 +339,7 @@
   19.23    fun metaeq sg lhs rhs = mk_meta_eq (prove_goalw_cterm []
   19.24          (cterm_of sg (HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs,rhs))))
   19.25          (K [simp_tac (HOL_basic_ss addsimps [cond_split_eta]) 1]));
   19.26 -  val sign = sign_of (the_context ());
   19.27 -  fun simproc name patstr =
   19.28 -    Simplifier.mk_simproc name [HOLogic.read_cterm sign patstr];
   19.29  
   19.30 -  val beta_patstr = "split f z";
   19.31 -  val  eta_patstr = "split f";
   19.32    fun beta_term_pat k i (Abs (_, _, t)) = beta_term_pat (k+1) i t
   19.33    |   beta_term_pat k i (t $ u) = Pair_pat k i (t $ u) orelse
   19.34                          (beta_term_pat k i t andalso beta_term_pat k i u)
   19.35 @@ -368,8 +361,10 @@
   19.36          | None => None)
   19.37    |   eta_proc _ _ _ = None;
   19.38  in
   19.39 -  val split_beta_proc = simproc "split_beta" beta_patstr beta_proc;
   19.40 -  val split_eta_proc  = simproc "split_eta"   eta_patstr  eta_proc;
   19.41 +  val split_beta_proc = Simplifier.simproc (Theory.sign_of (the_context ()))
   19.42 +    "split_beta" ["split f z"] beta_proc;
   19.43 +  val split_eta_proc = Simplifier.simproc (Theory.sign_of (the_context ()))
   19.44 +    "split_eta" ["split f"] eta_proc;
   19.45  end;
   19.46  
   19.47  Addsimprocs [split_beta_proc, split_eta_proc];
    20.1 --- a/src/HOL/Real/RealArith0.ML	Tue Aug 06 11:20:47 2002 +0200
    20.2 +++ b/src/HOL/Real/RealArith0.ML	Tue Aug 06 11:22:05 2002 +0200
    20.3 @@ -9,50 +9,50 @@
    20.4  *)
    20.5  
    20.6  Goal "x - - y = x + (y::real)";
    20.7 -by (Simp_tac 1); 
    20.8 +by (Simp_tac 1);
    20.9  qed "real_diff_minus_eq";
   20.10  Addsimps [real_diff_minus_eq];
   20.11  
   20.12  (** Division and inverse **)
   20.13  
   20.14  Goal "0/x = (0::real)";
   20.15 -by (simp_tac (simpset() addsimps [real_divide_def]) 1); 
   20.16 +by (simp_tac (simpset() addsimps [real_divide_def]) 1);
   20.17  qed "real_0_divide";
   20.18  Addsimps [real_0_divide];
   20.19  
   20.20  Goal "((0::real) < inverse x) = (0 < x)";
   20.21  by (case_tac "x=0" 1);
   20.22 -by (asm_simp_tac (HOL_ss addsimps [INVERSE_ZERO]) 1); 
   20.23 -by (auto_tac (claset() addDs [real_inverse_less_0], 
   20.24 -              simpset() addsimps [linorder_neq_iff, real_inverse_gt_0]));  
   20.25 +by (asm_simp_tac (HOL_ss addsimps [INVERSE_ZERO]) 1);
   20.26 +by (auto_tac (claset() addDs [real_inverse_less_0],
   20.27 +              simpset() addsimps [linorder_neq_iff, real_inverse_gt_0]));
   20.28  qed "real_0_less_inverse_iff";
   20.29  Addsimps [real_0_less_inverse_iff];
   20.30  
   20.31  Goal "(inverse x < (0::real)) = (x < 0)";
   20.32  by (case_tac "x=0" 1);
   20.33 -by (asm_simp_tac (HOL_ss addsimps [INVERSE_ZERO]) 1); 
   20.34 -by (auto_tac (claset() addDs [real_inverse_less_0], 
   20.35 -              simpset() addsimps [linorder_neq_iff, real_inverse_gt_0]));  
   20.36 +by (asm_simp_tac (HOL_ss addsimps [INVERSE_ZERO]) 1);
   20.37 +by (auto_tac (claset() addDs [real_inverse_less_0],
   20.38 +              simpset() addsimps [linorder_neq_iff, real_inverse_gt_0]));
   20.39  qed "real_inverse_less_0_iff";
   20.40  Addsimps [real_inverse_less_0_iff];
   20.41  
   20.42  Goal "((0::real) <= inverse x) = (0 <= x)";
   20.43 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); 
   20.44 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
   20.45  qed "real_0_le_inverse_iff";
   20.46  Addsimps [real_0_le_inverse_iff];
   20.47  
   20.48  Goal "(inverse x <= (0::real)) = (x <= 0)";
   20.49 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1); 
   20.50 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym]) 1);
   20.51  qed "real_inverse_le_0_iff";
   20.52  Addsimps [real_inverse_le_0_iff];
   20.53  
   20.54  Goalw [real_divide_def] "x/(0::real) = 0";
   20.55 -by (stac INVERSE_ZERO 1); 
   20.56 -by (Simp_tac 1); 
   20.57 +by (stac INVERSE_ZERO 1);
   20.58 +by (Simp_tac 1);
   20.59  qed "REAL_DIVIDE_ZERO";
   20.60  
   20.61  Goal "inverse (x::real) = 1/x";
   20.62 -by (simp_tac (simpset() addsimps [real_divide_def]) 1); 
   20.63 +by (simp_tac (simpset() addsimps [real_divide_def]) 1);
   20.64  qed "real_inverse_eq_divide";
   20.65  
   20.66  Goal "((0::real) < x/y) = (0 < x & 0 < y | x < 0 & y < 0)";
   20.67 @@ -67,31 +67,31 @@
   20.68  
   20.69  Goal "((0::real) <= x/y) = ((x <= 0 | 0 <= y) & (0 <= x | y <= 0))";
   20.70  by (simp_tac (simpset() addsimps [real_divide_def, real_0_le_mult_iff]) 1);
   20.71 -by Auto_tac;  
   20.72 +by Auto_tac;
   20.73  qed "real_0_le_divide_iff";
   20.74  Addsimps [inst "x" "number_of ?w" real_0_le_divide_iff];
   20.75  
   20.76  Goal "(x/y <= (0::real)) = ((x <= 0 | y <= 0) & (0 <= x | 0 <= y))";
   20.77  by (simp_tac (simpset() addsimps [real_divide_def, real_mult_le_0_iff]) 1);
   20.78 -by Auto_tac;  
   20.79 +by Auto_tac;
   20.80  qed "real_divide_le_0_iff";
   20.81  Addsimps [inst "x" "number_of ?w" real_divide_le_0_iff];
   20.82  
   20.83  Goal "(inverse(x::real) = 0) = (x = 0)";
   20.84 -by (auto_tac (claset(), simpset() addsimps [INVERSE_ZERO]));  
   20.85 -by (rtac ccontr 1); 
   20.86 -by (blast_tac (claset() addDs [real_inverse_not_zero]) 1); 
   20.87 +by (auto_tac (claset(), simpset() addsimps [INVERSE_ZERO]));
   20.88 +by (rtac ccontr 1);
   20.89 +by (blast_tac (claset() addDs [real_inverse_not_zero]) 1);
   20.90  qed "real_inverse_zero_iff";
   20.91  Addsimps [real_inverse_zero_iff];
   20.92  
   20.93  Goal "(x/y = 0) = (x=0 | y=(0::real))";
   20.94 -by (auto_tac (claset(), simpset() addsimps [real_divide_def]));  
   20.95 +by (auto_tac (claset(), simpset() addsimps [real_divide_def]));
   20.96  qed "real_divide_eq_0_iff";
   20.97  Addsimps [real_divide_eq_0_iff];
   20.98  
   20.99  Goal "h ~= (0::real) ==> h/h = 1";
  20.100  by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_inv_left]) 1);
  20.101 -qed "real_divide_self_eq"; 
  20.102 +qed "real_divide_self_eq";
  20.103  Addsimps [real_divide_self_eq];
  20.104  
  20.105  
  20.106 @@ -110,19 +110,19 @@
  20.107  by (rtac (real_minus_less_minus RS iffD1) 1);
  20.108  by (auto_tac (claset(),
  20.109                simpset() delsimps [real_mult_minus_eq2]
  20.110 -                        addsimps [real_minus_mult_eq2])); 
  20.111 +                        addsimps [real_minus_mult_eq2]));
  20.112  qed "real_mult_less_mono1_neg";
  20.113  
  20.114  Goal "[| i<j;  k < (0::real) |] ==> k*j < k*i";
  20.115  by (rtac (real_minus_less_minus RS iffD1) 1);
  20.116 -by (auto_tac (claset(), 
  20.117 +by (auto_tac (claset(),
  20.118                simpset() delsimps [real_mult_minus_eq1]
  20.119 -                        addsimps [real_minus_mult_eq1])); 
  20.120 +                        addsimps [real_minus_mult_eq1]));
  20.121  qed "real_mult_less_mono2_neg";
  20.122  
  20.123  Goal "[| i <= j;  k <= (0::real) |] ==> j*k <= i*k";
  20.124 -by (auto_tac (claset(), 
  20.125 -              simpset() addsimps [order_le_less, real_mult_less_mono1_neg]));  
  20.126 +by (auto_tac (claset(),
  20.127 +              simpset() addsimps [order_le_less, real_mult_less_mono1_neg]));
  20.128  qed "real_mult_le_mono1_neg";
  20.129  
  20.130  Goal "[| i <= j;  k <= (0::real) |] ==> k*j <= k*i";
  20.131 @@ -132,56 +132,56 @@
  20.132  
  20.133  Goal "(m*k < n*k) = (((0::real) < k & m<n) | (k < 0 & n<m))";
  20.134  by (case_tac "k = (0::real)" 1);
  20.135 -by (auto_tac (claset(), 
  20.136 -              simpset() addsimps [linorder_neq_iff, 
  20.137 -                          real_mult_less_mono1, real_mult_less_mono1_neg]));  
  20.138 -by (auto_tac (claset(), 
  20.139 +by (auto_tac (claset(),
  20.140 +              simpset() addsimps [linorder_neq_iff,
  20.141 +                          real_mult_less_mono1, real_mult_less_mono1_neg]));
  20.142 +by (auto_tac (claset(),
  20.143                simpset() addsimps [linorder_not_less,
  20.144 -				  inst "y1" "m*k" (linorder_not_le RS sym),
  20.145 +                                  inst "y1" "m*k" (linorder_not_le RS sym),
  20.146                                    inst "y1" "m" (linorder_not_le RS sym)]));
  20.147  by (TRYALL (etac notE));
  20.148 -by (auto_tac (claset(), 
  20.149 +by (auto_tac (claset(),
  20.150                simpset() addsimps [order_less_imp_le, real_mult_le_mono1,
  20.151 -                                            real_mult_le_mono1_neg]));  
  20.152 +                                            real_mult_le_mono1_neg]));
  20.153  qed "real_mult_less_cancel2";
  20.154  
  20.155  Goal "(m*k <= n*k) = (((0::real) < k --> m<=n) & (k < 0 --> n<=m))";
  20.156 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym, 
  20.157 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym,
  20.158                                    real_mult_less_cancel2]) 1);
  20.159  qed "real_mult_le_cancel2";
  20.160  
  20.161  Goal "(k*m < k*n) = (((0::real) < k & m<n) | (k < 0 & n<m))";
  20.162 -by (simp_tac (simpset() addsimps [inst "z" "k" real_mult_commute, 
  20.163 +by (simp_tac (simpset() addsimps [inst "z" "k" real_mult_commute,
  20.164                                    real_mult_less_cancel2]) 1);
  20.165  qed "real_mult_less_cancel1";
  20.166  
  20.167  Goal "!!k::real. (k*m <= k*n) = ((0 < k --> m<=n) & (k < 0 --> n<=m))";
  20.168 -by (simp_tac (simpset() addsimps [linorder_not_less RS sym, 
  20.169 +by (simp_tac (simpset() addsimps [linorder_not_less RS sym,
  20.170                                    real_mult_less_cancel1]) 1);
  20.171  qed "real_mult_le_cancel1";
  20.172  
  20.173  Goal "!!k::real. (k*m = k*n) = (k = 0 | m=n)";
  20.174  by (case_tac "k=0" 1);
  20.175 -by (auto_tac (claset(), simpset() addsimps [real_mult_left_cancel]));  
  20.176 +by (auto_tac (claset(), simpset() addsimps [real_mult_left_cancel]));
  20.177  qed "real_mult_eq_cancel1";
  20.178  
  20.179  Goal "!!k::real. (m*k = n*k) = (k = 0 | m=n)";
  20.180  by (case_tac "k=0" 1);
  20.181 -by (auto_tac (claset(), simpset() addsimps [real_mult_right_cancel]));  
  20.182 +by (auto_tac (claset(), simpset() addsimps [real_mult_right_cancel]));
  20.183  qed "real_mult_eq_cancel2";
  20.184  
  20.185  Goal "!!k::real. k~=0 ==> (k*m) / (k*n) = (m/n)";
  20.186  by (asm_simp_tac
  20.187 -    (simpset() addsimps [real_divide_def, real_inverse_distrib]) 1); 
  20.188 +    (simpset() addsimps [real_divide_def, real_inverse_distrib]) 1);
  20.189  by (subgoal_tac "k * m * (inverse k * inverse n) = \
  20.190  \                (k * inverse k) * (m * inverse n)" 1);
  20.191 -by (asm_full_simp_tac (simpset() addsimps []) 1); 
  20.192 -by (asm_full_simp_tac (HOL_ss addsimps real_mult_ac) 1); 
  20.193 +by (asm_full_simp_tac (simpset() addsimps []) 1);
  20.194 +by (asm_full_simp_tac (HOL_ss addsimps real_mult_ac) 1);
  20.195  qed "real_mult_div_cancel1";
  20.196  
  20.197  (*For ExtractCommonTerm*)
  20.198  Goal "(k*m) / (k*n) = (if k = (0::real) then 0 else m/n)";
  20.199 -by (simp_tac (simpset() addsimps [real_mult_div_cancel1]) 1); 
  20.200 +by (simp_tac (simpset() addsimps [real_mult_div_cancel1]) 1);
  20.201  qed "real_mult_div_cancel_disj";
  20.202  
  20.203  
  20.204 @@ -189,19 +189,19 @@
  20.205    open Real_Numeral_Simprocs
  20.206  in
  20.207  
  20.208 -val rel_real_number_of = [eq_real_number_of, less_real_number_of, 
  20.209 +val rel_real_number_of = [eq_real_number_of, less_real_number_of,
  20.210                            le_real_number_of_eq_not_less]
  20.211  
  20.212  structure CancelNumeralFactorCommon =
  20.213    struct
  20.214 -  val mk_coeff		= mk_coeff
  20.215 -  val dest_coeff	= dest_coeff 1
  20.216 +  val mk_coeff          = mk_coeff
  20.217 +  val dest_coeff        = dest_coeff 1
  20.218    val trans_tac         = trans_tac
  20.219 -  val norm_tac = 
  20.220 +  val norm_tac =
  20.221       ALLGOALS (simp_tac (HOL_ss addsimps real_minus_from_mult_simps @ mult_1s))
  20.222       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@real_mult_minus_simps))
  20.223       THEN ALLGOALS (simp_tac (HOL_ss addsimps real_mult_ac))
  20.224 -  val numeral_simp_tac	= 
  20.225 +  val numeral_simp_tac  =
  20.226           ALLGOALS (simp_tac (HOL_ss addsimps rel_real_number_of@bin_simps))
  20.227    val simplify_meta_eq  = simplify_meta_eq
  20.228    end
  20.229 @@ -242,26 +242,26 @@
  20.230    val neg_exchanges = true
  20.231  )
  20.232  
  20.233 -val real_cancel_numeral_factors_relations = 
  20.234 +val real_cancel_numeral_factors_relations =
  20.235    map prep_simproc
  20.236     [("realeq_cancel_numeral_factor",
  20.237 -     prep_pats ["(l::real) * m = n", "(l::real) = m * n"], 
  20.238 +     ["(l::real) * m = n", "(l::real) = m * n"],
  20.239       EqCancelNumeralFactor.proc),
  20.240 -    ("realless_cancel_numeral_factor", 
  20.241 -     prep_pats ["(l::real) * m < n", "(l::real) < m * n"], 
  20.242 +    ("realless_cancel_numeral_factor",
  20.243 +     ["(l::real) * m < n", "(l::real) < m * n"],
  20.244       LessCancelNumeralFactor.proc),
  20.245 -    ("realle_cancel_numeral_factor", 
  20.246 -     prep_pats ["(l::real) * m <= n", "(l::real) <= m * n"], 
  20.247 +    ("realle_cancel_numeral_factor",
  20.248 +     ["(l::real) * m <= n", "(l::real) <= m * n"],
  20.249       LeCancelNumeralFactor.proc)]
  20.250  
  20.251  val real_cancel_numeral_factors_divide = prep_simproc
  20.252 -	("realdiv_cancel_numeral_factor", 
  20.253 -	 prep_pats ["((l::real) * m) / n", "(l::real) / (m * n)", 
  20.254 -                     "((number_of v)::real) / (number_of w)"], 
  20.255 -	 DivCancelNumeralFactor.proc)
  20.256 +        ("realdiv_cancel_numeral_factor",
  20.257 +         ["((l::real) * m) / n", "(l::real) / (m * n)",
  20.258 +          "((number_of v)::real) / (number_of w)"],
  20.259 +         DivCancelNumeralFactor.proc)
  20.260  
  20.261 -val real_cancel_numeral_factors = 
  20.262 -    real_cancel_numeral_factors_relations @ 
  20.263 +val real_cancel_numeral_factors =
  20.264 +    real_cancel_numeral_factors_relations @
  20.265      [real_cancel_numeral_factors_divide]
  20.266  
  20.267  end;
  20.268 @@ -273,7 +273,7 @@
  20.269  print_depth 22;
  20.270  set timing;
  20.271  set trace_simp;
  20.272 -fun test s = (Goal s; by (Simp_tac 1)); 
  20.273 +fun test s = (Goal s; by (Simp_tac 1));
  20.274  
  20.275  test "0 <= (y::real) * -2";
  20.276  test "9*x = 12 * (y::real)";
  20.277 @@ -315,11 +315,11 @@
  20.278  
  20.279  structure CancelFactorCommon =
  20.280    struct
  20.281 -  val mk_sum    	= long_mk_prod
  20.282 -  val dest_sum		= dest_prod
  20.283 -  val mk_coeff		= mk_coeff
  20.284 -  val dest_coeff	= dest_coeff
  20.285 -  val find_first	= find_first []
  20.286 +  val mk_sum            = long_mk_prod
  20.287 +  val dest_sum          = dest_prod
  20.288 +  val mk_coeff          = mk_coeff
  20.289 +  val dest_coeff        = dest_coeff
  20.290 +  val find_first        = find_first []
  20.291    val trans_tac         = trans_tac
  20.292    val norm_tac = ALLGOALS (simp_tac (HOL_ss addsimps mult_1s@real_mult_ac))
  20.293    end;
  20.294 @@ -341,13 +341,10 @@
  20.295    val simplify_meta_eq  = cancel_simplify_meta_eq real_mult_div_cancel_disj
  20.296  );
  20.297  
  20.298 -val real_cancel_factor = 
  20.299 +val real_cancel_factor =
  20.300    map prep_simproc
  20.301 -   [("real_eq_cancel_factor",
  20.302 -     prep_pats ["(l::real) * m = n", "(l::real) = m * n"], 
  20.303 -     EqCancelFactor.proc),
  20.304 -    ("real_divide_cancel_factor", 
  20.305 -     prep_pats ["((l::real) * m) / n", "(l::real) / (m * n)"], 
  20.306 +   [("real_eq_cancel_factor", ["(l::real) * m = n", "(l::real) = m * n"], EqCancelFactor.proc),
  20.307 +    ("real_divide_cancel_factor", ["((l::real) * m) / n", "(l::real) / (m * n)"],
  20.308       DivideCancelFactor.proc)];
  20.309  
  20.310  end;
  20.311 @@ -359,16 +356,16 @@
  20.312  print_depth 22;
  20.313  set timing;
  20.314  set trace_simp;
  20.315 -fun test s = (Goal s; by (Asm_simp_tac 1)); 
  20.316 +fun test s = (Goal s; by (Asm_simp_tac 1));
  20.317  
  20.318  test "x*k = k*(y::real)";
  20.319 -test "k = k*(y::real)"; 
  20.320 +test "k = k*(y::real)";
  20.321  test "a*(b*c) = (b::real)";
  20.322  test "a*(b*c) = d*(b::real)*(x*a)";
  20.323  
  20.324  
  20.325  test "(x*k) / (k*(y::real)) = (uu::real)";
  20.326 -test "(k) / (k*(y::real)) = (uu::real)"; 
  20.327 +test "(k) / (k*(y::real)) = (uu::real)";
  20.328  test "(a*(b*c)) / ((b::real)) = (uu::real)";
  20.329  test "(a*(b*c)) / (d*(b::real)*(x*a)) = (uu::real)";
  20.330  
  20.331 @@ -381,106 +378,106 @@
  20.332  
  20.333  Goal "0<z ==> ((x::real) <= y/z) = (x*z <= y)";
  20.334  by (subgoal_tac "(x*z <= y) = (x*z <= (y/z)*z)" 1);
  20.335 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.336 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.337  by (etac ssubst 1);
  20.338 -by (stac real_mult_le_cancel2 1); 
  20.339 -by (Asm_simp_tac 1); 
  20.340 +by (stac real_mult_le_cancel2 1);
  20.341 +by (Asm_simp_tac 1);
  20.342  qed "pos_real_le_divide_eq";
  20.343  Addsimps [inst "z" "number_of ?w" pos_real_le_divide_eq];
  20.344  
  20.345  Goal "z<0 ==> ((x::real) <= y/z) = (y <= x*z)";
  20.346  by (subgoal_tac "(y <= x*z) = ((y/z)*z <= x*z)" 1);
  20.347 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.348 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.349  by (etac ssubst 1);
  20.350 -by (stac real_mult_le_cancel2 1); 
  20.351 -by (Asm_simp_tac 1); 
  20.352 +by (stac real_mult_le_cancel2 1);
  20.353 +by (Asm_simp_tac 1);
  20.354  qed "neg_real_le_divide_eq";
  20.355  Addsimps [inst "z" "number_of ?w" neg_real_le_divide_eq];
  20.356  
  20.357  Goal "0<z ==> (y/z <= (x::real)) = (y <= x*z)";
  20.358  by (subgoal_tac "(y <= x*z) = ((y/z)*z <= x*z)" 1);
  20.359 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.360 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.361  by (etac ssubst 1);
  20.362 -by (stac real_mult_le_cancel2 1); 
  20.363 -by (Asm_simp_tac 1); 
  20.364 +by (stac real_mult_le_cancel2 1);
  20.365 +by (Asm_simp_tac 1);
  20.366  qed "pos_real_divide_le_eq";
  20.367  Addsimps [inst "z" "number_of ?w" pos_real_divide_le_eq];
  20.368  
  20.369  Goal "z<0 ==> (y/z <= (x::real)) = (x*z <= y)";
  20.370  by (subgoal_tac "(x*z <= y) = (x*z <= (y/z)*z)" 1);
  20.371 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.372 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.373  by (etac ssubst 1);
  20.374 -by (stac real_mult_le_cancel2 1); 
  20.375 -by (Asm_simp_tac 1); 
  20.376 +by (stac real_mult_le_cancel2 1);
  20.377 +by (Asm_simp_tac 1);
  20.378  qed "neg_real_divide_le_eq";
  20.379  Addsimps [inst "z" "number_of ?w" neg_real_divide_le_eq];
  20.380  
  20.381  Goal "0<z ==> ((x::real) < y/z) = (x*z < y)";
  20.382  by (subgoal_tac "(x*z < y) = (x*z < (y/z)*z)" 1);
  20.383 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.384 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.385  by (etac ssubst 1);
  20.386 -by (stac real_mult_less_cancel2 1); 
  20.387 -by (Asm_simp_tac 1); 
  20.388 +by (stac real_mult_less_cancel2 1);
  20.389 +by (Asm_simp_tac 1);
  20.390  qed "pos_real_less_divide_eq";
  20.391  Addsimps [inst "z" "number_of ?w" pos_real_less_divide_eq];
  20.392  
  20.393  Goal "z<0 ==> ((x::real) < y/z) = (y < x*z)";
  20.394  by (subgoal_tac "(y < x*z) = ((y/z)*z < x*z)" 1);
  20.395 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.396 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.397  by (etac ssubst 1);
  20.398 -by (stac real_mult_less_cancel2 1); 
  20.399 -by (Asm_simp_tac 1); 
  20.400 +by (stac real_mult_less_cancel2 1);
  20.401 +by (Asm_simp_tac 1);
  20.402  qed "neg_real_less_divide_eq";
  20.403  Addsimps [inst "z" "number_of ?w" neg_real_less_divide_eq];
  20.404  
  20.405  Goal "0<z ==> (y/z < (x::real)) = (y < x*z)";
  20.406  by (subgoal_tac "(y < x*z) = ((y/z)*z < x*z)" 1);
  20.407 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.408 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.409  by (etac ssubst 1);
  20.410 -by (stac real_mult_less_cancel2 1); 
  20.411 -by (Asm_simp_tac 1); 
  20.412 +by (stac real_mult_less_cancel2 1);
  20.413 +by (Asm_simp_tac 1);
  20.414  qed "pos_real_divide_less_eq";
  20.415  Addsimps [inst "z" "number_of ?w" pos_real_divide_less_eq];
  20.416  
  20.417  Goal "z<0 ==> (y/z < (x::real)) = (x*z < y)";
  20.418  by (subgoal_tac "(x*z < y) = (x*z < (y/z)*z)" 1);
  20.419 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.420 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.421  by (etac ssubst 1);
  20.422 -by (stac real_mult_less_cancel2 1); 
  20.423 -by (Asm_simp_tac 1); 
  20.424 +by (stac real_mult_less_cancel2 1);
  20.425 +by (Asm_simp_tac 1);
  20.426  qed "neg_real_divide_less_eq";
  20.427  Addsimps [inst "z" "number_of ?w" neg_real_divide_less_eq];
  20.428  
  20.429  Goal "z~=0 ==> ((x::real) = y/z) = (x*z = y)";
  20.430  by (subgoal_tac "(x*z = y) = (x*z = (y/z)*z)" 1);
  20.431 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.432 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.433  by (etac ssubst 1);
  20.434 -by (stac real_mult_eq_cancel2 1); 
  20.435 -by (Asm_simp_tac 1); 
  20.436 +by (stac real_mult_eq_cancel2 1);
  20.437 +by (Asm_simp_tac 1);
  20.438  qed "real_eq_divide_eq";
  20.439  Addsimps [inst "z" "number_of ?w" real_eq_divide_eq];
  20.440  
  20.441  Goal "z~=0 ==> (y/z = (x::real)) = (y = x*z)";
  20.442  by (subgoal_tac "(y = x*z) = ((y/z)*z = x*z)" 1);
  20.443 -by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2); 
  20.444 +by (asm_simp_tac (simpset() addsimps [real_divide_def, real_mult_assoc]) 2);
  20.445  by (etac ssubst 1);
  20.446 -by (stac real_mult_eq_cancel2 1); 
  20.447 -by (Asm_simp_tac 1); 
  20.448 +by (stac real_mult_eq_cancel2 1);
  20.449 +by (Asm_simp_tac 1);
  20.450  qed "real_divide_eq_eq";
  20.451  Addsimps [inst "z" "number_of ?w" real_divide_eq_eq];
  20.452  
  20.453  Goal "(m/k = n/k) = (k = 0 | m = (n::real))";
  20.454  by (case_tac "k=0" 1);
  20.455 -by (asm_simp_tac (simpset() addsimps [REAL_DIVIDE_ZERO]) 1); 
  20.456 -by (asm_simp_tac (simpset() addsimps [real_divide_eq_eq, real_eq_divide_eq, 
  20.457 -                                      real_mult_eq_cancel2]) 1); 
  20.458 +by (asm_simp_tac (simpset() addsimps [REAL_DIVIDE_ZERO]) 1);
  20.459 +by (asm_simp_tac (simpset() addsimps [real_divide_eq_eq, real_eq_divide_eq,
  20.460 +                                      real_mult_eq_cancel2]) 1);
  20.461  qed "real_divide_eq_cancel2";
  20.462  
  20.463  Goal "(k/m = k/n) = (k = 0 | m = (n::real))";
  20.464  by (case_tac "m=0 | n = 0" 1);
  20.465 -by (auto_tac (claset(), 
  20.466 -              simpset() addsimps [REAL_DIVIDE_ZERO, real_divide_eq_eq, 
  20.467 -                                  real_eq_divide_eq, real_mult_eq_cancel1]));  
  20.468 +by (auto_tac (claset(),
  20.469 +              simpset() addsimps [REAL_DIVIDE_ZERO, real_divide_eq_eq,
  20.470 +                                  real_eq_divide_eq, real_mult_eq_cancel1]));
  20.471  qed "real_divide_eq_cancel1";
  20.472  
  20.473  (*Moved from RealOrd.ML to use 0 *)
  20.474 @@ -489,53 +486,53 @@
  20.475  by (res_inst_tac [("t","r")] (real_inverse_inverse RS subst) 1);
  20.476  by (res_inst_tac [("t","x")] (real_inverse_inverse RS subst) 1);
  20.477  by (auto_tac (claset() addIs [real_inverse_less_swap],
  20.478 -	      simpset() delsimps [real_inverse_inverse]
  20.479 -			addsimps [real_inverse_gt_0]));
  20.480 +              simpset() delsimps [real_inverse_inverse]
  20.481 +                        addsimps [real_inverse_gt_0]));
  20.482  qed "real_inverse_less_iff";
  20.483  
  20.484  Goal "[| 0 < r; 0 < x|] ==> (inverse x <= inverse r) = (r <= (x::real))";
  20.485 -by (asm_simp_tac (simpset() addsimps [linorder_not_less RS sym, 
  20.486 -                                      real_inverse_less_iff]) 1); 
  20.487 +by (asm_simp_tac (simpset() addsimps [linorder_not_less RS sym,
  20.488 +                                      real_inverse_less_iff]) 1);
  20.489  qed "real_inverse_le_iff";
  20.490  
  20.491  (** Division by 1, -1 **)
  20.492  
  20.493  Goal "(x::real)/1 = x";
  20.494 -by (simp_tac (simpset() addsimps [real_divide_def]) 1); 
  20.495 +by (simp_tac (simpset() addsimps [real_divide_def]) 1);
  20.496  qed "real_divide_1";
  20.497  Addsimps [real_divide_1];
  20.498  
  20.499  Goal "x/-1 = -(x::real)";
  20.500 -by (Simp_tac 1); 
  20.501 +by (Simp_tac 1);
  20.502  qed "real_divide_minus1";
  20.503  Addsimps [real_divide_minus1];
  20.504  
  20.505  Goal "-1/(x::real) = - (1/x)";
  20.506 -by (simp_tac (simpset() addsimps [real_divide_def, real_minus_inverse]) 1); 
  20.507 +by (simp_tac (simpset() addsimps [real_divide_def, real_minus_inverse]) 1);
  20.508  qed "real_minus1_divide";
  20.509  Addsimps [real_minus1_divide];
  20.510  
  20.511  Goal "[| (0::real) < d1; 0 < d2 |] ==> EX e. 0 < e & e < d1 & e < d2";
  20.512 -by (res_inst_tac [("x","(min d1 d2)/2")] exI 1); 
  20.513 -by (asm_simp_tac (simpset() addsimps [min_def]) 1); 
  20.514 +by (res_inst_tac [("x","(min d1 d2)/2")] exI 1);
  20.515 +by (asm_simp_tac (simpset() addsimps [min_def]) 1);
  20.516  qed "real_lbound_gt_zero";
  20.517  
  20.518  Goal "(inverse x = inverse y) = (x = (y::real))";
  20.519  by (case_tac "x=0 | y=0" 1);
  20.520 -by (auto_tac (claset(), 
  20.521 -              simpset() addsimps [real_inverse_eq_divide, 
  20.522 -                                  DIVISION_BY_ZERO])); 
  20.523 -by (dres_inst_tac [("f","%u. x*y*u")] arg_cong 1); 
  20.524 -by (Asm_full_simp_tac 1); 
  20.525 +by (auto_tac (claset(),
  20.526 +              simpset() addsimps [real_inverse_eq_divide,
  20.527 +                                  DIVISION_BY_ZERO]));
  20.528 +by (dres_inst_tac [("f","%u. x*y*u")] arg_cong 1);
  20.529 +by (Asm_full_simp_tac 1);
  20.530  qed "real_inverse_eq_iff";
  20.531  Addsimps [real_inverse_eq_iff];
  20.532  
  20.533  Goal "(z/x = z/y) = (z = 0 | x = (y::real))";
  20.534  by (case_tac "x=0 | y=0" 1);
  20.535 -by (auto_tac (claset(), 
  20.536 -              simpset() addsimps [DIVISION_BY_ZERO])); 
  20.537 +by (auto_tac (claset(),
  20.538 +              simpset() addsimps [DIVISION_BY_ZERO]));
  20.539  by (dres_inst_tac [("f","%u. x*y*u")] arg_cong 1);
  20.540 -by Auto_tac;   
  20.541 +by Auto_tac;
  20.542  qed "real_divide_eq_iff";
  20.543  Addsimps [real_divide_eq_iff];
  20.544  
  20.545 @@ -545,20 +542,20 @@
  20.546  (** The next several equations can make the simplifier loop! **)
  20.547  
  20.548  Goal "(x < - y) = (y < - (x::real))";
  20.549 -by Auto_tac;  
  20.550 -qed "real_less_minus"; 
  20.551 +by Auto_tac;
  20.552 +qed "real_less_minus";
  20.553  
  20.554  Goal "(- x < y) = (- y < (x::real))";
  20.555 -by Auto_tac;  
  20.556 -qed "real_minus_less"; 
  20.557 +by Auto_tac;
  20.558 +qed "real_minus_less";
  20.559  
  20.560  Goal "(x <= - y) = (y <= - (x::real))";
  20.561 -by Auto_tac;  
  20.562 -qed "real_le_minus"; 
  20.563 +by Auto_tac;
  20.564 +qed "real_le_minus";
  20.565  
  20.566  Goal "(- x <= y) = (- y <= (x::real))";
  20.567 -by Auto_tac;  
  20.568 -qed "real_minus_le"; 
  20.569 +by Auto_tac;
  20.570 +qed "real_minus_le";
  20.571  
  20.572  Goal "(x = - y) = (y = - (x::real))";
  20.573  by Auto_tac;
  20.574 @@ -582,44 +579,44 @@
  20.575  
  20.576  (*Distributive laws for literals*)
  20.577  Addsimps (map (inst "w" "number_of ?v")
  20.578 -	  [real_add_mult_distrib, real_add_mult_distrib2,
  20.579 -	   real_diff_mult_distrib, real_diff_mult_distrib2]);
  20.580 +          [real_add_mult_distrib, real_add_mult_distrib2,
  20.581 +           real_diff_mult_distrib, real_diff_mult_distrib2]);
  20.582  
  20.583 -Addsimps (map (inst "x" "number_of ?v") 
  20.584 -	  [real_less_minus, real_le_minus, real_equation_minus]);
  20.585 -Addsimps (map (inst "y" "number_of ?v") 
  20.586 -	  [real_minus_less, real_minus_le, real_minus_equation]);
  20.587 +Addsimps (map (inst "x" "number_of ?v")
  20.588 +          [real_less_minus, real_le_minus, real_equation_minus]);
  20.589 +Addsimps (map (inst "y" "number_of ?v")
  20.590 +          [real_minus_less, real_minus_le, real_minus_equation]);
  20.591  
  20.592  (*Equations and inequations involving 1*)
  20.593 -Addsimps (map (simplify (simpset()) o inst "x" "1") 
  20.594 -	  [real_less_minus, real_le_minus, real_equation_minus]);
  20.595 -Addsimps (map (simplify (simpset()) o inst "y" "1") 
  20.596 -	  [real_minus_less, real_minus_le, real_minus_equation]);
  20.597 +Addsimps (map (simplify (simpset()) o inst "x" "1")
  20.598 +          [real_less_minus, real_le_minus, real_equation_minus]);
  20.599 +Addsimps (map (simplify (simpset()) o inst "y" "1")
  20.600 +          [real_minus_less, real_minus_le, real_minus_equation]);
  20.601  
  20.602  (*** Simprules combining x+y and 0 ***)
  20.603  
  20.604  Goal "(x+y = (0::real)) = (y = -x)";
  20.605 -by Auto_tac;  
  20.606 +by Auto_tac;
  20.607  qed "real_add_eq_0_iff";
  20.608  AddIffs [real_add_eq_0_iff];
  20.609  
  20.610  Goal "(x+y < (0::real)) = (y < -x)";
  20.611 -by Auto_tac;  
  20.612 +by Auto_tac;
  20.613  qed "real_add_less_0_iff";
  20.614  AddIffs [real_add_less_0_iff];
  20.615  
  20.616  Goal "((0::real) < x+y) = (-x < y)";
  20.617 -by Auto_tac;  
  20.618 +by Auto_tac;
  20.619  qed "real_0_less_add_iff";
  20.620  AddIffs [real_0_less_add_iff];
  20.621  
  20.622  Goal "(x+y <= (0::real)) = (y <= -x)";
  20.623 -by Auto_tac;  
  20.624 +by Auto_tac;
  20.625  qed "real_add_le_0_iff";
  20.626  AddIffs [real_add_le_0_iff];
  20.627  
  20.628  Goal "((0::real) <= x+y) = (-x <= y)";
  20.629 -by Auto_tac;  
  20.630 +by Auto_tac;
  20.631  qed "real_0_le_add_iff";
  20.632  AddIffs [real_0_le_add_iff];
  20.633  
  20.634 @@ -629,12 +626,12 @@
  20.635  **)
  20.636  
  20.637  Goal "((0::real) < x-y) = (y < x)";
  20.638 -by Auto_tac;  
  20.639 +by Auto_tac;
  20.640  qed "real_0_less_diff_iff";
  20.641  AddIffs [real_0_less_diff_iff];
  20.642  
  20.643  Goal "((0::real) <= x-y) = (y <= x)";
  20.644 -by Auto_tac;  
  20.645 +by Auto_tac;
  20.646  qed "real_0_le_diff_iff";
  20.647  AddIffs [real_0_le_diff_iff];
  20.648  
    21.1 --- a/src/HOL/Real/RealBin.ML	Tue Aug 06 11:20:47 2002 +0200
    21.2 +++ b/src/HOL/Real/RealBin.ML	Tue Aug 06 11:22:05 2002 +0200
    21.3 @@ -18,16 +18,16 @@
    21.4  qed "real_numeral_0_eq_0";
    21.5  
    21.6  Goalw [real_number_of_def] "Numeral1 = (1::real)";
    21.7 -by (stac (real_of_one RS sym) 1); 
    21.8 -by (Simp_tac 1); 
    21.9 +by (stac (real_of_one RS sym) 1);
   21.10 +by (Simp_tac 1);
   21.11  qed "real_numeral_1_eq_1";
   21.12  
   21.13  (** Addition **)
   21.14  
   21.15  Goal "(number_of v :: real) + number_of v' = number_of (bin_add v v')";
   21.16  by (simp_tac
   21.17 -    (HOL_ss addsimps [real_number_of_def, 
   21.18 -				  real_of_int_add, number_of_add]) 1);
   21.19 +    (HOL_ss addsimps [real_number_of_def,
   21.20 +                                  real_of_int_add, number_of_add]) 1);
   21.21  qed "add_real_number_of";
   21.22  
   21.23  Addsimps [add_real_number_of];
   21.24 @@ -53,7 +53,7 @@
   21.25  
   21.26  Goal "(number_of v :: real) * number_of v' = number_of (bin_mult v v')";
   21.27  by (simp_tac
   21.28 -    (HOL_ss addsimps [real_number_of_def, real_of_int_mult, 
   21.29 +    (HOL_ss addsimps [real_number_of_def, real_of_int_mult,
   21.30                        number_of_mult]) 1);
   21.31  qed "mult_real_number_of";
   21.32  
   21.33 @@ -80,8 +80,8 @@
   21.34  Goal "((number_of v :: real) = number_of v') = \
   21.35  \     iszero (number_of (bin_add v (bin_minus v')))";
   21.36  by (simp_tac
   21.37 -    (HOL_ss addsimps [real_number_of_def, 
   21.38 -	              real_of_int_inject, eq_number_of_eq]) 1);
   21.39 +    (HOL_ss addsimps [real_number_of_def,
   21.40 +                      real_of_int_inject, eq_number_of_eq]) 1);
   21.41  qed "eq_real_number_of";
   21.42  
   21.43  Addsimps [eq_real_number_of];
   21.44 @@ -92,8 +92,8 @@
   21.45  Goal "((number_of v :: real) < number_of v') = \
   21.46  \     neg (number_of (bin_add v (bin_minus v')))";
   21.47  by (simp_tac
   21.48 -    (HOL_ss addsimps [real_number_of_def, real_of_int_less_iff, 
   21.49 -				  less_number_of_eq_neg]) 1);
   21.50 +    (HOL_ss addsimps [real_number_of_def, real_of_int_less_iff,
   21.51 +                                  less_number_of_eq_neg]) 1);
   21.52  qed "less_real_number_of";
   21.53  
   21.54  Addsimps [less_real_number_of];
   21.55 @@ -104,7 +104,7 @@
   21.56  Goal "(number_of x <= (number_of y::real)) = \
   21.57  \     (~ number_of y < (number_of x::real))";
   21.58  by (rtac (linorder_not_less RS sym) 1);
   21.59 -qed "le_real_number_of_eq_not_less"; 
   21.60 +qed "le_real_number_of_eq_not_less";
   21.61  
   21.62  Addsimps [le_real_number_of_eq_not_less];
   21.63  
   21.64 @@ -115,7 +115,7 @@
   21.65  qed "real_minus_1_eq_m1";
   21.66  
   21.67  Goal "-1 * z = -(z::real)";
   21.68 -by (simp_tac (simpset() addsimps [real_minus_1_eq_m1 RS sym, 
   21.69 +by (simp_tac (simpset() addsimps [real_minus_1_eq_m1 RS sym,
   21.70                                    real_mult_minus_1]) 1);
   21.71  qed "real_mult_minus1";
   21.72  
   21.73 @@ -127,24 +127,24 @@
   21.74  
   21.75  
   21.76  (*Maps 0 to Numeral0 and 1 to Numeral1 and -(Numeral1) to -1*)
   21.77 -val real_numeral_ss = 
   21.78 -    HOL_ss addsimps [real_numeral_0_eq_0 RS sym, real_numeral_1_eq_1 RS sym, 
   21.79 -		     real_minus_1_eq_m1];
   21.80 +val real_numeral_ss =
   21.81 +    HOL_ss addsimps [real_numeral_0_eq_0 RS sym, real_numeral_1_eq_1 RS sym,
   21.82 +                     real_minus_1_eq_m1];
   21.83  
   21.84 -fun rename_numerals th = 
   21.85 +fun rename_numerals th =
   21.86      asm_full_simplify real_numeral_ss (Thm.transfer (the_context ()) th);
   21.87  
   21.88  
   21.89  (** real from type "nat" **)
   21.90  
   21.91  Goal "(0 < real (n::nat)) = (0<n)";
   21.92 -by (simp_tac (HOL_ss addsimps [real_of_nat_less_iff, 
   21.93 +by (simp_tac (HOL_ss addsimps [real_of_nat_less_iff,
   21.94                                 real_of_nat_zero RS sym]) 1);
   21.95  qed "zero_less_real_of_nat_iff";
   21.96  AddIffs [zero_less_real_of_nat_iff];
   21.97  
   21.98  Goal "(0 <= real (n::nat)) = (0<=n)";
   21.99 -by (simp_tac (HOL_ss addsimps [real_of_nat_le_iff, 
  21.100 +by (simp_tac (HOL_ss addsimps [real_of_nat_le_iff,
  21.101                                 real_of_nat_zero RS sym]) 1);
  21.102  qed "zero_le_real_of_nat_iff";
  21.103  AddIffs [zero_le_real_of_nat_iff];
  21.104 @@ -156,7 +156,7 @@
  21.105  (** Simplification of arithmetic when nested to the right **)
  21.106  
  21.107  Goal "number_of v + (number_of w + z) = (number_of(bin_add v w) + z::real)";
  21.108 -by Auto_tac; 
  21.109 +by Auto_tac;
  21.110  qed "real_add_number_of_left";
  21.111  
  21.112  Goal "number_of v * (number_of w * z) = (number_of(bin_mult v w) * z::real)";
  21.113 @@ -175,7 +175,7 @@
  21.114  qed "real_add_number_of_diff2";
  21.115  
  21.116  Addsimps [real_add_number_of_left, real_mult_number_of_left,
  21.117 -	  real_add_number_of_diff1, real_add_number_of_diff2]; 
  21.118 +          real_add_number_of_diff1, real_add_number_of_diff2];
  21.119  
  21.120  
  21.121  (*"neg" is used in rewrite rules for binary comparisons*)
  21.122 @@ -195,15 +195,15 @@
  21.123  (** Combining of literal coefficients in sums of products **)
  21.124  
  21.125  Goal "(x < y) = (x-y < (0::real))";
  21.126 -by (simp_tac (simpset() addsimps [real_diff_less_eq]) 1);   
  21.127 +by (simp_tac (simpset() addsimps [real_diff_less_eq]) 1);
  21.128  qed "real_less_iff_diff_less_0";
  21.129  
  21.130  Goal "(x = y) = (x-y = (0::real))";
  21.131 -by (simp_tac (simpset() addsimps [real_diff_eq_eq]) 1);   
  21.132 +by (simp_tac (simpset() addsimps [real_diff_eq_eq]) 1);
  21.133  qed "real_eq_iff_diff_eq_0";
  21.134  
  21.135  Goal "(x <= y) = (x-y <= (0::real))";
  21.136 -by (simp_tac (simpset() addsimps [real_diff_le_eq]) 1);   
  21.137 +by (simp_tac (simpset() addsimps [real_diff_le_eq]) 1);
  21.138  qed "real_le_iff_diff_le_0";
  21.139  
  21.140  
  21.141 @@ -217,15 +217,15 @@
  21.142  (** For cancel_numerals **)
  21.143  
  21.144  val rel_iff_rel_0_rls = map (inst "y" "?u+?v")
  21.145 -                          [real_less_iff_diff_less_0, real_eq_iff_diff_eq_0, 
  21.146 -			   real_le_iff_diff_le_0] @
  21.147 -		        map (inst "y" "n")
  21.148 -                          [real_less_iff_diff_less_0, real_eq_iff_diff_eq_0, 
  21.149 -			   real_le_iff_diff_le_0];
  21.150 +                          [real_less_iff_diff_less_0, real_eq_iff_diff_eq_0,
  21.151 +                           real_le_iff_diff_le_0] @
  21.152 +                        map (inst "y" "n")
  21.153 +                          [real_less_iff_diff_less_0, real_eq_iff_diff_eq_0,
  21.154 +                           real_le_iff_diff_le_0];
  21.155  
  21.156  Goal "!!i::real. (i*u + m = j*u + n) = ((i-j)*u + m = n)";
  21.157  by (asm_simp_tac (simpset() addsimps [real_diff_def, real_add_mult_distrib]@
  21.158 -		                     real_add_ac@rel_iff_rel_0_rls) 1);
  21.159 +                                     real_add_ac@rel_iff_rel_0_rls) 1);
  21.160  qed "real_eq_add_iff1";
  21.161  
  21.162  Goal "!!i::real. (i*u + m = j*u + n) = (m = (j-i)*u + n)";
  21.163 @@ -294,7 +294,7 @@
  21.164    | dest_summing (pos, Const ("op -", _) $ t $ u, ts) =
  21.165          dest_summing (pos, t, dest_summing (not pos, u, ts))
  21.166    | dest_summing (pos, t, ts) =
  21.167 -	if pos then t::ts else uminus_const$t :: ts;
  21.168 +        if pos then t::ts else uminus_const$t :: ts;
  21.169  
  21.170  fun dest_sum t = dest_summing (true, t, []);
  21.171  
  21.172 @@ -312,29 +312,29 @@
  21.173  val dest_times = HOLogic.dest_bin "op *" HOLogic.realT;
  21.174  
  21.175  fun dest_prod t =
  21.176 -      let val (t,u) = dest_times t 
  21.177 +      let val (t,u) = dest_times t
  21.178        in  dest_prod t @ dest_prod u  end
  21.179        handle TERM _ => [t];
  21.180  
  21.181 -(*DON'T do the obvious simplifications; that would create special cases*) 
  21.182 +(*DON'T do the obvious simplifications; that would create special cases*)
  21.183  fun mk_coeff (k, ts) = mk_times (mk_numeral k, ts);
  21.184  
  21.185  (*Express t as a product of (possibly) a numeral with other sorted terms*)
  21.186  fun dest_coeff sign (Const ("uminus", _) $ t) = dest_coeff (~sign) t
  21.187    | dest_coeff sign t =
  21.188      let val ts = sort Term.term_ord (dest_prod t)
  21.189 -	val (n, ts') = find_first_numeral [] ts
  21.190 +        val (n, ts') = find_first_numeral [] ts
  21.191                            handle TERM _ => (1, ts)
  21.192      in (sign*n, mk_prod ts') end;
  21.193  
  21.194  (*Find first coefficient-term THAT MATCHES u*)
  21.195 -fun find_first_coeff past u [] = raise TERM("find_first_coeff", []) 
  21.196 +fun find_first_coeff past u [] = raise TERM("find_first_coeff", [])
  21.197    | find_first_coeff past u (t::terms) =
  21.198 -	let val (n,u') = dest_coeff 1 t
  21.199 -	in  if u aconv u' then (n, rev past @ terms)
  21.200 -			  else find_first_coeff (t::past) u terms
  21.201 -	end
  21.202 -	handle TERM _ => find_first_coeff (t::past) u terms;
  21.203 +        let val (n,u') = dest_coeff 1 t
  21.204 +        in  if u aconv u' then (n, rev past @ terms)
  21.205 +                          else find_first_coeff (t::past) u terms
  21.206 +        end
  21.207 +        handle TERM _ => find_first_coeff (t::past) u terms;
  21.208  
  21.209  
  21.210  (*Simplify Numeral0+n, n+Numeral0, Numeral1*n, n*Numeral1*)
  21.211 @@ -345,27 +345,27 @@
  21.212  (*To perform binary arithmetic*)
  21.213  val bin_simps =
  21.214      [real_numeral_0_eq_0 RS sym, real_numeral_1_eq_1 RS sym,
  21.215 -     add_real_number_of, real_add_number_of_left, minus_real_number_of, 
  21.216 -     diff_real_number_of, mult_real_number_of, real_mult_number_of_left] @ 
  21.217 +     add_real_number_of, real_add_number_of_left, minus_real_number_of,
  21.218 +     diff_real_number_of, mult_real_number_of, real_mult_number_of_left] @
  21.219      bin_arith_simps @ bin_rel_simps;
  21.220  
  21.221  (*To evaluate binary negations of coefficients*)
  21.222  val real_minus_simps = NCons_simps @
  21.223 -                   [real_minus_1_eq_m1, minus_real_number_of, 
  21.224 -		    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
  21.225 -		    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
  21.226 +                   [real_minus_1_eq_m1, minus_real_number_of,
  21.227 +                    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
  21.228 +                    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
  21.229  
  21.230  (*To let us treat subtraction as addition*)
  21.231  val diff_simps = [real_diff_def, real_minus_add_distrib, real_minus_minus];
  21.232  
  21.233  (*push the unary minus down: - x * y = x * - y
  21.234 -val real_minus_mult_eq_1_to_2 = 
  21.235 +val real_minus_mult_eq_1_to_2 =
  21.236      [real_minus_mult_eq1 RS sym, real_minus_mult_eq2] MRS trans |> standard;
  21.237  same as real_minus_mult_commute
  21.238  *)
  21.239  
  21.240  (*to extract again any uncancelled minuses*)
  21.241 -val real_minus_from_mult_simps = 
  21.242 +val real_minus_from_mult_simps =
  21.243      [real_minus_minus, real_mult_minus_eq1, real_mult_minus_eq2];
  21.244  
  21.245  (*combine unary minus with numeric literals, however nested within a product*)
  21.246 @@ -382,40 +382,39 @@
  21.247    let val ct = cterm_of sg (HOLogic.mk_Trueprop (HOLogic.mk_eq (t, u)))
  21.248    in Some
  21.249       (prove_goalw_cterm [] ct (K tacs)
  21.250 -      handle ERROR => error 
  21.251 -	  ("The error(s) above occurred while trying to prove " ^
  21.252 -	   string_of_cterm ct ^ "\nInternal failure of simproc " ^ name))
  21.253 +      handle ERROR => error
  21.254 +          ("The error(s) above occurred while trying to prove " ^
  21.255 +           string_of_cterm ct ^ "\nInternal failure of simproc " ^ name))
  21.256    end;
  21.257  
  21.258  (*version without the hyps argument*)
  21.259  fun prove_conv_nohyps name tacs sg = prove_conv name tacs sg [];
  21.260  
  21.261  (*Final simplification: cancel + and *  *)
  21.262 -val simplify_meta_eq = 
  21.263 +val simplify_meta_eq =
  21.264      Int_Numeral_Simprocs.simplify_meta_eq
  21.265           [real_add_zero_left, real_add_zero_right,
  21.266 - 	  real_mult_0, real_mult_0_right, real_mult_1, real_mult_1_right];
  21.267 +          real_mult_0, real_mult_0_right, real_mult_1, real_mult_1_right];
  21.268  
  21.269 -fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
  21.270 -fun prep_pat s = HOLogic.read_cterm (Theory.sign_of (the_context ())) s;
  21.271 -val prep_pats = map prep_pat;
  21.272 +fun prep_simproc (name, pats, proc) =
  21.273 +  Simplifier.simproc (Theory.sign_of (the_context ())) name pats proc;
  21.274  
  21.275  structure CancelNumeralsCommon =
  21.276    struct
  21.277 -  val mk_sum    	= mk_sum
  21.278 -  val dest_sum		= dest_sum
  21.279 -  val mk_coeff		= mk_coeff
  21.280 -  val dest_coeff	= dest_coeff 1
  21.281 -  val find_first_coeff	= find_first_coeff []
  21.282 +  val mk_sum            = mk_sum
  21.283 +  val dest_sum          = dest_sum
  21.284 +  val mk_coeff          = mk_coeff
  21.285 +  val dest_coeff        = dest_coeff 1
  21.286 +  val find_first_coeff  = find_first_coeff []
  21.287    val trans_tac         = trans_tac
  21.288 -  val norm_tac = 
  21.289 +  val norm_tac =
  21.290       ALLGOALS (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
  21.291                                           real_minus_simps@real_add_ac))
  21.292       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@real_mult_minus_simps))
  21.293       THEN ALLGOALS
  21.294                (simp_tac (HOL_ss addsimps real_minus_from_mult_simps@
  21.295                                           real_add_ac@real_mult_ac))
  21.296 -  val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
  21.297 +  val numeral_simp_tac  = ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
  21.298    val simplify_meta_eq  = simplify_meta_eq
  21.299    end;
  21.300  
  21.301 @@ -447,53 +446,51 @@
  21.302    val bal_add2 = real_le_add_iff2 RS trans
  21.303  );
  21.304  
  21.305 -val cancel_numerals = 
  21.306 +val cancel_numerals =
  21.307    map prep_simproc
  21.308     [("realeq_cancel_numerals",
  21.309 -     prep_pats ["(l::real) + m = n", "(l::real) = m + n", 
  21.310 -		"(l::real) - m = n", "(l::real) = m - n", 
  21.311 -		"(l::real) * m = n", "(l::real) = m * n"], 
  21.312 +     ["(l::real) + m = n", "(l::real) = m + n",
  21.313 +      "(l::real) - m = n", "(l::real) = m - n",
  21.314 +      "(l::real) * m = n", "(l::real) = m * n"],
  21.315       EqCancelNumerals.proc),
  21.316 -    ("realless_cancel_numerals", 
  21.317 -     prep_pats ["(l::real) + m < n", "(l::real) < m + n", 
  21.318 -		"(l::real) - m < n", "(l::real) < m - n", 
  21.319 -		"(l::real) * m < n", "(l::real) < m * n"], 
  21.320 +    ("realless_cancel_numerals",
  21.321 +     ["(l::real) + m < n", "(l::real) < m + n",
  21.322 +      "(l::real) - m < n", "(l::real) < m - n",
  21.323 +      "(l::real) * m < n", "(l::real) < m * n"],
  21.324       LessCancelNumerals.proc),
  21.325 -    ("realle_cancel_numerals", 
  21.326 -     prep_pats ["(l::real) + m <= n", "(l::real) <= m + n", 
  21.327 -		"(l::real) - m <= n", "(l::real) <= m - n", 
  21.328 -		"(l::real) * m <= n", "(l::real) <= m * n"], 
  21.329 +    ("realle_cancel_numerals",
  21.330 +     ["(l::real) + m <= n", "(l::real) <= m + n",
  21.331 +      "(l::real) - m <= n", "(l::real) <= m - n",
  21.332 +      "(l::real) * m <= n", "(l::real) <= m * n"],
  21.333       LeCancelNumerals.proc)];
  21.334  
  21.335  
  21.336  structure CombineNumeralsData =
  21.337    struct
  21.338 -  val add		= op + : int*int -> int 
  21.339 -  val mk_sum    	= long_mk_sum    (*to work for e.g. 2*x + 3*x *)
  21.340 -  val dest_sum		= dest_sum
  21.341 -  val mk_coeff		= mk_coeff
  21.342 -  val dest_coeff	= dest_coeff 1
  21.343 -  val left_distrib	= left_real_add_mult_distrib RS trans
  21.344 -  val prove_conv	= prove_conv_nohyps "real_combine_numerals"
  21.345 +  val add               = op + : int*int -> int
  21.346 +  val mk_sum            = long_mk_sum    (*to work for e.g. 2*x + 3*x *)
  21.347 +  val dest_sum          = dest_sum
  21.348 +  val mk_coeff          = mk_coeff
  21.349 +  val dest_coeff        = dest_coeff 1
  21.350 +  val left_distrib      = left_real_add_mult_distrib RS trans
  21.351 +  val prove_conv        = prove_conv_nohyps "real_combine_numerals"
  21.352    val trans_tac         = trans_tac
  21.353 -  val norm_tac = 
  21.354 +  val norm_tac =
  21.355       ALLGOALS (simp_tac (HOL_ss addsimps numeral_syms@add_0s@mult_1s@
  21.356                                     diff_simps@real_minus_simps@real_add_ac))
  21.357       THEN ALLGOALS (simp_tac (HOL_ss addsimps bin_simps@real_mult_minus_simps))
  21.358       THEN ALLGOALS (simp_tac (HOL_ss addsimps real_minus_from_mult_simps@
  21.359                                                real_add_ac@real_mult_ac))
  21.360 -  val numeral_simp_tac	= ALLGOALS 
  21.361 +  val numeral_simp_tac  = ALLGOALS
  21.362                      (simp_tac (HOL_ss addsimps add_0s@bin_simps))
  21.363 -  val simplify_meta_eq  = 
  21.364 -	Int_Numeral_Simprocs.simplify_meta_eq (add_0s@mult_1s)
  21.365 +  val simplify_meta_eq  =
  21.366 +        Int_Numeral_Simprocs.simplify_meta_eq (add_0s@mult_1s)
  21.367    end;
  21.368  
  21.369  structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
  21.370 -  
  21.371 -val combine_numerals = 
  21.372 -    prep_simproc ("real_combine_numerals",
  21.373 -		  prep_pats ["(i::real) + j", "(i::real) - j"],
  21.374 -		  CombineNumerals.proc);
  21.375 +
  21.376 +val combine_numerals =
  21.377 +  prep_simproc ("real_combine_numerals", ["(i::real) + j", "(i::real) - j"], CombineNumerals.proc);
  21.378  
  21.379  
  21.380  (** Declarations for ExtractCommonTerm **)
  21.381 @@ -503,16 +500,16 @@
  21.382    | long_mk_prod (t :: ts) = mk_times (t, mk_prod ts);
  21.383  
  21.384  (*Find first term that matches u*)
  21.385 -fun find_first past u []         = raise TERM("find_first", []) 
  21.386 +fun find_first past u []         = raise TERM("find_first", [])
  21.387    | find_first past u (t::terms) =
  21.388 -	if u aconv t then (rev past @ terms)
  21.389 +        if u aconv t then (rev past @ terms)
  21.390          else find_first (t::past) u terms
  21.391 -	handle TERM _ => find_first (t::past) u terms;
  21.392 +        handle TERM _ => find_first (t::past) u terms;
  21.393  
  21.394  (*Final simplification: cancel + and *  *)
  21.395 -fun cancel_simplify_meta_eq cancel_th th = 
  21.396 -    Int_Numeral_Simprocs.simplify_meta_eq 
  21.397 -        [real_mult_1, real_mult_1_right] 
  21.398 +fun cancel_simplify_meta_eq cancel_th th =
  21.399 +    Int_Numeral_Simprocs.simplify_meta_eq
  21.400 +        [real_mult_1, real_mult_1_right]
  21.401          (([th, cancel_th]) MRS trans);
  21.402  
  21.403  (*** Making constant folding work for 0 and 1 too ***)
  21.404 @@ -525,32 +522,32 @@
  21.405    val numeral_1_eq_1  = real_numeral_1_eq_1
  21.406    val prove_conv      = prove_conv_nohyps "real_abstract_numerals"
  21.407    fun norm_tac simps  = ALLGOALS (simp_tac (HOL_ss addsimps simps))
  21.408 -  val simplify_meta_eq = Bin_Simprocs.simplify_meta_eq 
  21.409 +  val simplify_meta_eq = Bin_Simprocs.simplify_meta_eq
  21.410    end
  21.411  
  21.412  structure RealAbstractNumerals = AbstractNumeralsFun (RealAbstractNumeralsData)
  21.413  
  21.414  (*For addition, we already have rules for the operand 0.
  21.415 -  Multiplication is omitted because there are already special rules for 
  21.416 +  Multiplication is omitted because there are already special rules for
  21.417    both 0 and 1 as operands.  Unary minus is trivial, just have - 1 = -1.
  21.418    For the others, having three patterns is a compromise between just having
  21.419    one (many spurious calls) and having nine (just too many!) *)
  21.420 -val eval_numerals = 
  21.421 +val eval_numerals =
  21.422    map prep_simproc
  21.423     [("real_add_eval_numerals",
  21.424 -     prep_pats ["(m::real) + 1", "(m::real) + number_of v"], 
  21.425 +     ["(m::real) + 1", "(m::real) + number_of v"],
  21.426       RealAbstractNumerals.proc add_real_number_of),
  21.427      ("real_diff_eval_numerals",
  21.428 -     prep_pats ["(m::real) - 1", "(m::real) - number_of v"], 
  21.429 +     ["(m::real) - 1", "(m::real) - number_of v"],
  21.430       RealAbstractNumerals.proc diff_real_number_of),
  21.431      ("real_eq_eval_numerals",
  21.432 -     prep_pats ["(m::real) = 0", "(m::real) = 1", "(m::real) = number_of v"], 
  21.433 +     ["(m::real) = 0", "(m::real) = 1", "(m::real) = number_of v"],
  21.434       RealAbstractNumerals.proc eq_real_number_of),
  21.435      ("real_less_eval_numerals",
  21.436 -     prep_pats ["(m::real) < 0", "(m::real) < 1", "(m::real) < number_of v"], 
  21.437 +     ["(m::real) < 0", "(m::real) < 1", "(m::real) < number_of v"],
  21.438       RealAbstractNumerals.proc less_real_number_of),
  21.439      ("real_le_eval_numerals",
  21.440 -     prep_pats ["(m::real) <= 0", "(m::real) <= 1", "(m::real) <= number_of v"],
  21.441 +     ["(m::real) <= 0", "(m::real) <= 1", "(m::real) <= number_of v"],
  21.442       RealAbstractNumerals.proc le_real_number_of_eq_not_less)]
  21.443  
  21.444  end;
  21.445 @@ -567,7 +564,7 @@
  21.446  print_depth 22;
  21.447  set timing;
  21.448  set trace_simp;
  21.449 -fun test s = (Goal s; by (Simp_tac 1)); 
  21.450 +fun test s = (Goal s; by (Simp_tac 1));
  21.451  
  21.452  test "l + 2 + 2 + 2 + (l + 2) + (oo + 2) = (uu::real)";
  21.453  
  21.454 @@ -609,10 +606,10 @@
  21.455  
  21.456  structure Real_Times_Assoc_Data : ASSOC_FOLD_DATA =
  21.457  struct
  21.458 -  val ss		= HOL_ss
  21.459 -  val eq_reflection	= eq_reflection
  21.460 +  val ss                = HOL_ss
  21.461 +  val eq_reflection     = eq_reflection
  21.462    val sg_ref    = Sign.self_ref (Theory.sign_of (the_context ()))
  21.463 -  val T	     = HOLogic.realT
  21.464 +  val T      = HOLogic.realT
  21.465    val plus   = Const ("op *", [HOLogic.realT,HOLogic.realT] ---> HOLogic.realT)
  21.466    val add_ac = real_mult_ac
  21.467  end;
  21.468 @@ -629,8 +626,8 @@
  21.469  (** <= monotonicity results: needed for arithmetic **)
  21.470  
  21.471  Goal "[| i <= j;  (0::real) <= k |] ==> i*k <= j*k";
  21.472 -by (auto_tac (claset(), 
  21.473 -              simpset() addsimps [order_le_less, real_mult_less_mono1]));  
  21.474 +by (auto_tac (claset(),
  21.475 +              simpset() addsimps [order_le_less, real_mult_less_mono1]));
  21.476  qed "real_mult_le_mono1";
  21.477  
  21.478  Goal "[| i <= j;  (0::real) <= k |] ==> k*i <= k*j";
    22.1 --- a/src/HOL/Real/real_arith0.ML	Tue Aug 06 11:20:47 2002 +0200
    22.2 +++ b/src/HOL/Real/real_arith0.ML	Tue Aug 06 11:22:05 2002 +0200
    22.3 @@ -43,10 +43,6 @@
    22.4       "(i <= j) & (k < l)  ==> i + k < j + (l::real)",
    22.5       "(i < j) & (k < l)   ==> i + k < j + (l::real)"];
    22.6  
    22.7 -val real_arith_simproc_pats =
    22.8 -  map (fn s => Thm.read_cterm (Theory.sign_of (the_context ())) (s, HOLogic.boolT))
    22.9 -      ["(m::real) < n","(m::real) <= n", "(m::real) = n"];
   22.10 -
   22.11  fun cvar(th,_ $ (_ $ _ $ var)) = cterm_of (#sign(rep_thm th)) var;
   22.12  
   22.13  val real_mult_mono_thms =
   22.14 @@ -57,8 +53,9 @@
   22.15  
   22.16  in
   22.17  
   22.18 -val fast_real_arith_simproc = mk_simproc
   22.19 -  "fast_real_arith" real_arith_simproc_pats Fast_Arith.lin_arith_prover;
   22.20 +val fast_real_arith_simproc = Simplifier.simproc (Theory.sign_of (the_context ()))
   22.21 +  "fast_real_arith" ["(m::real) < n","(m::real) <= n", "(m::real) = n"]
   22.22 +  Fast_Arith.lin_arith_prover;
   22.23  
   22.24  val real_arith_setup =
   22.25   [Fast_Arith.map_data (fn {add_mono_thms, mult_mono_thms, inj_thms, lessD, simpset} =>
    23.1 --- a/src/HOL/Set.thy	Tue Aug 06 11:20:47 2002 +0200
    23.2 +++ b/src/HOL/Set.thy	Tue Aug 06 11:22:05 2002 +0200
    23.3 @@ -297,29 +297,25 @@
    23.4    by blast
    23.5  
    23.6  ML_setup {*
    23.7 -  let
    23.8 +  local
    23.9      val Ball_def = thm "Ball_def";
   23.10      val Bex_def = thm "Bex_def";
   23.11  
   23.12 -    val ex_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
   23.13 -      ("EX x:A. P x & Q x", HOLogic.boolT);
   23.14 -
   23.15      val prove_bex_tac =
   23.16        rewrite_goals_tac [Bex_def] THEN Quantifier1.prove_one_point_ex_tac;
   23.17      val rearrange_bex = Quantifier1.rearrange_bex prove_bex_tac;
   23.18  
   23.19 -    val all_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
   23.20 -      ("ALL x:A. P x --> Q x", HOLogic.boolT);
   23.21 -
   23.22      val prove_ball_tac =
   23.23        rewrite_goals_tac [Ball_def] THEN Quantifier1.prove_one_point_all_tac;
   23.24      val rearrange_ball = Quantifier1.rearrange_ball prove_ball_tac;
   23.25 -
   23.26 -    val defBEX_regroup = mk_simproc "defined BEX" [ex_pattern] rearrange_bex;
   23.27 -    val defBALL_regroup = mk_simproc "defined BALL" [all_pattern] rearrange_ball;
   23.28    in
   23.29 -    Addsimprocs [defBALL_regroup, defBEX_regroup]
   23.30 +    val defBEX_regroup = Simplifier.simproc (Theory.sign_of (the_context ()))
   23.31 +      "defined BEX" ["EX x:A. P x & Q x"] rearrange_bex;
   23.32 +    val defBALL_regroup = Simplifier.simproc (Theory.sign_of (the_context ()))
   23.33 +      "defined BALL" ["ALL x:A. P x --> Q x"] rearrange_ball;
   23.34    end;
   23.35 +
   23.36 +  Addsimprocs [defBALL_regroup, defBEX_regroup];
   23.37  *}
   23.38  
   23.39  
    24.1 --- a/src/HOL/Tools/datatype_package.ML	Tue Aug 06 11:20:47 2002 +0200
    24.2 +++ b/src/HOL/Tools/datatype_package.ML	Tue Aug 06 11:22:05 2002 +0200
    24.3 @@ -367,8 +367,8 @@
    24.4     | _ => None)
    24.5    | distinct_proc sg _ _ = None;
    24.6  
    24.7 -val distinct_pats = [HOLogic.read_cterm (Theory.sign_of HOL.thy) "s = t"];
    24.8 -val distinct_simproc = mk_simproc distinctN distinct_pats distinct_proc;
    24.9 +val distinct_simproc =
   24.10 +  Simplifier.simproc (Theory.sign_of HOL.thy) distinctN ["s = t"] distinct_proc;
   24.11  
   24.12  val dist_ss = HOL_ss addsimprocs [distinct_simproc];
   24.13  
    25.1 --- a/src/HOL/Tools/record_package.ML	Tue Aug 06 11:20:47 2002 +0200
    25.2 +++ b/src/HOL/Tools/record_package.ML	Tue Aug 06 11:22:05 2002 +0200
    25.3 @@ -499,34 +499,26 @@
    25.4  
    25.5  (** record simproc **)
    25.6  
    25.7 -local
    25.8 -
    25.9 -val sel_upd_pat = [HOLogic.read_cterm (Theory.sign_of HOL.thy) "s (u k r)"];
   25.10 -
   25.11 -fun proc sg _ t =
   25.12 -  (case t of (sel as Const (s, _)) $ ((upd as Const (u, _)) $ k $ r) =>
   25.13 -    (case get_selectors sg s of Some () =>
   25.14 -      (case get_updates sg u of Some u_name =>
   25.15 -        let
   25.16 -          fun mk_free x t = Free (x, fastype_of t);
   25.17 -          val k' = mk_free "k" k;
   25.18 -          val r' = mk_free "r" r;
   25.19 -          val t' = sel $ (upd $ k' $ r');
   25.20 -          fun prove prop =
   25.21 -            Tactic.prove sg ["k", "r"] [] prop (K (simp_all_tac (get_simpset sg) []));
   25.22 -        in
   25.23 -          if u_name = s then Some (prove (Logic.mk_equals (t', k')))
   25.24 -          else Some (prove (Logic.mk_equals (t', sel $ r')))
   25.25 -        end
   25.26 -      | None => None)
   25.27 -    | None => None)
   25.28 -  | _ => None);
   25.29 -
   25.30 -in
   25.31 -
   25.32 -val record_simproc = Simplifier.mk_simproc "record_simp" sel_upd_pat proc;
   25.33 -
   25.34 -end;
   25.35 +val record_simproc =
   25.36 +  Simplifier.simproc (Theory.sign_of HOL.thy) "record_simp" ["s (u k r)"]
   25.37 +    (fn sg => fn _ => fn t =>
   25.38 +      (case t of (sel as Const (s, _)) $ ((upd as Const (u, _)) $ k $ r) =>
   25.39 +        (case get_selectors sg s of Some () =>
   25.40 +          (case get_updates sg u of Some u_name =>
   25.41 +            let
   25.42 +              fun mk_free x t = Free (x, fastype_of t);
   25.43 +              val k' = mk_free "k" k;
   25.44 +              val r' = mk_free "r" r;
   25.45 +              val t' = sel $ (upd $ k' $ r');
   25.46 +              fun prove prop =
   25.47 +                Tactic.prove sg ["k", "r"] [] prop (K (simp_all_tac (get_simpset sg) []));
   25.48 +            in
   25.49 +              if u_name = s then Some (prove (Logic.mk_equals (t', k')))
   25.50 +              else Some (prove (Logic.mk_equals (t', sel $ r')))
   25.51 +            end
   25.52 +          | None => None)
   25.53 +        | None => None)
   25.54 +      | _ => None));
   25.55  
   25.56  
   25.57  
    26.1 --- a/src/HOL/arith_data.ML	Tue Aug 06 11:20:47 2002 +0200
    26.2 +++ b/src/HOL/arith_data.ML	Tue Aug 06 11:22:05 2002 +0200
    26.3 @@ -138,28 +138,20 @@
    26.4  
    26.5  (** prepare nat_cancel simprocs **)
    26.6  
    26.7 -fun prep_pat s = HOLogic.read_cterm (Theory.sign_of (the_context ())) s;
    26.8 -val prep_pats = map prep_pat;
    26.9 -
   26.10 -fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
   26.11 -
   26.12 -val eq_pats = prep_pats ["(l::nat) + m = n", "(l::nat) = m + n", "Suc m = n", 
   26.13 -                         "m = Suc n"];
   26.14 -val less_pats = prep_pats ["(l::nat) + m < n", "(l::nat) < m + n", "Suc m < n",
   26.15 -                           "m < Suc n"];
   26.16 -val le_pats = prep_pats ["(l::nat) + m <= n", "(l::nat) <= m + n", 
   26.17 -                         "Suc m <= n", "m <= Suc n"];
   26.18 -val diff_pats = prep_pats ["((l::nat) + m) - n", "(l::nat) - (m + n)", 
   26.19 -                           "Suc m - n", "m - Suc n"];
   26.20 +fun prep_simproc (name, pats, proc) =
   26.21 +  Simplifier.simproc (Theory.sign_of (the_context ())) name pats proc;
   26.22  
   26.23  val nat_cancel_sums_add = map prep_simproc
   26.24 -  [("nateq_cancel_sums",   eq_pats,   EqCancelSums.proc),
   26.25 -   ("natless_cancel_sums", less_pats, LessCancelSums.proc),
   26.26 -   ("natle_cancel_sums",   le_pats,   LeCancelSums.proc)];
   26.27 +  [("nateq_cancel_sums",
   26.28 +     ["(l::nat) + m = n", "(l::nat) = m + n", "Suc m = n", "m = Suc n"], EqCancelSums.proc),
   26.29 +   ("natless_cancel_sums",
   26.30 +     ["(l::nat) + m < n", "(l::nat) < m + n", "Suc m < n", "m < Suc n"], LessCancelSums.proc),
   26.31 +   ("natle_cancel_sums",
   26.32 +     ["(l::nat) + m <= n", "(l::nat) <= m + n", "Suc m <= n", "m <= Suc n"], LeCancelSums.proc)];
   26.33  
   26.34  val nat_cancel_sums = nat_cancel_sums_add @
   26.35 -  [prep_simproc("natdiff_cancel_sums", diff_pats, DiffCancelSums.proc)];
   26.36 -
   26.37 +  [prep_simproc ("natdiff_cancel_sums",
   26.38 +    ["((l::nat) + m) - n", "(l::nat) - (m + n)", "Suc m - n", "m - Suc n"], DiffCancelSums.proc)];
   26.39  
   26.40  end;
   26.41  
   26.42 @@ -393,15 +385,10 @@
   26.43  
   26.44  end;
   26.45  
   26.46 +val fast_nat_arith_simproc =
   26.47 +  Simplifier.simproc (Theory.sign_of (the_context ())) "fast_nat_arith"
   26.48 +    ["(m::nat) < n","(m::nat) <= n", "(m::nat) = n"] Fast_Arith.lin_arith_prover;
   26.49  
   26.50 -local
   26.51 -val nat_arith_simproc_pats =
   26.52 -  map (fn s => Thm.read_cterm (Theory.sign_of (the_context ())) (s, HOLogic.boolT))
   26.53 -      ["(m::nat) < n","(m::nat) <= n", "(m::nat) = n"];
   26.54 -in
   26.55 -val fast_nat_arith_simproc = mk_simproc
   26.56 -  "fast_nat_arith" nat_arith_simproc_pats Fast_Arith.lin_arith_prover;
   26.57 -end;
   26.58  
   26.59  (* Because of fast_nat_arith_simproc, the arithmetic solver is really only
   26.60  useful to detect inconsistencies among the premises for subgoals which are
    27.1 --- a/src/HOL/simpdata.ML	Tue Aug 06 11:20:47 2002 +0200
    27.2 +++ b/src/HOL/simpdata.ML	Tue Aug 06 11:22:05 2002 +0200
    27.3 @@ -123,17 +123,13 @@
    27.4  
    27.5  end;
    27.6  
    27.7 -local
    27.8 -val ex_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
    27.9 -    ("EX x. P(x)",HOLogic.boolT)
   27.10 -val all_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
   27.11 -    ("ALL x. P(x)",HOLogic.boolT)
   27.12 -in
   27.13 -val defEX_regroup = mk_simproc "defined EX" [ex_pattern]
   27.14 -      Quantifier1.rearrange_ex
   27.15 -val defALL_regroup = mk_simproc "defined ALL" [all_pattern]
   27.16 -      Quantifier1.rearrange_all
   27.17 -end;
   27.18 +val defEX_regroup =
   27.19 +  Simplifier.simproc (Theory.sign_of (the_context ()))
   27.20 +    "defined EX" ["EX x. P x"] Quantifier1.rearrange_ex;
   27.21 +
   27.22 +val defALL_regroup =
   27.23 +  Simplifier.simproc (Theory.sign_of (the_context ()))
   27.24 +    "defined ALL" ["ALL x. P x"] Quantifier1.rearrange_all;
   27.25  
   27.26  
   27.27  (*** Case splitting ***)
    28.1 --- a/src/Provers/Arith/abel_cancel.ML	Tue Aug 06 11:20:47 2002 +0200
    28.2 +++ b/src/Provers/Arith/abel_cancel.ML	Tue Aug 06 11:22:05 2002 +0200
    28.3 @@ -5,41 +5,41 @@
    28.4  
    28.5  Simplification procedures for abelian groups (e.g. integers, reals)
    28.6  
    28.7 -- Cancel complementary terms in sums 
    28.8 +- Cancel complementary terms in sums
    28.9  - Cancel like terms on opposite sides of relations
   28.10  *)
   28.11  
   28.12  
   28.13  signature ABEL_CANCEL =
   28.14  sig
   28.15 -  val ss		: simpset	(*basic simpset of object-logtic*)
   28.16 -  val eq_reflection	: thm		(*object-equality to meta-equality*)
   28.17 +  val ss                : simpset       (*basic simpset of object-logtic*)
   28.18 +  val eq_reflection     : thm           (*object-equality to meta-equality*)
   28.19  
   28.20 -  val sg_ref 		: Sign.sg_ref	(*signature of the theory of the group*)
   28.21 -  val T			: typ		(*the type of group elements*)
   28.22 +  val sg_ref            : Sign.sg_ref   (*signature of the theory of the group*)
   28.23 +  val T                 : typ           (*the type of group elements*)
   28.24  
   28.25 -  val zero		: term
   28.26 +  val zero              : term
   28.27    val restrict_to_left  : thm
   28.28 -  val add_cancel_21	: thm
   28.29 -  val add_cancel_end	: thm
   28.30 -  val add_left_cancel	: thm
   28.31 -  val add_assoc		: thm
   28.32 -  val add_commute 	: thm
   28.33 -  val add_left_commute 	: thm
   28.34 -  val add_0 		: thm
   28.35 -  val add_0_right 	: thm
   28.36 +  val add_cancel_21     : thm
   28.37 +  val add_cancel_end    : thm
   28.38 +  val add_left_cancel   : thm
   28.39 +  val add_assoc         : thm
   28.40 +  val add_commute       : thm
   28.41 +  val add_left_commute  : thm
   28.42 +  val add_0             : thm
   28.43 +  val add_0_right       : thm
   28.44  
   28.45 -  val eq_diff_eq 	: thm
   28.46 -  val eqI_rules		: thm list
   28.47 -  val dest_eqI		: thm -> term
   28.48 +  val eq_diff_eq        : thm
   28.49 +  val eqI_rules         : thm list
   28.50 +  val dest_eqI          : thm -> term
   28.51  
   28.52 -  val diff_def		: thm
   28.53 -  val minus_add_distrib	: thm
   28.54 -  val minus_minus	: thm
   28.55 -  val minus_0		: thm
   28.56 +  val diff_def          : thm
   28.57 +  val minus_add_distrib : thm
   28.58 +  val minus_minus       : thm
   28.59 +  val minus_0           : thm
   28.60  
   28.61 -  val add_inverses	: thm list
   28.62 -  val cancel_simps	: thm list
   28.63 +  val add_inverses      : thm list
   28.64 +  val cancel_simps      : thm list
   28.65  end;
   28.66  
   28.67  
   28.68 @@ -48,9 +48,9 @@
   28.69  
   28.70  open Data;
   28.71  
   28.72 - val prepare_ss = Data.ss addsimps [add_assoc, diff_def, 
   28.73 -				    minus_add_distrib, minus_minus,
   28.74 -				    minus_0, add_0, add_0_right];
   28.75 + val prepare_ss = Data.ss addsimps [add_assoc, diff_def,
   28.76 +                                    minus_add_distrib, minus_minus,
   28.77 +                                    minus_0, add_0, add_0_right];
   28.78  
   28.79   (*prove while suppressing timing information*)
   28.80   fun prove ct = setmp Library.timing false (prove_goalw_cterm [] ct);
   28.81 @@ -60,8 +60,8 @@
   28.82  
   28.83   (*Cancel corresponding terms on the two sides of the equation, NOT on
   28.84     the same side!*)
   28.85 - val cancel_ss = 
   28.86 -   Data.ss addsimps [add_cancel_21, add_cancel_end, minus_minus] @ 
   28.87 + val cancel_ss =
   28.88 +   Data.ss addsimps [add_cancel_21, add_cancel_end, minus_minus] @
   28.89                      (map (fn th => th RS restrict_to_left) Data.cancel_simps);
   28.90  
   28.91   val inverse_ss = Data.ss addsimps Data.add_inverses @ Data.cancel_simps;
   28.92 @@ -77,13 +77,13 @@
   28.93   (*Flatten a formula built from +, binary - and unary -.
   28.94     No need to check types PROVIDED they are checked upon entry!*)
   28.95   fun add_terms neg (Const ("op +", _) $ x $ y, ts) =
   28.96 -	 add_terms neg (x, add_terms neg (y, ts))
   28.97 +         add_terms neg (x, add_terms neg (y, ts))
   28.98     | add_terms neg (Const ("op -", _) $ x $ y, ts) =
   28.99 -	 add_terms neg (x, add_terms (not neg) (y, ts))
  28.100 -   | add_terms neg (Const ("uminus", _) $ x, ts) = 
  28.101 -	 add_terms (not neg) (x, ts)
  28.102 -   | add_terms neg (x, ts) = 
  28.103 -	 (if neg then negate x else x) :: ts;
  28.104 +         add_terms neg (x, add_terms (not neg) (y, ts))
  28.105 +   | add_terms neg (Const ("uminus", _) $ x, ts) =
  28.106 +         add_terms (not neg) (x, ts)
  28.107 +   | add_terms neg (x, ts) =
  28.108 +         (if neg then negate x else x) :: ts;
  28.109  
  28.110   fun terms fml = add_terms false (fml, []);
  28.111  
  28.112 @@ -98,39 +98,39 @@
  28.113  
  28.114   (*Make a simproc to cancel complementary terms in sums.  Examples:
  28.115      x-x = 0    x+(y-x) = y   -x+(y+(x+z)) = y+z
  28.116 -   It will unfold the definition of diff and associate to the right if 
  28.117 +   It will unfold the definition of diff and associate to the right if
  28.118     necessary.  Rewriting is faster if the formula is already
  28.119     in that form.
  28.120   *)
  28.121  
  28.122   fun sum_proc sg _ lhs =
  28.123 -   let val _ = if !trace then tracing ("cancel_sums: LHS = " ^ 
  28.124 -				       string_of_cterm (cterm_of sg lhs))
  28.125 -	       else ()
  28.126 +   let val _ = if !trace then tracing ("cancel_sums: LHS = " ^
  28.127 +                                       string_of_cterm (cterm_of sg lhs))
  28.128 +               else ()
  28.129         val (head::tail) = terms lhs
  28.130         val head' = negate head
  28.131         val rhs = mk_sum (cancelled (head',tail))
  28.132         and chead' = Thm.cterm_of sg head'
  28.133 -       val _ = if !trace then 
  28.134 -		 tracing ("RHS = " ^ string_of_cterm (Thm.cterm_of sg rhs))
  28.135 -	       else ()
  28.136 +       val _ = if !trace then
  28.137 +                 tracing ("RHS = " ^ string_of_cterm (Thm.cterm_of sg rhs))
  28.138 +               else ()
  28.139         val ct = Thm.cterm_of sg (Logic.mk_equals (lhs, rhs))
  28.140 -       val thm = prove ct 
  28.141 -		   (fn _ => [rtac eq_reflection 1,
  28.142 -			     simp_tac prepare_ss 1,
  28.143 -			     IF_UNSOLVED (simp_tac cancel_ss 1),
  28.144 -			     IF_UNSOLVED (simp_tac inverse_ss 1)])
  28.145 -	 handle ERROR =>
  28.146 -	 error("cancel_sums simproc:\nfailed to prove " ^
  28.147 -	       string_of_cterm ct)
  28.148 +       val thm = prove ct
  28.149 +                   (fn _ => [rtac eq_reflection 1,
  28.150 +                             simp_tac prepare_ss 1,
  28.151 +                             IF_UNSOLVED (simp_tac cancel_ss 1),
  28.152 +                             IF_UNSOLVED (simp_tac inverse_ss 1)])
  28.153 +         handle ERROR =>
  28.154 +         error("cancel_sums simproc:\nfailed to prove " ^
  28.155 +               string_of_cterm ct)
  28.156     in Some thm end
  28.157     handle Cancel => None;
  28.158  
  28.159  
  28.160 - val sum_conv = 
  28.161 + val sum_conv =
  28.162       Simplifier.mk_simproc "cancel_sums"
  28.163         (map (Thm.read_cterm (Sign.deref sg_ref))
  28.164 -	[("x + y", Data.T), ("x - y", Data.T)])
  28.165 +        [("x + y", Data.T), ("x - y", Data.T)])  (* FIXME depends on concrete syntax !???!!??! *)
  28.166         sum_proc;
  28.167  
  28.168  
  28.169 @@ -144,24 +144,24 @@
  28.170     calls to the simproc will be needed.*)
  28.171   fun cancel1 ([], u)    = raise Match (*impossible: it's a common term*)
  28.172     | cancel1 (t::ts, u) = if t aconv u then ts
  28.173 -			  else t :: cancel1 (ts,u);
  28.174 +                          else t :: cancel1 (ts,u);
  28.175  
  28.176  
  28.177   val sum_cancel_ss = Data.ss addsimprocs [sum_conv]
  28.178 -			     addsimps    [add_0, add_0_right];
  28.179 +                             addsimps    [add_0, add_0_right];
  28.180  
  28.181   val add_ac_ss = Data.ss addsimps [add_assoc,add_commute,add_left_commute];
  28.182  
  28.183   fun rel_proc sg _ (lhs as (rel$lt$rt)) =
  28.184 -   let val _ = if !trace then tracing ("cancel_relations: LHS = " ^ 
  28.185 -				       string_of_cterm (cterm_of sg lhs))
  28.186 -	       else ()
  28.187 +   let val _ = if !trace then tracing ("cancel_relations: LHS = " ^
  28.188 +                                       string_of_cterm (cterm_of sg lhs))
  28.189 +               else ()
  28.190         val ltms = terms lt
  28.191         and rtms = terms rt
  28.192         val common = (*inter_term miscounts repetitions, so squash them*)
  28.193 -		    gen_distinct (op aconv) (inter_term (ltms, rtms))
  28.194 +                    gen_distinct (op aconv) (inter_term (ltms, rtms))
  28.195         val _ = if null common then raise Cancel  (*nothing to do*)
  28.196 -				   else ()
  28.197 +                                   else ()
  28.198  
  28.199         fun cancelled tms = mk_sum (foldl cancel1 (tms, common))
  28.200  
  28.201 @@ -169,26 +169,25 @@
  28.202         and rt' = cancelled rtms
  28.203  
  28.204         val rhs = rel$lt'$rt'
  28.205 -       val _ = if !trace then 
  28.206 -		 tracing ("RHS = " ^ string_of_cterm (Thm.cterm_of sg rhs))
  28.207 -	       else ()
  28.208 +       val _ = if !trace then
  28.209 +                 tracing ("RHS = " ^ string_of_cterm (Thm.cterm_of sg rhs))
  28.210 +               else ()
  28.211         val ct = Thm.cterm_of sg (Logic.mk_equals (lhs,rhs))
  28.212  
  28.213 -       val thm = prove ct 
  28.214 -		   (fn _ => [rtac eq_reflection 1,
  28.215 -			     resolve_tac eqI_rules 1,
  28.216 -			     simp_tac prepare_ss 1,
  28.217 -			     simp_tac sum_cancel_ss 1,
  28.218 -			     IF_UNSOLVED (simp_tac add_ac_ss 1)])
  28.219 -	 handle ERROR =>
  28.220 -	 error("cancel_relations simproc:\nfailed to prove " ^
  28.221 -	       string_of_cterm ct)
  28.222 +       val thm = prove ct
  28.223 +                   (fn _ => [rtac eq_reflection 1,
  28.224 +                             resolve_tac eqI_rules 1,
  28.225 +                             simp_tac prepare_ss 1,
  28.226 +                             simp_tac sum_cancel_ss 1,
  28.227 +                             IF_UNSOLVED (simp_tac add_ac_ss 1)])
  28.228 +         handle ERROR =>
  28.229 +         error("cancel_relations simproc:\nfailed to prove " ^
  28.230 +               string_of_cterm ct)
  28.231     in Some thm end
  28.232     handle Cancel => None;
  28.233  
  28.234 - val rel_conv = 
  28.235 -     Simplifier.mk_simproc "cancel_relations"
  28.236 -       (map (Thm.cterm_of (Sign.deref sg_ref) o Data.dest_eqI) eqI_rules)
  28.237 -       rel_proc;
  28.238 + val rel_conv =
  28.239 +     Simplifier.simproc_i (Sign.deref sg_ref) "cancel_relations"
  28.240 +       (map Data.dest_eqI eqI_rules) rel_proc;
  28.241  
  28.242  end;
    29.1 --- a/src/Provers/Arith/assoc_fold.ML	Tue Aug 06 11:20:47 2002 +0200
    29.2 +++ b/src/Provers/Arith/assoc_fold.ML	Tue Aug 06 11:22:05 2002 +0200
    29.3 @@ -11,12 +11,12 @@
    29.4  
    29.5  signature ASSOC_FOLD_DATA =
    29.6  sig
    29.7 -  val ss		: simpset	(*basic simpset of object-logtic*)
    29.8 -  val eq_reflection	: thm		(*object-equality to meta-equality*)
    29.9 -  val sg_ref 		: Sign.sg_ref	(*the operator's signature*)
   29.10 -  val T			: typ		(*the operator's numeric type*)
   29.11 -  val plus		: term		(*the operator being folded*)
   29.12 -  val add_ac		: thm list      (*AC-rewrites for plus*)
   29.13 +  val ss                : simpset       (*basic simpset of object-logtic*)
   29.14 +  val eq_reflection     : thm           (*object-equality to meta-equality*)
   29.15 +  val sg_ref            : Sign.sg_ref   (*the operator's signature*)
   29.16 +  val T                 : typ           (*the operator's numeric type*)
   29.17 +  val plus              : term          (*the operator being folded*)
   29.18 +  val add_ac            : thm list      (*AC-rewrites for plus*)
   29.19  end;
   29.20  
   29.21  
   29.22 @@ -26,11 +26,11 @@
   29.23   val assoc_ss = Data.ss addsimps Data.add_ac;
   29.24  
   29.25   (*prove while suppressing timing information*)
   29.26 - fun prove name ct tacf = 
   29.27 + fun prove name ct tacf =
   29.28       setmp Library.timing false (prove_goalw_cterm [] ct) tacf
   29.29       handle ERROR =>
   29.30 -	 error(name ^ " simproc:\nfailed to prove " ^ string_of_cterm ct);
   29.31 -                
   29.32 +         error(name ^ " simproc:\nfailed to prove " ^ string_of_cterm ct);
   29.33 +
   29.34   exception Assoc_fail;
   29.35  
   29.36   fun mk_sum []  = raise Assoc_fail
   29.37 @@ -39,13 +39,13 @@
   29.38   (*Separate the literals from the other terms being combined*)
   29.39   fun sift_terms (t, (lits,others)) =
   29.40       case t of
   29.41 -	  Const("Numeral.number_of", _) $ _ =>
   29.42 -	      (t::lits, others)         (*new literal*)
   29.43 -	| (f as Const _) $ x $ y =>
   29.44 -	      if f = Data.plus 
   29.45 +          Const("Numeral.number_of", _) $ _ =>
   29.46 +              (t::lits, others)         (*new literal*)
   29.47 +        | (f as Const _) $ x $ y =>
   29.48 +              if f = Data.plus
   29.49                then sift_terms (x, sift_terms (y, (lits,others)))
   29.50 -	      else (lits, t::others)    (*arbitrary summand*)
   29.51 -	| _ => (lits, t::others);
   29.52 +              else (lits, t::others)    (*arbitrary summand*)
   29.53 +        | _ => (lits, t::others);
   29.54  
   29.55   val trace = ref false;
   29.56  
   29.57 @@ -53,25 +53,23 @@
   29.58   fun proc sg _ lhs =
   29.59     let fun show t = string_of_cterm (Thm.cterm_of sg t)
   29.60         val _ = if !trace then tracing ("assoc_fold simproc: LHS = " ^ show lhs)
   29.61 -	       else ()
   29.62 +               else ()
   29.63         val (lits,others) = sift_terms (lhs, ([],[]))
   29.64         val _ = if length lits < 2
   29.65                 then raise Assoc_fail (*we can't reduce the number of terms*)
   29.66 -               else ()  
   29.67 +               else ()
   29.68         val rhs = Data.plus $ mk_sum lits $ mk_sum others
   29.69         val _ = if !trace then tracing ("RHS = " ^ show rhs) else ()
   29.70 -       val th = prove "assoc_fold" 
   29.71 -	           (Thm.cterm_of sg (Logic.mk_equals (lhs, rhs)))
   29.72 -		   (fn _ => [rtac Data.eq_reflection 1,
   29.73 -			     simp_tac assoc_ss 1])
   29.74 +       val th = prove "assoc_fold"
   29.75 +                   (Thm.cterm_of sg (Logic.mk_equals (lhs, rhs)))
   29.76 +                   (fn _ => [rtac Data.eq_reflection 1,
   29.77 +                             simp_tac assoc_ss 1])
   29.78     in Some th end
   29.79     handle Assoc_fail => None;
   29.80 - 
   29.81 - val conv = 
   29.82 -     Simplifier.mk_simproc "assoc_fold"
   29.83 -       [Thm.cterm_of (Sign.deref Data.sg_ref)
   29.84 -	             (Data.plus $ Free("x",Data.T) $ Free("y",Data.T))]
   29.85 -       proc;
   29.86 +
   29.87 + val conv =
   29.88 +     Simplifier.simproc_i (Sign.deref Data.sg_ref) "assoc_fold"
   29.89 +       [Data.plus $ Free ("x", Data.T) $ Free ("y",Data.T)] proc;
   29.90  
   29.91  end;
   29.92  
    30.1 --- a/src/Provers/simplifier.ML	Tue Aug 06 11:20:47 2002 +0200
    30.2 +++ b/src/Provers/simplifier.ML	Tue Aug 06 11:22:05 2002 +0200
    30.3 @@ -16,6 +16,10 @@
    30.4    type simproc
    30.5    val mk_simproc: string -> cterm list
    30.6      -> (Sign.sg -> thm list -> term -> thm option) -> simproc
    30.7 +  val simproc: Sign.sg -> string -> string list
    30.8 +    -> (Sign.sg -> thm list -> term -> thm option) -> simproc
    30.9 +  val simproc_i: Sign.sg -> string -> term list
   30.10 +    -> (Sign.sg -> thm list -> term -> thm option) -> simproc
   30.11    type solver
   30.12    val mk_solver: string -> (thm list -> int -> tactic) -> solver
   30.13    type simpset
   30.14 @@ -126,6 +130,10 @@
   30.15  fun mk_simproc name lhss proc =
   30.16    Simproc (name, map (Thm.cterm_fun Logic.varify) lhss, proc, stamp ());
   30.17  
   30.18 +fun simproc sg name ss =
   30.19 +  mk_simproc name (map (fn s => Thm.read_cterm sg (s, TypeInfer.logicT)) ss);
   30.20 +fun simproc_i sg name = mk_simproc name o map (Thm.cterm_of sg);
   30.21 +
   30.22  fun rep_simproc (Simproc args) = args;
   30.23  
   30.24  
    31.1 --- a/src/ZF/Datatype.ML	Tue Aug 06 11:20:47 2002 +0200
    31.2 +++ b/src/ZF/Datatype.ML	Tue Aug 06 11:22:05 2002 +0200
    31.3 @@ -97,9 +97,7 @@
    31.4  
    31.5  
    31.6   val conv = 
    31.7 -     Simplifier.mk_simproc "data_free"
    31.8 -       [Thm.read_cterm (sign_of ZF.thy) ("(x::i) = y", FOLogic.oT)]
    31.9 -       proc;
   31.10 +     Simplifier.simproc (Theory.sign_of ZF.thy) "data_free" ["(x::i) = y"] proc;
   31.11  end;
   31.12  
   31.13  
    32.1 --- a/src/ZF/Integ/int_arith.ML	Tue Aug 06 11:20:47 2002 +0200
    32.2 +++ b/src/ZF/Integ/int_arith.ML	Tue Aug 06 11:22:05 2002 +0200
    32.3 @@ -49,11 +49,11 @@
    32.4  (** For cancel_numerals **)
    32.5  
    32.6  val rel_iff_rel_0_rls = map (inst "y" "?u$+?v")
    32.7 -                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0, 
    32.8 -			   zle_iff_zdiff_zle_0] @
    32.9 -		        map (inst "y" "n")
   32.10 -                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0, 
   32.11 -			   zle_iff_zdiff_zle_0];
   32.12 +                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0,
   32.13 +                           zle_iff_zdiff_zle_0] @
   32.14 +                        map (inst "y" "n")
   32.15 +                          [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0,
   32.16 +                           zle_iff_zdiff_zle_0];
   32.17  
   32.18  Goal "(i$*u $+ m = j$*u $+ n) <-> ((i$-j)$*u $+ m = intify(n))";
   32.19  by (simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]) 1);
   32.20 @@ -100,14 +100,14 @@
   32.21  fun mk_numeral n = integ_of_const $ NumeralSyntax.mk_bin n;
   32.22  
   32.23  (*Decodes a binary INTEGER*)
   32.24 -fun dest_numeral (Const("Bin.integ_of", _) $ w) = 
   32.25 +fun dest_numeral (Const("Bin.integ_of", _) $ w) =
   32.26       (NumeralSyntax.dest_bin w
   32.27        handle Match => raise TERM("Int_Numeral_Simprocs.dest_numeral:1", [w]))
   32.28    | dest_numeral t =  raise TERM("Int_Numeral_Simprocs.dest_numeral:2", [t]);
   32.29  
   32.30  fun find_first_numeral past (t::terms) =
   32.31 -	((dest_numeral t, rev past @ terms)
   32.32 -	 handle TERM _ => find_first_numeral (t::past) terms)
   32.33 +        ((dest_numeral t, rev past @ terms)
   32.34 +         handle TERM _ => find_first_numeral (t::past) terms)
   32.35    | find_first_numeral past [] = raise TERM("find_first_numeral", []);
   32.36  
   32.37  val zero = mk_numeral 0;
   32.38 @@ -134,7 +134,7 @@
   32.39    | dest_summing (pos, Const ("Int.zdiff", _) $ t $ u, ts) =
   32.40          dest_summing (pos, t, dest_summing (not pos, u, ts))
   32.41    | dest_summing (pos, t, ts) =
   32.42 -	if pos then t::ts else zminus_const$t :: ts;
   32.43 +        if pos then t::ts else zminus_const$t :: ts;
   32.44  
   32.45  fun dest_sum t = dest_summing (true, t, []);
   32.46  
   32.47 @@ -152,38 +152,38 @@
   32.48  val dest_times = FOLogic.dest_bin "Int.zmult" iT;
   32.49  
   32.50  fun dest_prod t =
   32.51 -      let val (t,u) = dest_times t 
   32.52 +      let val (t,u) = dest_times t
   32.53        in  dest_prod t @ dest_prod u  end
   32.54        handle TERM _ => [t];
   32.55  
   32.56 -(*DON'T do the obvious simplifications; that would create special cases*) 
   32.57 +(*DON'T do the obvious simplifications; that would create special cases*)
   32.58  fun mk_coeff (k, t) = mk_times (mk_numeral k, t);
   32.59  
   32.60  (*Express t as a product of (possibly) a numeral with other sorted terms*)
   32.61  fun dest_coeff sign (Const ("Int.zminus", _) $ t) = dest_coeff (~sign) t
   32.62    | dest_coeff sign t =
   32.63      let val ts = sort Term.term_ord (dest_prod t)
   32.64 -	val (n, ts') = find_first_numeral [] ts
   32.65 +        val (n, ts') = find_first_numeral [] ts
   32.66                            handle TERM _ => (1, ts)
   32.67      in (sign*n, mk_prod ts') end;
   32.68  
   32.69  (*Find first coefficient-term THAT MATCHES u*)
   32.70 -fun find_first_coeff past u [] = raise TERM("find_first_coeff", []) 
   32.71 +fun find_first_coeff past u [] = raise TERM("find_first_coeff", [])
   32.72    | find_first_coeff past u (t::terms) =
   32.73 -	let val (n,u') = dest_coeff 1 t
   32.74 -	in  if u aconv u' then (n, rev past @ terms)
   32.75 -			  else find_first_coeff (t::past) u terms
   32.76 -	end
   32.77 -	handle TERM _ => find_first_coeff (t::past) u terms;
   32.78 +        let val (n,u') = dest_coeff 1 t
   32.79 +        in  if u aconv u' then (n, rev past @ terms)
   32.80 +                          else find_first_coeff (t::past) u terms
   32.81 +        end
   32.82 +        handle TERM _ => find_first_coeff (t::past) u terms;
   32.83  
   32.84  
   32.85  (*Simplify #1*n and n*#1 to n*)
   32.86  val add_0s = [zadd_0_intify, zadd_0_right_intify];
   32.87  
   32.88 -val mult_1s = [zmult_1_intify, zmult_1_right_intify, 
   32.89 +val mult_1s = [zmult_1_intify, zmult_1_right_intify,
   32.90                 zmult_minus1, zmult_minus1_right];
   32.91  
   32.92 -val tc_rules = [integ_of_type, intify_in_int, 
   32.93 +val tc_rules = [integ_of_type, intify_in_int,
   32.94                  int_of_type, zadd_type, zdiff_type, zmult_type] @ bin.intrs;
   32.95  val intifys = [intify_ident, zadd_intify1, zadd_intify2,
   32.96                 zdiff_intify1, zdiff_intify2, zmult_intify1, zmult_intify2,
   32.97 @@ -194,47 +194,45 @@
   32.98  
   32.99  (*To evaluate binary negations of coefficients*)
  32.100  val zminus_simps = NCons_simps @
  32.101 -                   [integ_of_minus RS sym, 
  32.102 -		    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
  32.103 -		    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
  32.104 +                   [integ_of_minus RS sym,
  32.105 +                    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
  32.106 +                    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
  32.107  
  32.108  (*To let us treat subtraction as addition*)
  32.109  val diff_simps = [zdiff_def, zminus_zadd_distrib, zminus_zminus];
  32.110  
  32.111  (*push the unary minus down: - x * y = x * - y *)
  32.112 -val int_minus_mult_eq_1_to_2 = 
  32.113 +val int_minus_mult_eq_1_to_2 =
  32.114      [zmult_zminus, zmult_zminus_right RS sym] MRS trans |> standard;
  32.115  
  32.116  (*to extract again any uncancelled minuses*)
  32.117 -val int_minus_from_mult_simps = 
  32.118 +val int_minus_from_mult_simps =
  32.119      [zminus_zminus, zmult_zminus, zmult_zminus_right];
  32.120  
  32.121  (*combine unary minus with numeric literals, however nested within a product*)
  32.122  val int_mult_minus_simps =
  32.123      [zmult_assoc, zmult_zminus RS sym, int_minus_mult_eq_1_to_2];
  32.124  
  32.125 -fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
  32.126 -fun prep_pat s = Thm.read_cterm (Theory.sign_of (the_context ()))
  32.127 -                      (s, TypeInfer.anyT ["logic"]);
  32.128 -val prep_pats = map prep_pat;
  32.129 +fun prep_simproc (name, pats, proc) =
  32.130 +  Simplifier.simproc (Theory.sign_of (the_context ())) name pats proc;
  32.131  
  32.132  structure CancelNumeralsCommon =
  32.133    struct
  32.134 -  val mk_sum    	= mk_sum
  32.135 -  val dest_sum		= dest_sum
  32.136 -  val mk_coeff		= mk_coeff
  32.137 -  val dest_coeff	= dest_coeff 1
  32.138 -  val find_first_coeff	= find_first_coeff []
  32.139 -  val trans_tac		= ArithData.gen_trans_tac iff_trans
  32.140 +  val mk_sum            = mk_sum
  32.141 +  val dest_sum          = dest_sum
  32.142 +  val mk_coeff          = mk_coeff
  32.143 +  val dest_coeff        = dest_coeff 1
  32.144 +  val find_first_coeff  = find_first_coeff []
  32.145 +  val trans_tac         = ArithData.gen_trans_tac iff_trans
  32.146    val norm_tac_ss1 = ZF_ss addsimps add_0s@mult_1s@diff_simps@
  32.147                                      zminus_simps@zadd_ac
  32.148    val norm_tac_ss2 = ZF_ss addsimps bin_simps@int_mult_minus_simps@intifys
  32.149    val norm_tac_ss3 = ZF_ss addsimps int_minus_from_mult_simps@
  32.150                                      zadd_ac@zmult_ac@tc_rules@intifys
  32.151 -  val norm_tac		= ALLGOALS (asm_simp_tac norm_tac_ss1)
  32.152 -			  THEN ALLGOALS (asm_simp_tac norm_tac_ss2)
  32.153 -			  THEN ALLGOALS (asm_simp_tac norm_tac_ss3)
  32.154 -  val numeral_simp_tac	= 
  32.155 +  val norm_tac          = ALLGOALS (asm_simp_tac norm_tac_ss1)
  32.156 +                          THEN ALLGOALS (asm_simp_tac norm_tac_ss2)
  32.157 +                          THEN ALLGOALS (asm_simp_tac norm_tac_ss3)
  32.158 +  val numeral_simp_tac  =
  32.159           ALLGOALS (simp_tac (ZF_ss addsimps add_0s@bin_simps@tc_rules@intifys))
  32.160           THEN ALLGOALS Asm_simp_tac
  32.161    val simplify_meta_eq  = ArithData.simplify_meta_eq (add_0s@mult_1s)
  32.162 @@ -268,22 +266,22 @@
  32.163    val bal_add2 = le_add_iff2 RS iff_trans
  32.164  );
  32.165  
  32.166 -val cancel_numerals = 
  32.167 +val cancel_numerals =
  32.168    map prep_simproc
  32.169     [("inteq_cancel_numerals",
  32.170 -     prep_pats ["l $+ m = n", "l = m $+ n", 
  32.171 -		"l $- m = n", "l = m $- n", 
  32.172 -		"l $* m = n", "l = m $* n"], 
  32.173 +     ["l $+ m = n", "l = m $+ n",
  32.174 +      "l $- m = n", "l = m $- n",
  32.175 +      "l $* m = n", "l = m $* n"],
  32.176       EqCancelNumerals.proc),
  32.177 -    ("intless_cancel_numerals", 
  32.178 -     prep_pats ["l $+ m $< n", "l $< m $+ n", 
  32.179 -		"l $- m $< n", "l $< m $- n", 
  32.180 -		"l $* m $< n", "l $< m $* n"], 
  32.181 +    ("intless_cancel_numerals",
  32.182 +     ["l $+ m $< n", "l $< m $+ n",
  32.183 +      "l $- m $< n", "l $< m $- n",
  32.184 +      "l $* m $< n", "l $< m $* n"],
  32.185       LessCancelNumerals.proc),
  32.186 -    ("intle_cancel_numerals", 
  32.187 -     prep_pats ["l $+ m $<= n", "l $<= m $+ n", 
  32.188 -		"l $- m $<= n", "l $<= m $- n", 
  32.189 -		"l $* m $<= n", "l $<= m $* n"], 
  32.190 +    ("intle_cancel_numerals",
  32.191 +     ["l $+ m $<= n", "l $<= m $+ n",
  32.192 +      "l $- m $<= n", "l $<= m $- n",
  32.193 +      "l $* m $<= n", "l $<= m $* n"],
  32.194       LeCancelNumerals.proc)];
  32.195  
  32.196  
  32.197 @@ -292,12 +290,12 @@
  32.198  
  32.199  structure CombineNumeralsData =
  32.200    struct
  32.201 -  val add		= op + : int*int -> int 
  32.202 -  val mk_sum    	= long_mk_sum    (*to work for e.g. #2*x $+ #3*x *)
  32.203 -  val dest_sum		= dest_sum
  32.204 -  val mk_coeff		= mk_coeff
  32.205 -  val dest_coeff	= dest_coeff 1
  32.206 -  val left_distrib	= left_zadd_zmult_distrib RS trans
  32.207 +  val add               = op + : int*int -> int
  32.208 +  val mk_sum            = long_mk_sum    (*to work for e.g. #2*x $+ #3*x *)
  32.209 +  val dest_sum          = dest_sum
  32.210 +  val mk_coeff          = mk_coeff
  32.211 +  val dest_coeff        = dest_coeff 1
  32.212 +  val left_distrib      = left_zadd_zmult_distrib RS trans
  32.213    val prove_conv        = prove_conv_nohyps "int_combine_numerals"
  32.214    val trans_tac         = ArithData.gen_trans_tac trans
  32.215    val norm_tac_ss1 = ZF_ss addsimps add_0s@mult_1s@diff_simps@
  32.216 @@ -305,20 +303,18 @@
  32.217    val norm_tac_ss2 = ZF_ss addsimps bin_simps@int_mult_minus_simps@intifys
  32.218    val norm_tac_ss3 = ZF_ss addsimps int_minus_from_mult_simps@
  32.219                                      zadd_ac@zmult_ac@tc_rules@intifys
  32.220 -  val norm_tac		= ALLGOALS (asm_simp_tac norm_tac_ss1)
  32.221 -			  THEN ALLGOALS (asm_simp_tac norm_tac_ss2)
  32.222 -			  THEN ALLGOALS (asm_simp_tac norm_tac_ss3)
  32.223 -  val numeral_simp_tac	= 
  32.224 +  val norm_tac          = ALLGOALS (asm_simp_tac norm_tac_ss1)
  32.225 +                          THEN ALLGOALS (asm_simp_tac norm_tac_ss2)
  32.226 +                          THEN ALLGOALS (asm_simp_tac norm_tac_ss3)
  32.227 +  val numeral_simp_tac  =
  32.228           ALLGOALS (simp_tac (ZF_ss addsimps add_0s@bin_simps@tc_rules@intifys))
  32.229    val simplify_meta_eq  = ArithData.simplify_meta_eq (add_0s@mult_1s)
  32.230    end;
  32.231  
  32.232  structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
  32.233 -  
  32.234 -val combine_numerals = 
  32.235 -    prep_simproc ("int_combine_numerals",
  32.236 -		  prep_pats ["i $+ j", "i $- j"],
  32.237 -		  CombineNumerals.proc);
  32.238 +
  32.239 +val combine_numerals =
  32.240 +  prep_simproc ("int_combine_numerals", ["i $+ j", "i $- j"], CombineNumerals.proc);
  32.241  
  32.242  
  32.243  
  32.244 @@ -330,39 +326,37 @@
  32.245  
  32.246  structure CombineNumeralsProdData =
  32.247    struct
  32.248 -  val add		= op * : int*int -> int
  32.249 -  val mk_sum    	= mk_prod
  32.250 -  val dest_sum		= dest_prod
  32.251 -  fun mk_coeff(k,t) = if t=one then mk_numeral k 
  32.252 +  val add               = op * : int*int -> int
  32.253 +  val mk_sum            = mk_prod
  32.254 +  val dest_sum          = dest_prod
  32.255 +  fun mk_coeff(k,t) = if t=one then mk_numeral k
  32.256                        else raise TERM("mk_coeff", [])
  32.257    fun dest_coeff t = (dest_numeral t, one)  (*We ONLY want pure numerals.*)
  32.258 -  val left_distrib	= zmult_assoc RS sym RS trans
  32.259 +  val left_distrib      = zmult_assoc RS sym RS trans
  32.260    val prove_conv        = prove_conv_nohyps "int_combine_numerals_prod"
  32.261    val trans_tac         = ArithData.gen_trans_tac trans
  32.262    val norm_tac_ss1 = ZF_ss addsimps mult_1s@diff_simps@zminus_simps
  32.263    val norm_tac_ss2 = ZF_ss addsimps [zmult_zminus_right RS sym]@
  32.264                                      bin_simps@zmult_ac@tc_rules@intifys
  32.265 -  val norm_tac		= ALLGOALS (asm_simp_tac norm_tac_ss1)
  32.266 -			  THEN ALLGOALS (asm_simp_tac norm_tac_ss2)
  32.267 -  val numeral_simp_tac	= 
  32.268 +  val norm_tac          = ALLGOALS (asm_simp_tac norm_tac_ss1)
  32.269 +                          THEN ALLGOALS (asm_simp_tac norm_tac_ss2)
  32.270 +  val numeral_simp_tac  =
  32.271           ALLGOALS (simp_tac (ZF_ss addsimps bin_simps@tc_rules@intifys))
  32.272    val simplify_meta_eq  = ArithData.simplify_meta_eq (mult_1s)
  32.273    end;
  32.274  
  32.275  
  32.276  structure CombineNumeralsProd = CombineNumeralsFun(CombineNumeralsProdData);
  32.277 -  
  32.278 -val combine_numerals_prod = 
  32.279 -    prep_simproc ("int_combine_numerals_prod",
  32.280 -		  prep_pats ["i $* j"],
  32.281 -		  CombineNumeralsProd.proc);
  32.282 +
  32.283 +val combine_numerals_prod =
  32.284 +  prep_simproc ("int_combine_numerals_prod", ["i $* j"], CombineNumeralsProd.proc);
  32.285  
  32.286  end;
  32.287  
  32.288  
  32.289  Addsimprocs Int_Numeral_Simprocs.cancel_numerals;
  32.290  Addsimprocs [Int_Numeral_Simprocs.combine_numerals,
  32.291 -	     Int_Numeral_Simprocs.combine_numerals_prod];
  32.292 +             Int_Numeral_Simprocs.combine_numerals_prod];
  32.293  
  32.294  
  32.295  (*examples:*)
  32.296 @@ -370,7 +364,7 @@
  32.297  print_depth 22;
  32.298  set timing;
  32.299  set trace_simp;
  32.300 -fun test s = (Goal s; by (Asm_simp_tac 1)); 
  32.301 +fun test s = (Goal s; by (Asm_simp_tac 1));
  32.302  val sg = #sign (rep_thm (topthm()));
  32.303  val t = FOLogic.dest_Trueprop (Logic.strip_assums_concl(getgoal 1));
  32.304  val (t,_) = FOLogic.dest_eq t;
    33.1 --- a/src/ZF/OrdQuant.thy	Tue Aug 06 11:20:47 2002 +0200
    33.2 +++ b/src/ZF/OrdQuant.thy	Tue Aug 06 11:22:05 2002 +0200
    33.3 @@ -388,34 +388,27 @@
    33.4  simpset_ref() := simpset() setmksimps (map mk_eq o Ord_atomize o gen_all);
    33.5  *}
    33.6  
    33.7 -text{*Setting up the one-point-rule simproc*}
    33.8 -ML
    33.9 -{*
   33.10 +text {* Setting up the one-point-rule simproc *}
   33.11  
   33.12 -let
   33.13 -val ex_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
   33.14 -                                ("EX x[M]. P(x) & Q(x)", FOLogic.oT)
   33.15 +ML_setup {*
   33.16 +local
   33.17  
   33.18 -val prove_rex_tac = rewtac rex_def THEN
   33.19 -                    Quantifier1.prove_one_point_ex_tac;
   33.20 -
   33.21 +val prove_rex_tac = rewtac rex_def THEN Quantifier1.prove_one_point_ex_tac;
   33.22  val rearrange_bex = Quantifier1.rearrange_bex prove_rex_tac;
   33.23  
   33.24 -val all_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
   33.25 -                                 ("ALL x[M]. P(x) --> Q(x)", FOLogic.oT)
   33.26 -
   33.27 -val prove_rall_tac = rewtac rall_def THEN
   33.28 -                     Quantifier1.prove_one_point_all_tac;
   33.29 -
   33.30 +val prove_rall_tac = rewtac rall_def THEN Quantifier1.prove_one_point_all_tac;
   33.31  val rearrange_ball = Quantifier1.rearrange_ball prove_rall_tac;
   33.32  
   33.33 -val defREX_regroup = mk_simproc "defined REX" [ex_pattern] rearrange_bex;
   33.34 -val defRALL_regroup = mk_simproc "defined RALL" [all_pattern] rearrange_ball;
   33.35  in
   33.36  
   33.37 -Addsimprocs [defRALL_regroup,defREX_regroup]
   33.38 +val defREX_regroup = Simplifier.simproc (Theory.sign_of (the_context ()))
   33.39 +  "defined REX" ["EX x[M]. P(x) & Q(x)"] rearrange_bex;
   33.40 +val defRALL_regroup = Simplifier.simproc (Theory.sign_of (the_context ()))
   33.41 +  "defined RALL" ["ALL x[M]. P(x) --> Q(x)"] rearrange_ball;
   33.42  
   33.43  end;
   33.44 +
   33.45 +Addsimprocs [defRALL_regroup,defREX_regroup];
   33.46  *}
   33.47  
   33.48  end
    34.1 --- a/src/ZF/arith_data.ML	Tue Aug 06 11:20:47 2002 +0200
    34.2 +++ b/src/ZF/arith_data.ML	Tue Aug 06 11:22:05 2002 +0200
    34.3 @@ -12,7 +12,7 @@
    34.4    val nat_cancel: simproc list
    34.5    (*tools for use in similar applications*)
    34.6    val gen_trans_tac: thm -> thm option -> tactic
    34.7 -  val prove_conv: string -> tactic list -> Sign.sg -> 
    34.8 +  val prove_conv: string -> tactic list -> Sign.sg ->
    34.9                    thm list -> term * term -> thm option
   34.10    val simplify_meta_eq: thm list -> thm -> thm
   34.11    (*debugging*)
   34.12 @@ -63,7 +63,7 @@
   34.13  
   34.14  (*We remove equality assumptions because they confuse the simplifier and
   34.15    because only type-checking assumptions are necessary.*)
   34.16 -fun is_eq_thm th = 
   34.17 +fun is_eq_thm th =
   34.18      can FOLogic.dest_eq (FOLogic.dest_Trueprop (#prop (rep_thm th)));
   34.19  
   34.20  fun add_chyps chyps ct = Drule.list_implies (map cprop_of chyps, ct);
   34.21 @@ -75,17 +75,15 @@
   34.22        val goal = Logic.list_implies (map (#prop o Thm.rep_thm) hyps',
   34.23          FOLogic.mk_Trueprop (mk_eq_iff (t, u)));
   34.24    in Some (hyps' MRS Tactic.prove sg [] [] goal (K (EVERY tacs)))
   34.25 -      handle ERROR_MESSAGE msg => 
   34.26 -	(warning (msg ^ "\nCancellation failed: no typing information? (" ^ name ^ ")"); None)
   34.27 +      handle ERROR_MESSAGE msg =>
   34.28 +        (warning (msg ^ "\nCancellation failed: no typing information? (" ^ name ^ ")"); None)
   34.29    end;
   34.30  
   34.31 -fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
   34.32 -fun prep_pat s = Thm.read_cterm (Theory.sign_of (the_context ()))
   34.33 -                      (s, TypeInfer.anyT ["logic"]);
   34.34 -val prep_pats = map prep_pat;
   34.35 +fun prep_simproc (name, pats, proc) =
   34.36 +  Simplifier.simproc (Theory.sign_of (the_context ())) name pats proc;
   34.37  
   34.38  
   34.39 -(*** Use CancelNumerals simproc without binary numerals, 
   34.40 +(*** Use CancelNumerals simproc without binary numerals,
   34.41       just for cancellation ***)
   34.42  
   34.43  val mk_times = FOLogic.mk_binop "Arith.mult";
   34.44 @@ -132,9 +130,9 @@
   34.45  (*Final simplification: cancel + and **)
   34.46  fun simplify_meta_eq rules =
   34.47      mk_meta_eq o
   34.48 -    simplify (FOL_ss addeqcongs[eq_cong2,iff_cong2] 
   34.49 +    simplify (FOL_ss addeqcongs[eq_cong2,iff_cong2]
   34.50                       delsimps iff_simps (*these could erase the whole rule!*)
   34.51 -		     addsimps rules);
   34.52 +                     addsimps rules);
   34.53  
   34.54  val final_rules = add_0s @ mult_1s @ [mult_0, mult_0_right];
   34.55  
   34.56 @@ -158,7 +156,7 @@
   34.57  (** The functor argumnets are declared as separate structures
   34.58      so that they can be exported to ease debugging. **)
   34.59  
   34.60 -structure EqCancelNumeralsData = 
   34.61 +structure EqCancelNumeralsData =
   34.62    struct
   34.63    open CancelNumeralsCommon
   34.64    val prove_conv = prove_conv "nateq_cancel_numerals"
   34.65 @@ -171,7 +169,7 @@
   34.66  
   34.67  structure EqCancelNumerals = CancelNumeralsFun(EqCancelNumeralsData);
   34.68  
   34.69 -structure LessCancelNumeralsData = 
   34.70 +structure LessCancelNumeralsData =
   34.71    struct
   34.72    open CancelNumeralsCommon
   34.73    val prove_conv = prove_conv "natless_cancel_numerals"
   34.74 @@ -184,7 +182,7 @@
   34.75  
   34.76  structure LessCancelNumerals = CancelNumeralsFun(LessCancelNumeralsData);
   34.77  
   34.78 -structure DiffCancelNumeralsData = 
   34.79 +structure DiffCancelNumeralsData =
   34.80    struct
   34.81    open CancelNumeralsCommon
   34.82    val prove_conv = prove_conv "natdiff_cancel_numerals"
   34.83 @@ -199,26 +197,25 @@
   34.84  
   34.85  
   34.86  val nat_cancel =
   34.87 -      map prep_simproc
   34.88 -       [("nateq_cancel_numerals",
   34.89 -	 prep_pats ["l #+ m = n", "l = m #+ n",
   34.90 -		    "l #* m = n", "l = m #* n",
   34.91 -		    "succ(m) = n", "m = succ(n)"],
   34.92 -	 EqCancelNumerals.proc),
   34.93 -	("natless_cancel_numerals",
   34.94 -	 prep_pats ["l #+ m < n", "l < m #+ n",
   34.95 -		    "l #* m < n", "l < m #* n",
   34.96 -		    "succ(m) < n", "m < succ(n)"],
   34.97 -	 LessCancelNumerals.proc),
   34.98 -	("natdiff_cancel_numerals",
   34.99 -	 prep_pats ["(l #+ m) #- n", "l #- (m #+ n)",
  34.100 -		    "(l #* m) #- n", "l #- (m #* n)",
  34.101 -		    "succ(m) #- n", "m #- succ(n)"],
  34.102 -	 DiffCancelNumerals.proc)];
  34.103 +  map prep_simproc
  34.104 +   [("nateq_cancel_numerals",
  34.105 +     ["l #+ m = n", "l = m #+ n",
  34.106 +      "l #* m = n", "l = m #* n",
  34.107 +      "succ(m) = n", "m = succ(n)"],
  34.108 +     EqCancelNumerals.proc),
  34.109 +    ("natless_cancel_numerals",
  34.110 +     ["l #+ m < n", "l < m #+ n",
  34.111 +      "l #* m < n", "l < m #* n",
  34.112 +      "succ(m) < n", "m < succ(n)"],
  34.113 +     LessCancelNumerals.proc),
  34.114 +    ("natdiff_cancel_numerals",
  34.115 +     ["(l #+ m) #- n", "l #- (m #+ n)",
  34.116 +      "(l #* m) #- n", "l #- (m #* n)",
  34.117 +      "succ(m) #- n", "m #- succ(n)"],
  34.118 +     DiffCancelNumerals.proc)];
  34.119  
  34.120  end;
  34.121  
  34.122 -(*Install the simprocs!*)
  34.123  Addsimprocs ArithData.nat_cancel;
  34.124  
  34.125  
    35.1 --- a/src/ZF/simpdata.ML	Tue Aug 06 11:20:47 2002 +0200
    35.2 +++ b/src/ZF/simpdata.ML	Tue Aug 06 11:22:05 2002 +0200
    35.3 @@ -11,17 +11,17 @@
    35.4  (*Should False yield False<->True, or should it solve goals some other way?*)
    35.5  
    35.6  (*Analyse a theorem to atomic rewrite rules*)
    35.7 -fun atomize (conn_pairs, mem_pairs) th = 
    35.8 +fun atomize (conn_pairs, mem_pairs) th =
    35.9    let fun tryrules pairs t =
   35.10            case head_of t of
   35.11 -              Const(a,_) => 
   35.12 +              Const(a,_) =>
   35.13                  (case assoc(pairs,a) of
   35.14                       Some rls => flat (map (atomize (conn_pairs, mem_pairs))
   35.15                                         ([th] RL rls))
   35.16                     | None     => [th])
   35.17              | _ => [th]
   35.18 -  in case concl_of th of 
   35.19 -         Const("Trueprop",_) $ P => 
   35.20 +  in case concl_of th of
   35.21 +         Const("Trueprop",_) $ P =>
   35.22              (case P of
   35.23                   Const("op :",_) $ a $ b => tryrules mem_pairs b
   35.24                 | Const("True",_)         => []
   35.25 @@ -32,13 +32,13 @@
   35.26  
   35.27  (*Analyse a rigid formula*)
   35.28  val ZF_conn_pairs =
   35.29 -  [("Ball",     [bspec]), 
   35.30 +  [("Ball",     [bspec]),
   35.31     ("All",      [spec]),
   35.32     ("op -->",   [mp]),
   35.33     ("op &",     [conjunct1,conjunct2])];
   35.34  
   35.35  (*Analyse a:b, where b is rigid*)
   35.36 -val ZF_mem_pairs = 
   35.37 +val ZF_mem_pairs =
   35.38    [("Collect",  [CollectD1,CollectD2]),
   35.39     ("op -",     [DiffD1,DiffD2]),
   35.40     ("op Int",   [IntD1,IntD2])];
   35.41 @@ -55,8 +55,8 @@
   35.42  (** Splitting IFs in the assumptions **)
   35.43  
   35.44  Goal "P(if Q then x else y) <-> (~((Q & ~P(x)) | (~Q & ~P(y))))";
   35.45 -by (Simp_tac 1); 
   35.46 -qed "split_if_asm";   
   35.47 +by (Simp_tac 1);
   35.48 +qed "split_if_asm";
   35.49  
   35.50  bind_thms ("if_splits", [split_if, split_if_asm]);
   35.51  
   35.52 @@ -65,8 +65,8 @@
   35.53  
   35.54  local
   35.55    (*For proving rewrite rules*)
   35.56 -  fun prover s = (print s;prove_goalw (the_context ()) [Inter_def] s 
   35.57 -                  (fn _ => [Simp_tac 1, 
   35.58 +  fun prover s = (print s;prove_goalw (the_context ()) [Inter_def] s
   35.59 +                  (fn _ => [Simp_tac 1,
   35.60                              ALLGOALS (blast_tac (claset() addSIs[equalityI]))]));
   35.61  
   35.62  in
   35.63 @@ -86,7 +86,7 @@
   35.64       "(ALL x:Collect(A,Q).P(x)) <-> (ALL x:A. Q(x) --> P(x))",
   35.65       "(~(ALL x:A. P(x))) <-> (EX x:A. ~P(x))"];
   35.66  
   35.67 -val ball_conj_distrib = 
   35.68 +val ball_conj_distrib =
   35.69      prover "(ALL x:A. P(x) & Q(x)) <-> ((ALL x:A. P(x)) & (ALL x:A. Q(x)))";
   35.70  
   35.71  val bex_simps = map prover
   35.72 @@ -104,14 +104,14 @@
   35.73       "(EX x:Collect(A,Q).P(x)) <-> (EX x:A. Q(x) & P(x))",
   35.74       "(~(EX x:A. P(x))) <-> (ALL x:A. ~P(x))"];
   35.75  
   35.76 -val bex_disj_distrib = 
   35.77 +val bex_disj_distrib =
   35.78      prover "(EX x:A. P(x) | Q(x)) <-> ((EX x:A. P(x)) | (EX x:A. Q(x)))";
   35.79  
   35.80  val Rep_simps = map prover
   35.81 -    ["{x. y:0, R(x,y)} = 0",	(*Replace*)
   35.82 -     "{x:0. P(x)} = 0",		(*Collect*)
   35.83 +    ["{x. y:0, R(x,y)} = 0",    (*Replace*)
   35.84 +     "{x:0. P(x)} = 0",         (*Collect*)
   35.85       "{x:A. P} = (if P then A else 0)",
   35.86 -     "RepFun(0,f) = 0",		(*RepFun*)
   35.87 +     "RepFun(0,f) = 0",         (*RepFun*)
   35.88       "RepFun(succ(i),f) = cons(f(i), RepFun(i,f))",
   35.89       "RepFun(cons(a,B),f) = cons(f(a), RepFun(B,f))"]
   35.90  
   35.91 @@ -124,7 +124,7 @@
   35.92       "Inter({b}) = b"]
   35.93  
   35.94  
   35.95 -val UN_simps = map prover 
   35.96 +val UN_simps = map prover
   35.97      ["(UN x:C. cons(a, B(x))) = (if C=0 then 0 else cons(a, UN x:C. B(x)))",
   35.98       "(UN x:C. A(x) Un B)   = (if C=0 then 0 else (UN x:C. A(x)) Un B)",
   35.99       "(UN x:C. A Un B(x))   = (if C=0 then 0 else A Un (UN x:C. B(x)))",
  35.100 @@ -145,10 +145,10 @@
  35.101       "(INT x:C. A(x) Un B)  = (if C=0 then 0 else (INT x:C. A(x)) Un B)",
  35.102       "(INT x:C. A Un B(x))  = (if C=0 then 0 else A Un (INT x:C. B(x)))"];
  35.103  
  35.104 -(** The _extend_simps rules are oriented in the opposite direction, to 
  35.105 +(** The _extend_simps rules are oriented in the opposite direction, to
  35.106      pull UN and INT outwards. **)
  35.107  
  35.108 -val UN_extend_simps = map prover 
  35.109 +val UN_extend_simps = map prover
  35.110      ["cons(a, UN x:C. B(x)) = (if C=0 then {a} else (UN x:C. cons(a, B(x))))",
  35.111       "(UN x:C. A(x)) Un B   = (if C=0 then B else (UN x:C. A(x) Un B))",
  35.112       "A Un (UN x:C. B(x))   = (if C=0 then A else (UN x:C. A Un B(x)))",
  35.113 @@ -220,30 +220,25 @@
  35.114            ball_one_point1,ball_one_point2];
  35.115  
  35.116  
  35.117 -let
  35.118 -val ex_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
  35.119 -    ("EX x:A. P(x) & Q(x)",FOLogic.oT)
  35.120 +local
  35.121  
  35.122 -val prove_bex_tac = rewtac Bex_def THEN
  35.123 -                    Quantifier1.prove_one_point_ex_tac;
  35.124 -
  35.125 +val prove_bex_tac = rewtac Bex_def THEN Quantifier1.prove_one_point_ex_tac;
  35.126  val rearrange_bex = Quantifier1.rearrange_bex prove_bex_tac;
  35.127  
  35.128 -val all_pattern = Thm.read_cterm (Theory.sign_of (the_context ()))
  35.129 -    ("ALL x:A. P(x) --> Q(x)",FOLogic.oT)
  35.130 -
  35.131 -val prove_ball_tac = rewtac Ball_def THEN 
  35.132 -                     Quantifier1.prove_one_point_all_tac;
  35.133 -
  35.134 +val prove_ball_tac = rewtac Ball_def THEN Quantifier1.prove_one_point_all_tac;
  35.135  val rearrange_ball = Quantifier1.rearrange_ball prove_ball_tac;
  35.136  
  35.137 -val defBEX_regroup = mk_simproc "defined BEX" [ex_pattern] rearrange_bex;
  35.138 -val defBALL_regroup = mk_simproc "defined BALL" [all_pattern] rearrange_ball;
  35.139  in
  35.140  
  35.141 -Addsimprocs [defBALL_regroup,defBEX_regroup]
  35.142 +val defBEX_regroup = Simplifier.simproc (Theory.sign_of (the_context ()))
  35.143 +  "defined BEX" ["EX x:A. P(x) & Q(x)"] rearrange_bex;
  35.144 +
  35.145 +val defBALL_regroup = Simplifier.simproc (Theory.sign_of (the_context ()))
  35.146 +  "defined BALL" ["ALL x:A. P(x) --> Q(x)"] rearrange_ball;
  35.147  
  35.148  end;
  35.149  
  35.150 +Addsimprocs [defBALL_regroup, defBEX_regroup];
  35.151 +
  35.152  
  35.153  val ZF_ss = simpset();