equal
deleted
inserted
replaced
71 val dummy = rec_hds |> forall (fn t => is_Const t orelse |
71 val dummy = rec_hds |> forall (fn t => is_Const t orelse |
72 error ("Recursive set not previously declared as constant: " ^ |
72 error ("Recursive set not previously declared as constant: " ^ |
73 Syntax.string_of_term ctxt0 t)); |
73 Syntax.string_of_term ctxt0 t)); |
74 |
74 |
75 (*Now we know they are all Consts, so get their names, type and params*) |
75 (*Now we know they are all Consts, so get their names, type and params*) |
76 val rec_names = map (#1 o dest_Const) rec_hds |
76 val rec_names = map dest_Const_name rec_hds |
77 and (Const(_,recT),rec_params) = strip_comb (hd rec_tms); |
77 and (Const(_,recT),rec_params) = strip_comb (hd rec_tms); |
78 |
78 |
79 val rec_base_names = map Long_Name.base_name rec_names; |
79 val rec_base_names = map Long_Name.base_name rec_names; |
80 val dummy = rec_base_names |> forall (fn a => Symbol_Pos.is_identifier a orelse |
80 val dummy = rec_base_names |> forall (fn a => Symbol_Pos.is_identifier a orelse |
81 error ("Base name of recursive set not an identifier: " ^ a)); |
81 error ("Base name of recursive set not an identifier: " ^ a)); |
385 and a conclusion for the simultaneous induction rule. |
385 and a conclusion for the simultaneous induction rule. |
386 NOTE. This will not work for mutually recursive predicates. Previously |
386 NOTE. This will not work for mutually recursive predicates. Previously |
387 a summand 'domt' was also an argument, but this required the domain of |
387 a summand 'domt' was also an argument, but this required the domain of |
388 mutual recursion to invariably be a disjoint sum.*) |
388 mutual recursion to invariably be a disjoint sum.*) |
389 fun mk_predpair rec_tm = |
389 fun mk_predpair rec_tm = |
390 let val rec_name = (#1 o dest_Const o head_of) rec_tm |
390 let val rec_name = dest_Const_name (head_of rec_tm) |
391 val pfree = Free(pred_name ^ "_" ^ Long_Name.base_name rec_name, |
391 val pfree = Free(pred_name ^ "_" ^ Long_Name.base_name rec_name, |
392 elem_factors ---> \<^Type>\<open>o\<close>) |
392 elem_factors ---> \<^Type>\<open>o\<close>) |
393 val qconcl = |
393 val qconcl = |
394 fold_rev (FOLogic.mk_all o Term.dest_Free) elem_frees |
394 fold_rev (FOLogic.mk_all o Term.dest_Free) elem_frees |
395 \<^Const>\<open>imp for \<^Const>\<open>mem for elem_tuple rec_tm\<close> \<open>list_comb (pfree, elem_frees)\<close>\<close> |
395 \<^Const>\<open>imp for \<^Const>\<open>mem for elem_tuple rec_tm\<close> \<open>list_comb (pfree, elem_frees)\<close>\<close> |