mappred: "\x xs y ys P. mappred P [] [] ..
mappred P (x#xs) (y#ys) :- P x y & mappred P xs ys" and
mapfun: "\x xs ys f. mapfun f [] [] ..
mapfun f (x#xs) (f x#ys) :- mapfun f xs ys" and
age: "age bob 24 ..
age sue 23 ..
age ned 23" and
eq: "\x. eq x x" and
(* actual definitions of empty and add is hidden -> yields abstract data type *)
bag_appl: "\A B X Y. bag_appl A B X Y:- (\S1 S2 S3 S4 S5.
empty S1 &
add A S1 S2 &
add B S2 S3 &
remove X S3 S4 &
remove Y S4 S5 &
empty S5)"
lemmas prog_Test = append reverse mappred mapfun age eq bag_appl
schematic_goal "append ?x ?y [a,b,c,d]" apply (prolog prog_Test) back back back back done
schematic_goal "append [a,b] y ?L" apply (prolog prog_Test) done
(* P flexible: *) lemma"(\P k l. P k l :- eq P Q) => Q a b" apply (prolog prog_Test) done (* loops: lemma "(!P k l. P k l :- eq P (%x y. x | y)) => a | b"
*)
(* implication and disjunction in atom: *) lemma"\Q. (\p q. R(q :- p) => R(Q p q)) \ Q (t | s) (s | t)" by fast
(* disjunction in atom: *) lemma"(\P. g P :- (P => b \ a)) => g(a \ b)" apply (tactic "step_tac (put_claset HOL_cs \<^context>) 1") apply (tactic "step_tac (put_claset HOL_cs \<^context>) 1") apply (tactic "step_tac (put_claset HOL_cs \<^context>) 1") prefer 2 apply fast apply fast done
(* hangs: lemma "(!P. g P :- (P => b | a)) => g(a | b)" by fast
*)
schematic_goal "\Emp Stk.(
empty (Emp::'b) ..
(\<forall>(X::nat) S. add X (S::'b) (Stk X S)) ..
(\<forall>(X::nat) S. remove X ((Stk X S)::'b) S))
=> bag_appl 23 24 ?X ?Y" oops
schematic_goal "\Qu. (
(\<forall>L. empty (Qu L L)) ..
(\<forall>(X::nat) L K. add X (Qu L (X#K)) (Qu L K)) ..
(\<forall>(X::nat) L K. remove X (Qu (X#L) K) (Qu L K)))
=> bag_appl 23 24 ?X ?Y" oops
schematic_goal "P x .. P y => P ?X" apply (prolog prog_Test) back 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.14Bemerkung:
(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.