equal
deleted
inserted
replaced
1 (* Title: ZF/datatype_package.ML |
1 (* Title: ZF/Tools/datatype_package.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
4 Copyright 1994 University of Cambridge |
4 Copyright 1994 University of Cambridge |
5 |
5 |
6 Fixedpoint definition module -- for Inductive/Codatatype Definitions |
6 Datatype/Codatatype Definitions |
7 |
7 |
8 The functor will be instantiated for normal sums/products (datatype defs) |
8 The functor will be instantiated for normal sums/products (datatype defs) |
9 and non-standard sums/products (codatatype defs) |
9 and non-standard sums/products (codatatype defs) |
10 |
10 |
11 Sums are used only for mutual recursion; |
11 Sums are used only for mutual recursion; |
241 (*Find each recursive argument and add a recursive call for it*) |
241 (*Find each recursive argument and add a recursive call for it*) |
242 fun rec_args [] = [] |
242 fun rec_args [] = [] |
243 | rec_args ((Const("op :",_)$arg$X)::prems) = |
243 | rec_args ((Const("op :",_)$arg$X)::prems) = |
244 (case head_of X of |
244 (case head_of X of |
245 Const(a,_) => (*recursive occurrence?*) |
245 Const(a,_) => (*recursive occurrence?*) |
246 if Sign.base_name a mem_string rec_base_names |
246 if a mem_string rec_names |
247 then arg :: rec_args prems |
247 then arg :: rec_args prems |
248 else rec_args prems |
248 else rec_args prems |
249 | _ => rec_args prems) |
249 | _ => rec_args prems) |
250 | rec_args (_::prems) = rec_args prems; |
250 | rec_args (_::prems) = rec_args prems; |
251 |
251 |