src/HOLCF/fixrec_package.ML
changeset 18728 6790126ab5f6
parent 18688 abf0f018b5ec
child 18974 593af1a1068b
equal deleted inserted replaced
18727:caf9bc780c80 18728:6790126ab5f6
     5 Recursive function definition package for HOLCF.
     5 Recursive function definition package for HOLCF.
     6 *)
     6 *)
     7 
     7 
     8 signature FIXREC_PACKAGE =
     8 signature FIXREC_PACKAGE =
     9 sig
     9 sig
    10   val add_fixrec: bool -> ((string * Attrib.src list) * string) list list
    10   val add_fixrec: bool -> ((string * Attrib.src list) * string) list list -> theory -> theory
    11     -> theory -> theory
    11   val add_fixrec_i: bool -> ((string * attribute list) * term) list list -> theory -> theory
    12   val add_fixrec_i: bool -> ((string * theory attribute list) * term) list list
    12   val add_fixpat: (string * Attrib.src list) * string list -> theory -> theory
    13     -> theory -> theory
    13   val add_fixpat_i: (string * attribute list) * term list -> theory -> theory
    14   val add_fixpat: (string * Attrib.src list) * string list
       
    15     -> theory -> theory
       
    16   val add_fixpat_i: (string * theory attribute list) * term list
       
    17     -> theory -> theory
       
    18 end;
    14 end;
    19 
    15 
    20 structure FixrecPackage: FIXREC_PACKAGE =
    16 structure FixrecPackage: FIXREC_PACKAGE =
    21 struct
    17 struct
    22 
    18 
   248       val eqn_blocks = unconcat lengths ((names ~~ eqn_ts') ~~ atts);
   244       val eqn_blocks = unconcat lengths ((names ~~ eqn_ts') ~~ atts);
   249       val simps = List.concat (map (make_simps thy') (unfold_thms ~~ eqn_blocks));
   245       val simps = List.concat (map (make_simps thy') (unfold_thms ~~ eqn_blocks));
   250       val (simp_thms, thy'') = PureThy.add_thms simps thy';
   246       val (simp_thms, thy'') = PureThy.add_thms simps thy';
   251       
   247       
   252       val simp_names = map (fn name => name^"_simps") cnames;
   248       val simp_names = map (fn name => name^"_simps") cnames;
   253       val simp_attribute = rpair [Attrib.theory Simplifier.simp_add];
   249       val simp_attribute = rpair [Simplifier.simp_add];
   254       val simps' = map simp_attribute (simp_names ~~ unconcat lengths simp_thms);
   250       val simps' = map simp_attribute (simp_names ~~ unconcat lengths simp_thms);
   255     in
   251     in
   256       (snd o PureThy.add_thmss simps') thy''
   252       (snd o PureThy.add_thmss simps') thy''
   257     end
   253     end
   258     else thy'
   254     else thy'
   259   end;
   255   end;
   260 
   256 
   261 val add_fixrec = gen_add_fixrec Sign.read_prop Attrib.global_attribute;
   257 val add_fixrec = gen_add_fixrec Sign.read_prop Attrib.attribute;
   262 val add_fixrec_i = gen_add_fixrec Sign.cert_prop (K I);
   258 val add_fixrec_i = gen_add_fixrec Sign.cert_prop (K I);
   263 
   259 
   264 
   260 
   265 (*************************************************************************)
   261 (*************************************************************************)
   266 (******************************** Fixpat *********************************)
   262 (******************************** Fixpat *********************************)
   284     val simps = map (fix_pat thy) ts;
   280     val simps = map (fix_pat thy) ts;
   285   in
   281   in
   286     (snd o PureThy.add_thmss [((name, simps), atts)]) thy
   282     (snd o PureThy.add_thmss [((name, simps), atts)]) thy
   287   end;
   283   end;
   288 
   284 
   289 val add_fixpat = gen_add_fixpat Sign.read_term Attrib.global_attribute;
   285 val add_fixpat = gen_add_fixpat Sign.read_term Attrib.attribute;
   290 val add_fixpat_i = gen_add_fixpat Sign.cert_term (K I);
   286 val add_fixpat_i = gen_add_fixpat Sign.cert_term (K I);
   291 
   287 
   292 
   288 
   293 (*************************************************************************)
   289 (*************************************************************************)
   294 (******************************** Parsers ********************************)
   290 (******************************** Parsers ********************************)