equal
deleted
inserted
replaced
53 by (simp add: assoc [symmetric]) |
53 by (simp add: assoc [symmetric]) |
54 |
54 |
55 end |
55 end |
56 |
56 |
57 |
57 |
58 subsection {* Generic algebraic operations *} |
58 subsection {* Generic syntactic operations *} |
59 |
59 |
60 class zero = |
60 class zero = |
61 fixes zero :: 'a ("0") |
61 fixes zero :: 'a ("0") |
62 |
62 |
63 class one = |
63 class one = |
64 fixes one :: 'a ("1") |
64 fixes one :: 'a ("1") |
|
65 |
|
66 hide (open) const zero one |
|
67 |
|
68 syntax |
|
69 "_index1" :: index ("\<^sub>1") |
|
70 translations |
|
71 (index) "\<^sub>1" => (index) "\<^bsub>\<struct>\<^esub>" |
65 |
72 |
66 lemma Let_0 [simp]: "Let 0 f = f 0" |
73 lemma Let_0 [simp]: "Let 0 f = f 0" |
67 unfolding Let_def .. |
74 unfolding Let_def .. |
68 |
75 |
69 lemma Let_1 [simp]: "Let 1 f = f 1" |
76 lemma Let_1 [simp]: "Let 1 f = f 1" |
87 then raise Match |
94 then raise Match |
88 else Syntax.const Syntax.constrainC $ Syntax.const c $ Syntax.term_of_typ show_sorts T); |
95 else Syntax.const Syntax.constrainC $ Syntax.const c $ Syntax.term_of_typ show_sorts T); |
89 in map tr' [@{const_syntax Algebras.one}, @{const_syntax Algebras.zero}] end; |
96 in map tr' [@{const_syntax Algebras.one}, @{const_syntax Algebras.zero}] end; |
90 *} -- {* show types that are presumably too general *} |
97 *} -- {* show types that are presumably too general *} |
91 |
98 |
92 hide (open) const zero one |
|
93 |
|
94 class plus = |
99 class plus = |
95 fixes plus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "+" 65) |
100 fixes plus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "+" 65) |
96 |
101 |
97 class minus = |
102 class minus = |
98 fixes minus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "-" 65) |
103 fixes minus :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "-" 65) |
101 fixes uminus :: "'a \<Rightarrow> 'a" ("- _" [81] 80) |
106 fixes uminus :: "'a \<Rightarrow> 'a" ("- _" [81] 80) |
102 |
107 |
103 class times = |
108 class times = |
104 fixes times :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "*" 70) |
109 fixes times :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "*" 70) |
105 |
110 |
106 class abs = |
|
107 fixes abs :: "'a \<Rightarrow> 'a" |
|
108 begin |
|
109 |
|
110 notation (xsymbols) |
|
111 abs ("\<bar>_\<bar>") |
|
112 |
|
113 notation (HTML output) |
|
114 abs ("\<bar>_\<bar>") |
|
115 |
|
116 end |
111 end |
117 |
|
118 class sgn = |
|
119 fixes sgn :: "'a \<Rightarrow> 'a" |
|
120 |
|
121 class ord = |
|
122 fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
|
123 and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" |
|
124 begin |
|
125 |
|
126 notation |
|
127 less_eq ("op <=") and |
|
128 less_eq ("(_/ <= _)" [51, 51] 50) and |
|
129 less ("op <") and |
|
130 less ("(_/ < _)" [51, 51] 50) |
|
131 |
|
132 notation (xsymbols) |
|
133 less_eq ("op \<le>") and |
|
134 less_eq ("(_/ \<le> _)" [51, 51] 50) |
|
135 |
|
136 notation (HTML output) |
|
137 less_eq ("op \<le>") and |
|
138 less_eq ("(_/ \<le> _)" [51, 51] 50) |
|
139 |
|
140 abbreviation (input) |
|
141 greater_eq (infix ">=" 50) where |
|
142 "x >= y \<equiv> y <= x" |
|
143 |
|
144 notation (input) |
|
145 greater_eq (infix "\<ge>" 50) |
|
146 |
|
147 abbreviation (input) |
|
148 greater (infix ">" 50) where |
|
149 "x > y \<equiv> y < x" |
|
150 |
|
151 end |
|
152 |
|
153 end |
|