equal
deleted
inserted
replaced
625 inductive eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" where "eq x x" |
625 inductive eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" where "eq x x" |
626 |
626 |
627 lemma eq_is_eq: "eq x y \<equiv> (x = y)" |
627 lemma eq_is_eq: "eq x y \<equiv> (x = y)" |
628 by (rule eq_reflection) (auto intro: eq.intros elim: eq.cases) |
628 by (rule eq_reflection) (auto intro: eq.intros elim: eq.cases) |
629 |
629 |
|
630 definition map :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a pred \<Rightarrow> 'b pred" where |
|
631 "map f P = P \<guillemotright>= (single o f)" |
|
632 |
630 ML {* |
633 ML {* |
631 signature PREDICATE = |
634 signature PREDICATE = |
632 sig |
635 sig |
633 datatype 'a pred = Seq of (unit -> 'a seq) |
636 datatype 'a pred = Seq of (unit -> 'a seq) |
634 and 'a seq = Empty | Insert of 'a * 'a pred | Join of 'a pred * 'a seq |
637 and 'a seq = Empty | Insert of 'a * 'a pred | Join of 'a pred * 'a seq |
681 in |
684 in |
682 |
685 |
683 val _ = OuterSyntax.local_theory_to_proof "code_pred" "sets up goal for cases rule from given introduction rules and compiles predicate" |
686 val _ = OuterSyntax.local_theory_to_proof "code_pred" "sets up goal for cases rule from given introduction rules and compiles predicate" |
684 OuterKeyword.thy_goal (P.term_group >> (K (Proof.theorem_i NONE (K I) [[]]))); |
687 OuterKeyword.thy_goal (P.term_group >> (K (Proof.theorem_i NONE (K I) [[]]))); |
685 |
688 |
686 val _ = OuterSyntax.improper_command "values" "evaluate and print enumerations" |
689 val _ = OuterSyntax.improper_command "values" "enumerate and print comprehensions" |
687 OuterKeyword.diag ((opt_modes -- P.term) |
690 OuterKeyword.diag ((opt_modes -- P.term) |
688 >> (fn (modes, t) => Toplevel.no_timing o Toplevel.keep |
691 >> (fn (modes, t) => Toplevel.no_timing o Toplevel.keep |
689 (K ()))); |
692 (K ()))); |
690 |
693 |
691 end |
694 end |
700 bot ("\<bottom>") and |
703 bot ("\<bottom>") and |
701 bind (infixl "\<guillemotright>=" 70) |
704 bind (infixl "\<guillemotright>=" 70) |
702 |
705 |
703 hide (open) type pred seq |
706 hide (open) type pred seq |
704 hide (open) const Pred eval single bind if_pred not_pred |
707 hide (open) const Pred eval single bind if_pred not_pred |
705 Empty Insert Join Seq member pred_of_seq "apply" adjunct eq |
708 Empty Insert Join Seq member pred_of_seq "apply" adjunct eq map |
706 |
709 |
707 end |
710 end |