equal
deleted
inserted
replaced
320 fun disc_of_ctr_spec (((disc, _), _), _) = disc; |
320 fun disc_of_ctr_spec (((disc, _), _), _) = disc; |
321 fun ctr_of_ctr_spec (((_, ctr), _), _) = ctr; |
321 fun ctr_of_ctr_spec (((_, ctr), _), _) = ctr; |
322 fun args_of_ctr_spec ((_, args), _) = args; |
322 fun args_of_ctr_spec ((_, args), _) = args; |
323 fun sel_defaults_of_ctr_spec (_, ds) = ds; |
323 fun sel_defaults_of_ctr_spec (_, ds) = ds; |
324 |
324 |
325 fun prepare_free_constructors prep_term (((no_discs_sels, no_code), raw_case_binding), ctr_specs) |
325 fun prepare_free_constructors prep_term (((discs_sels, no_code), raw_case_binding), ctr_specs) |
326 no_defs_lthy = |
326 no_defs_lthy = |
327 let |
327 let |
328 (* TODO: sanity checks on arguments *) |
328 (* TODO: sanity checks on arguments *) |
329 |
329 |
330 val raw_ctrs = map ctr_of_ctr_spec ctr_specs; |
330 val raw_ctrs = map ctr_of_ctr_spec ctr_specs; |
478 fun alternate_disc_lhs get_udisc k = |
478 fun alternate_disc_lhs get_udisc k = |
479 HOLogic.mk_not |
479 HOLogic.mk_not |
480 (let val b = nth disc_bindings (k - 1) in |
480 (let val b = nth disc_bindings (k - 1) in |
481 if is_disc_binding_valid b then get_udisc b (k - 1) else nth exist_xs_u_eq_ctrs (k - 1) |
481 if is_disc_binding_valid b then get_udisc b (k - 1) else nth exist_xs_u_eq_ctrs (k - 1) |
482 end); |
482 end); |
|
483 |
|
484 val no_discs_sels = |
|
485 not discs_sels andalso |
|
486 forall (forall Binding.is_empty) (raw_disc_bindings :: raw_sel_bindingss) andalso |
|
487 forall null raw_sel_defaultss; |
483 |
488 |
484 val (all_sels_distinct, discs, selss, disc_defs, sel_defs, sel_defss, lthy') = |
489 val (all_sels_distinct, discs, selss, disc_defs, sel_defs, sel_defss, lthy') = |
485 if no_discs_sels then |
490 if no_discs_sels then |
486 (true, [], [], [], [], [], lthy') |
491 (true, [], [], [], [], [], lthy') |
487 else |
492 else |
1008 |
1013 |
1009 val parse_bound_term = Parse.binding --| @{keyword ":"} -- Parse.term; |
1014 val parse_bound_term = Parse.binding --| @{keyword ":"} -- Parse.term; |
1010 |
1015 |
1011 val parse_ctr_options = |
1016 val parse_ctr_options = |
1012 Scan.optional (@{keyword "("} |-- Parse.list1 |
1017 Scan.optional (@{keyword "("} |-- Parse.list1 |
1013 (Parse.reserved "no_discs_sels" >> K 0 || Parse.reserved "no_code" >> K 1) --| |
1018 (Parse.reserved "discs_sels" >> K 0 || Parse.reserved "no_code" >> K 1) --| |
1014 @{keyword ")"} |
1019 @{keyword ")"} |
1015 >> (fn js => (member (op =) js 0, member (op =) js 1))) |
1020 >> (fn js => (member (op =) js 0, member (op =) js 1))) |
1016 (false, false); |
1021 (false, false); |
1017 |
1022 |
1018 val parse_defaults = |
1023 val parse_defaults = |