equal
deleted
inserted
replaced
107 lemma of_nat_ml_int: "of_nat n = ml_int_of_int (of_nat n)" |
107 lemma of_nat_ml_int: "of_nat n = ml_int_of_int (of_nat n)" |
108 proof (induct n) |
108 proof (induct n) |
109 case 0 show ?case by simp |
109 case 0 show ?case by simp |
110 next |
110 next |
111 case (Suc n) |
111 case (Suc n) |
112 then have "int_of_ml_int (ml_int_of_int (int_of_nat n)) |
112 then have "int_of_ml_int (ml_int_of_int (int n)) |
113 = int_of_ml_int (of_nat n)" by simp |
113 = int_of_ml_int (of_nat n)" by simp |
114 then have "int_of_nat n = int_of_ml_int (of_nat n)" by simp |
114 then have "int n = int_of_ml_int (of_nat n)" by simp |
115 then show ?case by simp |
115 then show ?case by simp |
116 qed |
116 qed |
117 |
117 |
118 instance ml_int :: number_ring |
118 instance ml_int :: number_ring |
119 by default |
119 by default |
125 |
125 |
126 lemma one_ml_int_code [code inline, code func]: |
126 lemma one_ml_int_code [code inline, code func]: |
127 "(1\<Colon>ml_int) = Numeral1" |
127 "(1\<Colon>ml_int) = Numeral1" |
128 by simp |
128 by simp |
129 |
129 |
130 instance ml_int :: minus |
130 instance ml_int :: abs |
131 "\<bar>k\<bar> \<equiv> if k < 0 then -k else k" .. |
131 "\<bar>k\<bar> \<equiv> if k < 0 then -k else k" .. |
132 |
132 |
133 |
133 |
134 subsection {* Conversion to @{typ nat} *} |
134 subsection {* Conversion to @{typ nat} *} |
135 |
135 |