equal
deleted
inserted
replaced
27 by (simp add: id_def fun_eq_iff) |
27 by (simp add: id_def fun_eq_iff) |
28 |
28 |
29 lemma vimage_id [simp]: "vimage id = id" |
29 lemma vimage_id [simp]: "vimage id = id" |
30 by (simp add: id_def fun_eq_iff) |
30 by (simp add: id_def fun_eq_iff) |
31 |
31 |
|
32 code_printing |
|
33 constant id \<rightharpoonup> (Haskell) "id" |
|
34 |
32 |
35 |
33 subsection {* The Composition Operator @{text "f \<circ> g"} *} |
36 subsection {* The Composition Operator @{text "f \<circ> g"} *} |
34 |
37 |
35 definition comp :: "('b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c" (infixl "o" 55) where |
38 definition comp :: "('b \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'c" (infixl "o" 55) where |
36 "f o g = (\<lambda>x. f (g x))" |
39 "f o g = (\<lambda>x. f (g x))" |
75 |
78 |
76 lemma SUP_comp: |
79 lemma SUP_comp: |
77 "SUPR A (g \<circ> f) = SUPR (f ` A) g" |
80 "SUPR A (g \<circ> f) = SUPR (f ` A) g" |
78 by (simp add: SUP_def image_comp) |
81 by (simp add: SUP_def image_comp) |
79 |
82 |
|
83 code_printing |
|
84 constant comp \<rightharpoonup> (SML) infixl 5 "o" and (Haskell) infixr 9 "." |
|
85 |
80 |
86 |
81 subsection {* The Forward Composition Operator @{text fcomp} *} |
87 subsection {* The Forward Composition Operator @{text fcomp} *} |
82 |
88 |
83 definition fcomp :: "('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> 'c) \<Rightarrow> 'a \<Rightarrow> 'c" (infixl "\<circ>>" 60) where |
89 definition fcomp :: "('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> 'c) \<Rightarrow> 'a \<Rightarrow> 'c" (infixl "\<circ>>" 60) where |
84 "f \<circ>> g = (\<lambda>x. g (f x))" |
90 "f \<circ>> g = (\<lambda>x. g (f x))" |
93 by (simp add: fcomp_def) |
99 by (simp add: fcomp_def) |
94 |
100 |
95 lemma fcomp_id [simp]: "f \<circ>> id = f" |
101 lemma fcomp_id [simp]: "f \<circ>> id = f" |
96 by (simp add: fcomp_def) |
102 by (simp add: fcomp_def) |
97 |
103 |
98 code_const fcomp |
104 code_printing |
99 (Eval infixl 1 "#>") |
105 constant fcomp \<rightharpoonup> (Eval) infixl 1 "#>" |
100 |
106 |
101 no_notation fcomp (infixl "\<circ>>" 60) |
107 no_notation fcomp (infixl "\<circ>>" 60) |
102 |
108 |
103 |
109 |
104 subsection {* Mapping functions *} |
110 subsection {* Mapping functions *} |
812 end |
818 end |
813 in proc end |
819 in proc end |
814 *} |
820 *} |
815 |
821 |
816 |
822 |
817 subsubsection {* Code generator *} |
|
818 |
|
819 code_const "op \<circ>" |
|
820 (SML infixl 5 "o") |
|
821 (Haskell infixr 9 ".") |
|
822 |
|
823 code_const "id" |
|
824 (Haskell "id") |
|
825 |
|
826 |
|
827 subsubsection {* Functorial structure of types *} |
823 subsubsection {* Functorial structure of types *} |
828 |
824 |
829 ML_file "Tools/enriched_type.ML" |
825 ML_file "Tools/enriched_type.ML" |
830 |
826 |
831 enriched_type map_fun: map_fun |
827 enriched_type map_fun: map_fun |