diff -r b7f3a30f3d7f -r ec73b9707d48 src/HOL/Library/List_Comprehension.thy --- a/src/HOL/Library/List_Comprehension.thy Fri Jun 01 20:34:12 2007 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -(* Title: HOL/Library/List_Comprehension.thy - ID: $Id$ - Author: Tobias Nipkow -*) - -header {* List Comprehension *} - -theory List_Comprehension -imports Main -begin - -text{* At the moment this theory provides only the input syntax for -list comprehension: @{text"[x. x \ xs, \]"} rather than -\verb![x| x <- xs, ...]! as in Haskell. - -The print translation from internal form to list comprehensions would -be nice. Unfortunately one cannot just turn the translations around -because in the final equality @{text p} occurs twice on the -right-hand side. Due to this restriction, the translation must be hand-coded. - -A more substantial extension would be proper theorem proving -support. For example, it would be nice if -@{text"set[f x y. x \ xs, y \ ys, P x y]"} -produced something like -@{term"{z. EX x: set xs. EX y:set ys. P x y \ z = f x y}"}. *} - -nonterminals lc_gentest - -syntax -"_listcompr" :: "'a \ idt \ 'b list \ lc_gentest \ 'a list" ("[_ . _ \ __") -"_lc_end" :: "lc_gentest" ("]") -"_lc_gen" :: "idt \ 'a list \ lc_gentest \ lc_gentest" (",_ \ __") -"_lc_test" :: "bool \ lc_gentest \ lc_gentest" (",__") - - -translations - "[e. p\xs]" => "map (%p. e) xs" - "_listcompr e p xs (_lc_gen q ys GT)" => - "concat (map (%p. _listcompr e q ys GT) xs)" - "_listcompr e p xs (_lc_test P GT)" => "_listcompr e p (filter (%p. P) xs) GT" - -(* -term "[(x,y). x \ xs, x xs, xzs]" -term "[(x,y). x \ xs, y \ ys, x xs, y \ ys, z\ zs]" -term "[x. x \ xs, x < a, x > b]" -*) - -end