src/HOL/HOLCF/Tools/fixrec.ML
changeset 40832 4352ca878c41
parent 40774 0437dbc127b3
child 41296 6aaf80ea9715
     1.1 --- a/src/HOL/HOLCF/Tools/fixrec.ML	Tue Nov 30 14:01:49 2010 -0800
     1.2 +++ b/src/HOL/HOLCF/Tools/fixrec.ML	Tue Nov 30 14:21:57 2010 -0800
     1.3 @@ -13,23 +13,23 @@
     1.4    val add_matchers: (string * string) list -> theory -> theory
     1.5    val fixrec_simp_tac: Proof.context -> int -> tactic
     1.6    val setup: theory -> theory
     1.7 -end;
     1.8 +end
     1.9  
    1.10  structure Fixrec :> FIXREC =
    1.11  struct
    1.12  
    1.13 -open HOLCF_Library;
    1.14 +open HOLCF_Library
    1.15  
    1.16 -infixr 6 ->>;
    1.17 -infix -->>;
    1.18 -infix 9 `;
    1.19 +infixr 6 ->>
    1.20 +infix -->>
    1.21 +infix 9 `
    1.22  
    1.23 -val def_cont_fix_eq = @{thm def_cont_fix_eq};
    1.24 -val def_cont_fix_ind = @{thm def_cont_fix_ind};
    1.25 +val def_cont_fix_eq = @{thm def_cont_fix_eq}
    1.26 +val def_cont_fix_ind = @{thm def_cont_fix_ind}
    1.27  
    1.28 -fun fixrec_err s = error ("fixrec definition error:\n" ^ s);
    1.29 +fun fixrec_err s = error ("fixrec definition error:\n" ^ s)
    1.30  fun fixrec_eq_err thy s eq =
    1.31 -  fixrec_err (s ^ "\nin\n" ^ quote (Syntax.string_of_term_global thy eq));
    1.32 +  fixrec_err (s ^ "\nin\n" ^ quote (Syntax.string_of_term_global thy eq))
    1.33  
    1.34  (*************************************************************************)
    1.35  (***************************** building types ****************************)
    1.36 @@ -39,19 +39,19 @@
    1.37  
    1.38  fun binder_cfun (Type(@{type_name cfun},[T, U])) = T :: binder_cfun U
    1.39    | binder_cfun (Type(@{type_name "fun"},[T, U])) = T :: binder_cfun U
    1.40 -  | binder_cfun _   =  [];
    1.41 +  | binder_cfun _   =  []
    1.42  
    1.43  fun body_cfun (Type(@{type_name cfun},[T, U])) = body_cfun U
    1.44    | body_cfun (Type(@{type_name "fun"},[T, U])) = body_cfun U
    1.45 -  | body_cfun T   =  T;
    1.46 +  | body_cfun T   =  T
    1.47  
    1.48  fun strip_cfun T : typ list * typ =
    1.49 -  (binder_cfun T, body_cfun T);
    1.50 +  (binder_cfun T, body_cfun T)
    1.51  
    1.52  in
    1.53  
    1.54  fun matcherT (T, U) =
    1.55 -  body_cfun T ->> (binder_cfun T -->> U) ->> U;
    1.56 +  body_cfun T ->> (binder_cfun T -->> U) ->> U
    1.57  
    1.58  end
    1.59  
    1.60 @@ -59,21 +59,21 @@
    1.61  (***************************** building terms ****************************)
    1.62  (*************************************************************************)
    1.63  
    1.64 -val mk_trp = HOLogic.mk_Trueprop;
    1.65 +val mk_trp = HOLogic.mk_Trueprop
    1.66  
    1.67  (* splits a cterm into the right and lefthand sides of equality *)
    1.68 -fun dest_eqs t = HOLogic.dest_eq (HOLogic.dest_Trueprop t);
    1.69 +fun dest_eqs t = HOLogic.dest_eq (HOLogic.dest_Trueprop t)
    1.70  
    1.71  (* similar to Thm.head_of, but for continuous application *)
    1.72  fun chead_of (Const(@{const_name Rep_cfun},_)$f$t) = chead_of f
    1.73 -  | chead_of u = u;
    1.74 +  | chead_of u = u
    1.75  
    1.76 -infix 0 ==;  val (op ==) = Logic.mk_equals;
    1.77 -infix 1 ===; val (op ===) = HOLogic.mk_eq;
    1.78 +infix 0 ==  val (op ==) = Logic.mk_equals
    1.79 +infix 1 === val (op ===) = HOLogic.mk_eq
    1.80  
    1.81  fun mk_mplus (t, u) =
    1.82    let val mT = Term.fastype_of t
    1.83 -  in Const(@{const_name Fixrec.mplus}, mT ->> mT ->> mT) ` t ` u end;
    1.84 +  in Const(@{const_name Fixrec.mplus}, mT ->> mT ->> mT) ` t ` u end
    1.85  
    1.86  fun mk_run t =
    1.87    let
    1.88 @@ -85,7 +85,7 @@
    1.89        Const(@{const_name Rep_cfun}, _) $
    1.90          Const(@{const_name Fixrec.succeed}, _) $ u => u
    1.91      | _ => run ` t
    1.92 -  end;
    1.93 +  end
    1.94  
    1.95  
    1.96  (*************************************************************************)
    1.97 @@ -94,26 +94,26 @@
    1.98  
    1.99  structure FixrecUnfoldData = Generic_Data
   1.100  (
   1.101 -  type T = thm Symtab.table;
   1.102 -  val empty = Symtab.empty;
   1.103 -  val extend = I;
   1.104 -  fun merge data : T = Symtab.merge (K true) data;
   1.105 -);
   1.106 +  type T = thm Symtab.table
   1.107 +  val empty = Symtab.empty
   1.108 +  val extend = I
   1.109 +  fun merge data : T = Symtab.merge (K true) data
   1.110 +)
   1.111  
   1.112  local
   1.113  
   1.114  fun name_of (Const (n, T)) = n
   1.115    | name_of (Free (n, T)) = n
   1.116 -  | name_of t = raise TERM ("Fixrec.add_unfold: lhs not a constant", [t]);
   1.117 +  | name_of t = raise TERM ("Fixrec.add_unfold: lhs not a constant", [t])
   1.118  
   1.119  val lhs_name =
   1.120 -  name_of o head_of o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of;
   1.121 +  name_of o head_of o fst o HOLogic.dest_eq o HOLogic.dest_Trueprop o prop_of
   1.122  
   1.123  in
   1.124  
   1.125  val add_unfold : attribute =
   1.126    Thm.declaration_attribute
   1.127 -    (fn th => FixrecUnfoldData.map (Symtab.insert (K true) (lhs_name th, th)));
   1.128 +    (fn th => FixrecUnfoldData.map (Symtab.insert (K true) (lhs_name th, th)))
   1.129  
   1.130  end
   1.131  
   1.132 @@ -122,73 +122,73 @@
   1.133    (spec : (Attrib.binding * term) list)
   1.134    (lthy : local_theory) =
   1.135    let
   1.136 -    val thy = ProofContext.theory_of lthy;
   1.137 -    val names = map (Binding.name_of o fst o fst) fixes;
   1.138 -    val all_names = space_implode "_" names;
   1.139 -    val (lhss, rhss) = ListPair.unzip (map (dest_eqs o snd) spec);
   1.140 -    val functional = lambda_tuple lhss (mk_tuple rhss);
   1.141 -    val fixpoint = mk_fix (mk_cabs functional);
   1.142 +    val thy = ProofContext.theory_of lthy
   1.143 +    val names = map (Binding.name_of o fst o fst) fixes
   1.144 +    val all_names = space_implode "_" names
   1.145 +    val (lhss, rhss) = ListPair.unzip (map (dest_eqs o snd) spec)
   1.146 +    val functional = lambda_tuple lhss (mk_tuple rhss)
   1.147 +    val fixpoint = mk_fix (mk_cabs functional)
   1.148  
   1.149      val cont_thm =
   1.150        let
   1.151 -        val prop = mk_trp (mk_cont functional);
   1.152 +        val prop = mk_trp (mk_cont functional)
   1.153          fun err _ = error (
   1.154 -          "Continuity proof failed; please check that cont2cont rules\n" ^
   1.155 +          "Continuity proof failed please check that cont2cont rules\n" ^
   1.156            "or simp rules are configured for all non-HOLCF constants.\n" ^
   1.157            "The error occurred for the goal statement:\n" ^
   1.158 -          Syntax.string_of_term lthy prop);
   1.159 -        val rules = Cont2ContData.get lthy;
   1.160 -        val fast_tac = SOLVED' (REPEAT_ALL_NEW (match_tac rules));
   1.161 -        val slow_tac = SOLVED' (simp_tac (simpset_of lthy));
   1.162 -        val tac = fast_tac 1 ORELSE slow_tac 1 ORELSE err;
   1.163 +          Syntax.string_of_term lthy prop)
   1.164 +        val rules = Cont2ContData.get lthy
   1.165 +        val fast_tac = SOLVED' (REPEAT_ALL_NEW (match_tac rules))
   1.166 +        val slow_tac = SOLVED' (simp_tac (simpset_of lthy))
   1.167 +        val tac = fast_tac 1 ORELSE slow_tac 1 ORELSE err
   1.168        in
   1.169          Goal.prove lthy [] [] prop (K tac)
   1.170 -      end;
   1.171 +      end
   1.172  
   1.173      fun one_def (l as Free(n,_)) r =
   1.174            let val b = Long_Name.base_name n
   1.175            in ((Binding.name (b^"_def"), []), r) end
   1.176 -      | one_def _ _ = fixrec_err "fixdefs: lhs not of correct form";
   1.177 +      | one_def _ _ = fixrec_err "fixdefs: lhs not of correct form"
   1.178      fun defs [] _ = []
   1.179        | defs (l::[]) r = [one_def l r]
   1.180 -      | defs (l::ls) r = one_def l (mk_fst r) :: defs ls (mk_snd r);
   1.181 -    val fixdefs = defs lhss fixpoint;
   1.182 +      | defs (l::ls) r = one_def l (mk_fst r) :: defs ls (mk_snd r)
   1.183 +    val fixdefs = defs lhss fixpoint
   1.184      val (fixdef_thms : (term * (string * thm)) list, lthy) = lthy
   1.185 -      |> fold_map Local_Theory.define (map (apfst fst) fixes ~~ fixdefs);
   1.186 -    fun pair_equalI (thm1, thm2) = @{thm Pair_equalI} OF [thm1, thm2];
   1.187 -    val tuple_fixdef_thm = foldr1 pair_equalI (map (snd o snd) fixdef_thms);
   1.188 -    val P = Var (("P", 0), map Term.fastype_of lhss ---> HOLogic.boolT);
   1.189 -    val predicate = lambda_tuple lhss (list_comb (P, lhss));
   1.190 +      |> fold_map Local_Theory.define (map (apfst fst) fixes ~~ fixdefs)
   1.191 +    fun pair_equalI (thm1, thm2) = @{thm Pair_equalI} OF [thm1, thm2]
   1.192 +    val tuple_fixdef_thm = foldr1 pair_equalI (map (snd o snd) fixdef_thms)
   1.193 +    val P = Var (("P", 0), map Term.fastype_of lhss ---> HOLogic.boolT)
   1.194 +    val predicate = lambda_tuple lhss (list_comb (P, lhss))
   1.195      val tuple_induct_thm = (def_cont_fix_ind OF [tuple_fixdef_thm, cont_thm])
   1.196        |> Drule.instantiate' [] [SOME (Thm.cterm_of thy predicate)]
   1.197 -      |> Local_Defs.unfold lthy @{thms split_paired_all split_conv split_strict};
   1.198 +      |> Local_Defs.unfold lthy @{thms split_paired_all split_conv split_strict}
   1.199      val tuple_unfold_thm = (def_cont_fix_eq OF [tuple_fixdef_thm, cont_thm])
   1.200 -      |> Local_Defs.unfold lthy @{thms split_conv};
   1.201 +      |> Local_Defs.unfold lthy @{thms split_conv}
   1.202      fun unfolds [] thm = []
   1.203        | unfolds (n::[]) thm = [(n, thm)]
   1.204        | unfolds (n::ns) thm = let
   1.205 -          val thmL = thm RS @{thm Pair_eqD1};
   1.206 -          val thmR = thm RS @{thm Pair_eqD2};
   1.207 -        in (n, thmL) :: unfolds ns thmR end;
   1.208 -    val unfold_thms = unfolds names tuple_unfold_thm;
   1.209 +          val thmL = thm RS @{thm Pair_eqD1}
   1.210 +          val thmR = thm RS @{thm Pair_eqD2}
   1.211 +        in (n, thmL) :: unfolds ns thmR end
   1.212 +    val unfold_thms = unfolds names tuple_unfold_thm
   1.213      val induct_note : Attrib.binding * Thm.thm list =
   1.214        let
   1.215 -        val thm_name = Binding.qualify true all_names (Binding.name "induct");
   1.216 +        val thm_name = Binding.qualify true all_names (Binding.name "induct")
   1.217        in
   1.218          ((thm_name, []), [tuple_induct_thm])
   1.219 -      end;
   1.220 +      end
   1.221      fun unfold_note (name, thm) : Attrib.binding * Thm.thm list =
   1.222        let
   1.223 -        val thm_name = Binding.qualify true name (Binding.name "unfold");
   1.224 -        val src = Attrib.internal (K add_unfold);
   1.225 +        val thm_name = Binding.qualify true name (Binding.name "unfold")
   1.226 +        val src = Attrib.internal (K add_unfold)
   1.227        in
   1.228          ((thm_name, [src]), [thm])
   1.229 -      end;
   1.230 +      end
   1.231      val (thmss, lthy) = lthy
   1.232 -      |> fold_map Local_Theory.note (induct_note :: map unfold_note unfold_thms);
   1.233 +      |> fold_map Local_Theory.note (induct_note :: map unfold_note unfold_thms)
   1.234    in
   1.235      (lthy, names, fixdef_thms, map snd unfold_thms)
   1.236 -  end;
   1.237 +  end
   1.238  
   1.239  (*************************************************************************)
   1.240  (*********** monadic notation and pattern matching compilation ***********)
   1.241 @@ -196,14 +196,14 @@
   1.242  
   1.243  structure FixrecMatchData = Theory_Data
   1.244  (
   1.245 -  type T = string Symtab.table;
   1.246 -  val empty = Symtab.empty;
   1.247 -  val extend = I;
   1.248 -  fun merge data = Symtab.merge (K true) data;
   1.249 -);
   1.250 +  type T = string Symtab.table
   1.251 +  val empty = Symtab.empty
   1.252 +  val extend = I
   1.253 +  fun merge data = Symtab.merge (K true) data
   1.254 +)
   1.255  
   1.256  (* associate match functions with pattern constants *)
   1.257 -fun add_matchers ms = FixrecMatchData.map (fold Symtab.update ms);
   1.258 +fun add_matchers ms = FixrecMatchData.map (fold Symtab.update ms)
   1.259  
   1.260  fun taken_names (t : term) : bstring list =
   1.261    let
   1.262 @@ -211,10 +211,10 @@
   1.263        | taken (Free(a,_) , bs) = insert (op =) a bs
   1.264        | taken (f $ u     , bs) = taken (f, taken (u, bs))
   1.265        | taken (Abs(a,_,t), bs) = taken (t, insert (op =) a bs)
   1.266 -      | taken (_         , bs) = bs;
   1.267 +      | taken (_         , bs) = bs
   1.268    in
   1.269      taken (t, [])
   1.270 -  end;
   1.271 +  end
   1.272  
   1.273  (* builds a monadic term for matching a pattern *)
   1.274  (* returns (rhs, free variable, used varnames) *)
   1.275 @@ -244,87 +244,87 @@
   1.276        | _ => raise TERM ("fixrec: invalid pattern ", [p])
   1.277    in
   1.278      comp_pat pat rhs taken
   1.279 -  end;
   1.280 +  end
   1.281  
   1.282  (* builds a monadic term for matching a function definition pattern *)
   1.283  (* returns (constant, (vars, matcher)) *)
   1.284  fun compile_lhs match_name pat rhs vs taken =
   1.285    case pat of
   1.286      Const(@{const_name Rep_cfun}, _) $ f $ x =>
   1.287 -      let val (rhs', v, taken') = compile_pat match_name x rhs taken;
   1.288 +      let val (rhs', v, taken') = compile_pat match_name x rhs taken
   1.289        in compile_lhs match_name f rhs' (v::vs) taken' end
   1.290    | Free(_,_) => (pat, (vs, rhs))
   1.291    | Const(_,_) => (pat, (vs, rhs))
   1.292    | _ => fixrec_err ("invalid function pattern: "
   1.293 -                    ^ ML_Syntax.print_term pat);
   1.294 +                    ^ ML_Syntax.print_term pat)
   1.295  
   1.296  fun strip_alls t =
   1.297 -  if Logic.is_all t then strip_alls (snd (Logic.dest_all t)) else t;
   1.298 +  if Logic.is_all t then strip_alls (snd (Logic.dest_all t)) else t
   1.299  
   1.300  fun compile_eq match_name eq =
   1.301    let
   1.302 -    val (lhs,rhs) = dest_eqs (Logic.strip_imp_concl (strip_alls eq));
   1.303 +    val (lhs,rhs) = dest_eqs (Logic.strip_imp_concl (strip_alls eq))
   1.304    in
   1.305      compile_lhs match_name lhs (mk_succeed rhs) [] (taken_names eq)
   1.306 -  end;
   1.307 +  end
   1.308  
   1.309  (* this is the pattern-matching compiler function *)
   1.310  fun compile_eqs match_name eqs =
   1.311    let
   1.312      val (consts, matchers) =
   1.313 -      ListPair.unzip (map (compile_eq match_name) eqs);
   1.314 +      ListPair.unzip (map (compile_eq match_name) eqs)
   1.315      val const =
   1.316          case distinct (op =) consts of
   1.317            [n] => n
   1.318 -        | _ => fixrec_err "all equations in block must define the same function";
   1.319 +        | _ => fixrec_err "all equations in block must define the same function"
   1.320      val vars =
   1.321          case distinct (op = o pairself length) (map fst matchers) of
   1.322            [vars] => vars
   1.323 -        | _ => fixrec_err "all equations in block must have the same arity";
   1.324 +        | _ => fixrec_err "all equations in block must have the same arity"
   1.325      (* rename so all matchers use same free variables *)
   1.326 -    fun rename (vs, t) = Term.subst_free (filter_out (op =) (vs ~~ vars)) t;
   1.327 -    val rhs = big_lambdas vars (mk_run (foldr1 mk_mplus (map rename matchers)));
   1.328 +    fun rename (vs, t) = Term.subst_free (filter_out (op =) (vs ~~ vars)) t
   1.329 +    val rhs = big_lambdas vars (mk_run (foldr1 mk_mplus (map rename matchers)))
   1.330    in
   1.331      mk_trp (const === rhs)
   1.332 -  end;
   1.333 +  end
   1.334  
   1.335  (*************************************************************************)
   1.336  (********************** Proving associated theorems **********************)
   1.337  (*************************************************************************)
   1.338  
   1.339 -fun eta_tac i = CONVERSION Thm.eta_conversion i;
   1.340 +fun eta_tac i = CONVERSION Thm.eta_conversion i
   1.341  
   1.342  fun fixrec_simp_tac ctxt =
   1.343    let
   1.344 -    val tab = FixrecUnfoldData.get (Context.Proof ctxt);
   1.345 -    val ss = Simplifier.simpset_of ctxt;
   1.346 +    val tab = FixrecUnfoldData.get (Context.Proof ctxt)
   1.347 +    val ss = Simplifier.simpset_of ctxt
   1.348      fun concl t =
   1.349        if Logic.is_all t then concl (snd (Logic.dest_all t))
   1.350 -      else HOLogic.dest_Trueprop (Logic.strip_imp_concl t);
   1.351 +      else HOLogic.dest_Trueprop (Logic.strip_imp_concl t)
   1.352      fun tac (t, i) =
   1.353        let
   1.354          val (c, T) =
   1.355 -            (dest_Const o head_of o chead_of o fst o HOLogic.dest_eq o concl) t;
   1.356 -        val unfold_thm = the (Symtab.lookup tab c);
   1.357 -        val rule = unfold_thm RS @{thm ssubst_lhs};
   1.358 +            (dest_Const o head_of o chead_of o fst o HOLogic.dest_eq o concl) t
   1.359 +        val unfold_thm = the (Symtab.lookup tab c)
   1.360 +        val rule = unfold_thm RS @{thm ssubst_lhs}
   1.361        in
   1.362          CHANGED (rtac rule i THEN eta_tac i THEN asm_simp_tac ss i)
   1.363        end
   1.364    in
   1.365      SUBGOAL (fn ti => the_default no_tac (try tac ti))
   1.366 -  end;
   1.367 +  end
   1.368  
   1.369  (* proves a block of pattern matching equations as theorems, using unfold *)
   1.370  fun make_simps ctxt (unfold_thm, eqns : (Attrib.binding * term) list) =
   1.371    let
   1.372 -    val ss = Simplifier.simpset_of ctxt;
   1.373 -    val rule = unfold_thm RS @{thm ssubst_lhs};
   1.374 -    val tac = rtac rule 1 THEN eta_tac 1 THEN asm_simp_tac ss 1;
   1.375 -    fun prove_term t = Goal.prove ctxt [] [] t (K tac);
   1.376 -    fun prove_eqn (bind, eqn_t) = (bind, prove_term eqn_t);
   1.377 +    val ss = Simplifier.simpset_of ctxt
   1.378 +    val rule = unfold_thm RS @{thm ssubst_lhs}
   1.379 +    val tac = rtac rule 1 THEN eta_tac 1 THEN asm_simp_tac ss 1
   1.380 +    fun prove_term t = Goal.prove ctxt [] [] t (K tac)
   1.381 +    fun prove_eqn (bind, eqn_t) = (bind, prove_term eqn_t)
   1.382    in
   1.383      map prove_eqn eqns
   1.384 -  end;
   1.385 +  end
   1.386  
   1.387  (*************************************************************************)
   1.388  (************************* Main fixrec function **************************)
   1.389 @@ -339,54 +339,54 @@
   1.390    (raw_spec' : (bool * (Attrib.binding * 'b)) list)
   1.391    (lthy : local_theory) =
   1.392    let
   1.393 -    val (skips, raw_spec) = ListPair.unzip raw_spec';
   1.394 +    val (skips, raw_spec) = ListPair.unzip raw_spec'
   1.395      val (fixes : ((binding * typ) * mixfix) list,
   1.396           spec : (Attrib.binding * term) list) =
   1.397 -          fst (prep_spec raw_fixes raw_spec lthy);
   1.398 +          fst (prep_spec raw_fixes raw_spec lthy)
   1.399      val chead_of_spec =
   1.400 -      chead_of o fst o dest_eqs o Logic.strip_imp_concl o strip_alls o snd;
   1.401 +      chead_of o fst o dest_eqs o Logic.strip_imp_concl o strip_alls o snd
   1.402      fun name_of (Free (n, _)) = n
   1.403 -      | name_of t = fixrec_err ("unknown term");
   1.404 -    val all_names = map (name_of o chead_of_spec) spec;
   1.405 -    val names = distinct (op =) all_names;
   1.406 +      | name_of t = fixrec_err ("unknown term")
   1.407 +    val all_names = map (name_of o chead_of_spec) spec
   1.408 +    val names = distinct (op =) all_names
   1.409      fun block_of_name n =
   1.410        map_filter
   1.411          (fn (m,eq) => if m = n then SOME eq else NONE)
   1.412 -        (all_names ~~ (spec ~~ skips));
   1.413 -    val blocks = map block_of_name names;
   1.414 +        (all_names ~~ (spec ~~ skips))
   1.415 +    val blocks = map block_of_name names
   1.416  
   1.417 -    val matcher_tab = FixrecMatchData.get (ProofContext.theory_of lthy);
   1.418 +    val matcher_tab = FixrecMatchData.get (ProofContext.theory_of lthy)
   1.419      fun match_name c =
   1.420        case Symtab.lookup matcher_tab c of SOME m => m
   1.421 -        | NONE => fixrec_err ("unknown pattern constructor: " ^ c);
   1.422 +        | NONE => fixrec_err ("unknown pattern constructor: " ^ c)
   1.423  
   1.424 -    val matches = map (compile_eqs match_name) (map (map (snd o fst)) blocks);
   1.425 -    val spec' = map (pair Attrib.empty_binding) matches;
   1.426 +    val matches = map (compile_eqs match_name) (map (map (snd o fst)) blocks)
   1.427 +    val spec' = map (pair Attrib.empty_binding) matches
   1.428      val (lthy, cnames, fixdef_thms, unfold_thms) =
   1.429 -      add_fixdefs fixes spec' lthy;
   1.430 +      add_fixdefs fixes spec' lthy
   1.431  
   1.432 -    val blocks' = map (map fst o filter_out snd) blocks;
   1.433 +    val blocks' = map (map fst o filter_out snd) blocks
   1.434      val simps : (Attrib.binding * thm) list list =
   1.435 -      map (make_simps lthy) (unfold_thms ~~ blocks');
   1.436 +      map (make_simps lthy) (unfold_thms ~~ blocks')
   1.437      fun mk_bind n : Attrib.binding =
   1.438       (Binding.qualify true n (Binding.name "simps"),
   1.439 -       [Attrib.internal (K Simplifier.simp_add)]);
   1.440 +       [Attrib.internal (K Simplifier.simp_add)])
   1.441      val simps1 : (Attrib.binding * thm list) list =
   1.442 -      map (fn (n,xs) => (mk_bind n, map snd xs)) (names ~~ simps);
   1.443 +      map (fn (n,xs) => (mk_bind n, map snd xs)) (names ~~ simps)
   1.444      val simps2 : (Attrib.binding * thm list) list =
   1.445 -      map (apsnd (fn thm => [thm])) (flat simps);
   1.446 +      map (apsnd (fn thm => [thm])) (flat simps)
   1.447      val (_, lthy) = lthy
   1.448 -      |> fold_map Local_Theory.note (simps1 @ simps2);
   1.449 +      |> fold_map Local_Theory.note (simps1 @ simps2)
   1.450    in
   1.451      lthy
   1.452 -  end;
   1.453 +  end
   1.454  
   1.455  in
   1.456  
   1.457 -val add_fixrec = gen_fixrec Specification.check_spec;
   1.458 -val add_fixrec_cmd = gen_fixrec Specification.read_spec;
   1.459 +val add_fixrec = gen_fixrec Specification.check_spec
   1.460 +val add_fixrec_cmd = gen_fixrec Specification.read_spec
   1.461  
   1.462 -end; (* local *)
   1.463 +end (* local *)
   1.464  
   1.465  
   1.466  (*************************************************************************)
   1.467 @@ -395,23 +395,23 @@
   1.468  
   1.469  val opt_thm_name' : (bool * Attrib.binding) parser =
   1.470    Parse.$$$ "(" -- Parse.$$$ "unchecked" -- Parse.$$$ ")" >> K (true, Attrib.empty_binding)
   1.471 -    || Parse_Spec.opt_thm_name ":" >> pair false;
   1.472 +    || Parse_Spec.opt_thm_name ":" >> pair false
   1.473  
   1.474  val spec' : (bool * (Attrib.binding * string)) parser =
   1.475 -  opt_thm_name' -- Parse.prop >> (fn ((a, b), c) => (a, (b, c)));
   1.476 +  opt_thm_name' -- Parse.prop >> (fn ((a, b), c) => (a, (b, c)))
   1.477  
   1.478  val alt_specs' : (bool * (Attrib.binding * string)) list parser =
   1.479 -  let val unexpected = Scan.ahead (Parse.name || Parse.$$$ "[" || Parse.$$$ "(");
   1.480 -  in Parse.enum1 "|" (spec' --| Scan.option (unexpected -- Parse.!!! (Parse.$$$ "|"))) end;
   1.481 +  let val unexpected = Scan.ahead (Parse.name || Parse.$$$ "[" || Parse.$$$ "(")
   1.482 +  in Parse.enum1 "|" (spec' --| Scan.option (unexpected -- Parse.!!! (Parse.$$$ "|"))) end
   1.483  
   1.484  val _ =
   1.485    Outer_Syntax.local_theory "fixrec" "define recursive functions (HOLCF)" Keyword.thy_decl
   1.486      (Parse.fixes -- (Parse.where_ |-- Parse.!!! alt_specs')
   1.487 -      >> (fn (fixes, specs) => add_fixrec_cmd fixes specs));
   1.488 +      >> (fn (fixes, specs) => add_fixrec_cmd fixes specs))
   1.489  
   1.490  val setup =
   1.491    Method.setup @{binding fixrec_simp}
   1.492      (Scan.succeed (SIMPLE_METHOD' o fixrec_simp_tac))
   1.493 -    "pattern prover for fixrec constants";
   1.494 +    "pattern prover for fixrec constants"
   1.495  
   1.496 -end;
   1.497 +end