156 "term_of (n::nat) = ( |
156 "term_of (n::nat) = ( |
157 if n = 0 then termify (0 :: nat) |
157 if n = 0 then termify (0 :: nat) |
158 else termify (numeral :: num \<Rightarrow> nat) <\<cdot>> term_of_num_semiring (2::nat) n)" |
158 else termify (numeral :: num \<Rightarrow> nat) <\<cdot>> term_of_num_semiring (2::nat) n)" |
159 by (simp only: term_of_anything) |
159 by (simp only: term_of_anything) |
160 |
160 |
161 lemma (in term_syntax) term_of_code_numeral_code [code]: |
161 lemma (in term_syntax) term_of_natural_code [code]: |
162 "term_of (k::code_numeral) = ( |
162 "term_of (k::natural) = ( |
163 if k = 0 then termify (0 :: code_numeral) |
163 if k = 0 then termify (0 :: natural) |
164 else termify (numeral :: num \<Rightarrow> code_numeral) <\<cdot>> term_of_num_semiring (2::code_numeral) k)" |
164 else termify (numeral :: num \<Rightarrow> natural) <\<cdot>> term_of_num_semiring (2::natural) k)" |
|
165 by (simp only: term_of_anything) |
|
166 |
|
167 lemma (in term_syntax) term_of_integer_code [code]: |
|
168 "term_of (k::integer) = (if k = 0 then termify (0 :: integer) |
|
169 else if k < 0 then termify (neg_numeral :: num \<Rightarrow> integer) <\<cdot>> term_of_num_semiring (2::integer) (- k) |
|
170 else termify (numeral :: num \<Rightarrow> integer) <\<cdot>> term_of_num_semiring (2::integer) k)" |
165 by (simp only: term_of_anything) |
171 by (simp only: term_of_anything) |
166 |
172 |
167 lemma (in term_syntax) term_of_int_code [code]: |
173 lemma (in term_syntax) term_of_int_code [code]: |
168 "term_of (k::int) = (if k = 0 then termify (0 :: int) |
174 "term_of (k::int) = (if k = 0 then termify (0 :: int) |
169 else if k < 0 then termify (neg_numeral :: num \<Rightarrow> int) <\<cdot>> term_of_num_semiring (2::int) (- k) |
175 else if k < 0 then termify (neg_numeral :: num \<Rightarrow> int) <\<cdot>> term_of_num_semiring (2::int) (- k) |