diff -r 047f183c43b0 -r 7311a1546d85 src/HOL/ex/Predicate_Compile.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/ex/Predicate_Compile.thy Sun Mar 08 15:25:28 2009 +0100 @@ -0,0 +1,21 @@ +theory Predicate_Compile +imports Complex_Main Lattice_Syntax +uses "predicate_compile.ML" +begin + +setup {* Predicate_Compile.setup *} + +primrec "next" :: "('a Predicate.pred \ ('a \ 'a Predicate.pred) option) + \ 'a Predicate.seq \ ('a \ 'a Predicate.pred) option" where + "next yield Predicate.Empty = None" + | "next yield (Predicate.Insert x P) = Some (x, P)" + | "next yield (Predicate.Join P xq) = (case yield P + of None \ next yield xq | Some (x, Q) \ Some (x, Predicate.Seq (\_. Predicate.Join Q xq)))" + +primrec pull :: "('a Predicate.pred \ ('a \ 'a Predicate.pred) option) + \ nat \ 'a Predicate.pred \ 'a list \ 'a Predicate.pred" where + "pull yield 0 P = ([], \)" + | "pull yield (Suc n) P = (case yield P + of None \ ([], \) | Some (x, Q) \ let (xs, R) = pull yield n Q in (x # xs, R))" + +end \ No newline at end of file