equal
deleted
inserted
replaced
1198 end |
1198 end |
1199 |
1199 |
1200 text {* for code generation *} |
1200 text {* for code generation *} |
1201 |
1201 |
1202 definition funpow :: "nat \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a" where |
1202 definition funpow :: "nat \<Rightarrow> ('a \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'a" where |
1203 funpow_code_def [code post]: "funpow = compow" |
1203 funpow_code_def [code_post]: "funpow = compow" |
1204 |
1204 |
1205 lemmas [code unfold] = funpow_code_def [symmetric] |
1205 lemmas [code_unfold] = funpow_code_def [symmetric] |
1206 |
1206 |
1207 lemma [code]: |
1207 lemma [code]: |
1208 "funpow 0 f = id" |
1208 "funpow 0 f = id" |
1209 "funpow (Suc n) f = f o funpow n f" |
1209 "funpow (Suc n) f = f o funpow n f" |
1210 unfolding funpow_code_def by simp_all |
1210 unfolding funpow_code_def by simp_all |
1263 with Suc show ?case by (simp add: add_commute) |
1263 with Suc show ?case by (simp add: add_commute) |
1264 qed |
1264 qed |
1265 |
1265 |
1266 end |
1266 end |
1267 |
1267 |
1268 declare of_nat_code [code, code unfold, code inline del] |
1268 declare of_nat_code [code, code_unfold, code_inline del] |
1269 |
1269 |
1270 text{*Class for unital semirings with characteristic zero. |
1270 text{*Class for unital semirings with characteristic zero. |
1271 Includes non-ordered rings like the complex numbers.*} |
1271 Includes non-ordered rings like the complex numbers.*} |
1272 |
1272 |
1273 class semiring_char_0 = semiring_1 + |
1273 class semiring_char_0 = semiring_1 + |