definition append :: "[i,i]\i" (infixr \@\ 55) where"l @ m == lrec(l, m, \x xs g. x$g)"
axiomatization member :: "[i,i]\i" (infixr \mem\ 55) (* FIXME dangling eq *) where member_ax: "a mem l == lrec(l, false, \h t g. if eq(a,h) then true else g)"
definition filter :: "[i,i]\i" where"filter(f,l) == lrec(l, [], \x xs g. if f`x then x$g else g)"
definition flat :: "i\i" where"flat(l) == lrec(l, [], \h t g. h @ g)"
definition partition :: "[i,i]\i" where "partition(f,l) == letrec part l a b be lcase(l, , \x xs. if f`x then part(xs,x$a,b) else part(xs,a,x$b)) in part(l,[],[])"
definition insert :: "[i,i,i]\i" where"insert(f,a,l) == lrec(l, a$[], \h t g. if f`a`h then a$h$t else h$g)"
definition isort :: "i\i" where"isort(f) == lam l. lrec(l, [], \h t g. insert(f,h,g))"
definition qsort :: "i\i" where "qsort(f) == lam l. letrec qsortx l be lcase(l, [], \h t. let p be partition(f`h,t) in split(p, \<lambda>x y. qsortx(x) @ h$qsortx(y))) in qsortx(l)"
lemma insertTS: "\f : {f:A->A->Bool. a : {a:A. l : {l:List(A).P(insert(f,a,l))}}} \ \
insert(f,a,l) : {x:List(A). P(x)}" by (blast intro!: insertT)
lemma partitionT: "\f:A->Bool; l : List(A)\ \ partition(f,l) : List(A)*List(A)" apply (unfold partition_def) apply typechk apply clean_ccs apply (rule ListPRI [THEN wfstI, THEN ListPR_wf [THEN wmap_wf, THEN wfI]]) apply assumption+ apply (rule ListPRI [THEN wfstI, THEN ListPR_wf [THEN wmap_wf, THEN wfI]]) apply assumption+ done
end
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.34Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.