149 using assms by (rule nat.induct) |
149 using assms by (rule nat.induct) |
150 |
150 |
151 hide_fact |
151 hide_fact |
152 nat_exhaust |
152 nat_exhaust |
153 nat_induct0 |
153 nat_induct0 |
|
154 |
|
155 ML {* |
|
156 val nat_basic_lfp_sugar = |
|
157 let |
|
158 val ctr_sugar = the (Ctr_Sugar.ctr_sugar_of_global @{theory} @{type_name nat}); |
|
159 val recx = Logic.varify_types_global @{term rec_nat}; |
|
160 val C = body_type (fastype_of recx); |
|
161 in |
|
162 {T = HOLogic.natT, fp_res_index = 0, C = C, fun_arg_Tsss = [[], [[HOLogic.natT, C]]], |
|
163 ctr_sugar = ctr_sugar, recx = recx, rec_thms = @{thms nat.rec}} |
|
164 end; |
|
165 *} |
|
166 |
|
167 setup {* |
|
168 let |
|
169 fun basic_lfp_sugars_of _ [@{typ nat}] _ _ ctxt = |
|
170 ([], [0], [nat_basic_lfp_sugar], [], [], TrueI (*dummy*), [], false, ctxt) |
|
171 | basic_lfp_sugars_of bs arg_Ts callers callssss ctxt = |
|
172 BNF_LFP_Rec_Sugar.default_basic_lfp_sugars_of bs arg_Ts callers callssss ctxt; |
|
173 in |
|
174 BNF_LFP_Rec_Sugar.register_lfp_rec_extension |
|
175 {nested_simps = [], is_new_datatype = K (K true), basic_lfp_sugars_of = basic_lfp_sugars_of, |
|
176 rewrite_nested_rec_call = NONE} |
|
177 end |
|
178 *} |
154 |
179 |
155 text {* Injectiveness and distinctness lemmas *} |
180 text {* Injectiveness and distinctness lemmas *} |
156 |
181 |
157 lemma inj_Suc[simp]: "inj_on Suc N" |
182 lemma inj_Suc[simp]: "inj_on Suc N" |
158 by (simp add: inj_on_def) |
183 by (simp add: inj_on_def) |