equal
deleted
inserted
replaced
88 declare one_extended_def[symmetric, code_post] |
88 declare one_extended_def[symmetric, code_post] |
89 |
89 |
90 instantiation extended :: (plus)plus |
90 instantiation extended :: (plus)plus |
91 begin |
91 begin |
92 |
92 |
93 text {* The following definition of of addition is totalized |
93 text \<open>The following definition of of addition is totalized |
94 to make it asociative and commutative. Normally the sum of plus and minus infinity is undefined. *} |
94 to make it asociative and commutative. Normally the sum of plus and minus infinity is undefined.\<close> |
95 |
95 |
96 fun plus_extended where |
96 fun plus_extended where |
97 "Fin x + Fin y = Fin(x+y)" | |
97 "Fin x + Fin y = Fin(x+y)" | |
98 "Fin x + Pinf = Pinf" | |
98 "Fin x + Pinf = Pinf" | |
99 "Pinf + Fin x = Pinf" | |
99 "Pinf + Fin x = Pinf" | |
153 "Minf - Minf = Pinf" |
153 "Minf - Minf = Pinf" |
154 "Pinf - Pinf = Pinf" |
154 "Pinf - Pinf = Pinf" |
155 by (simp_all add: minus_extended_def) |
155 by (simp_all add: minus_extended_def) |
156 |
156 |
157 |
157 |
158 text{* Numerals: *} |
158 text\<open>Numerals:\<close> |
159 |
159 |
160 instance extended :: ("{ab_semigroup_add,one}")numeral .. |
160 instance extended :: ("{ab_semigroup_add,one}")numeral .. |
161 |
161 |
162 lemma Fin_numeral[code_post]: "Fin(numeral w) = numeral w" |
162 lemma Fin_numeral[code_post]: "Fin(numeral w) = numeral w" |
163 apply (induct w rule: num_induct) |
163 apply (induct w rule: num_induct) |