37 val ascii_string_of_mode : mode -> string |
37 val ascii_string_of_mode : mode -> string |
38 (* premises *) |
38 (* premises *) |
39 datatype indprem = Prem of term | Negprem of term | Sidecond of term |
39 datatype indprem = Prem of term | Negprem of term | Sidecond of term |
40 | Generator of (string * typ) |
40 | Generator of (string * typ) |
41 val dest_indprem : indprem -> term |
41 val dest_indprem : indprem -> term |
|
42 val map_indprem : (term -> term) -> indprem -> indprem |
42 (* general syntactic functions *) |
43 (* general syntactic functions *) |
43 val conjuncts : term -> term list |
44 val conjuncts : term -> term list |
44 val is_equationlike : thm -> bool |
45 val is_equationlike : thm -> bool |
45 val is_pred_equation : thm -> bool |
46 val is_pred_equation : thm -> bool |
46 val is_intro : string -> thm -> bool |
47 val is_intro : string -> thm -> bool |
109 function_flattening : bool, |
110 function_flattening : bool, |
110 fail_safe_function_flattening : bool, |
111 fail_safe_function_flattening : bool, |
111 specialise : bool, |
112 specialise : bool, |
112 no_higher_order_predicate : string list, |
113 no_higher_order_predicate : string list, |
113 inductify : bool, |
114 inductify : bool, |
|
115 detect_switches : bool, |
114 compilation : compilation |
116 compilation : compilation |
115 }; |
117 }; |
116 val expected_modes : options -> (string * mode list) option |
118 val expected_modes : options -> (string * mode list) option |
117 val proposed_modes : options -> (string * mode list) option |
119 val proposed_modes : options -> (string * mode list) option |
118 val proposed_names : options -> string -> mode -> string option |
120 val proposed_names : options -> string -> mode -> string option |
128 val function_flattening : options -> bool |
130 val function_flattening : options -> bool |
129 val fail_safe_function_flattening : options -> bool |
131 val fail_safe_function_flattening : options -> bool |
130 val specialise : options -> bool |
132 val specialise : options -> bool |
131 val no_higher_order_predicate : options -> string list |
133 val no_higher_order_predicate : options -> string list |
132 val is_inductify : options -> bool |
134 val is_inductify : options -> bool |
|
135 val detect_switches : options -> bool |
133 val compilation : options -> compilation |
136 val compilation : options -> compilation |
134 val default_options : options |
137 val default_options : options |
135 val bool_options : string list |
138 val bool_options : string list |
136 val print_step : options -> string -> unit |
139 val print_step : options -> string -> unit |
137 (* simple transformations *) |
140 (* simple transformations *) |
391 |
394 |
392 fun dest_indprem (Prem t) = t |
395 fun dest_indprem (Prem t) = t |
393 | dest_indprem (Negprem t) = t |
396 | dest_indprem (Negprem t) = t |
394 | dest_indprem (Sidecond t) = t |
397 | dest_indprem (Sidecond t) = t |
395 | dest_indprem (Generator _) = raise Fail "cannot destruct generator" |
398 | dest_indprem (Generator _) = raise Fail "cannot destruct generator" |
|
399 |
|
400 fun map_indprem f (Prem t) = Prem (f t) |
|
401 | map_indprem f (Negprem t) = Negprem (f t) |
|
402 | map_indprem f (Sidecond t) = Sidecond (f t) |
|
403 | map_indprem f (Generator (v, T)) = Generator (dest_Free (f (Free (v, T)))) |
396 |
404 |
397 (* general syntactic functions *) |
405 (* general syntactic functions *) |
398 |
406 |
399 (*Like dest_conj, but flattens conjunctions however nested*) |
407 (*Like dest_conj, but flattens conjunctions however nested*) |
400 fun conjuncts_aux (Const ("op &", _) $ t $ t') conjs = conjuncts_aux t (conjuncts_aux t' conjs) |
408 fun conjuncts_aux (Const ("op &", _) $ t $ t') conjs = conjuncts_aux t (conjuncts_aux t' conjs) |
675 function_flattening : bool, |
683 function_flattening : bool, |
676 specialise : bool, |
684 specialise : bool, |
677 fail_safe_function_flattening : bool, |
685 fail_safe_function_flattening : bool, |
678 no_higher_order_predicate : string list, |
686 no_higher_order_predicate : string list, |
679 inductify : bool, |
687 inductify : bool, |
|
688 detect_switches : bool, |
680 compilation : compilation |
689 compilation : compilation |
681 }; |
690 }; |
682 |
691 |
683 fun expected_modes (Options opt) = #expected_modes opt |
692 fun expected_modes (Options opt) = #expected_modes opt |
684 fun proposed_modes (Options opt) = #proposed_modes opt |
693 fun proposed_modes (Options opt) = #proposed_modes opt |
702 fun no_higher_order_predicate (Options opt) = #no_higher_order_predicate opt |
711 fun no_higher_order_predicate (Options opt) = #no_higher_order_predicate opt |
703 |
712 |
704 fun is_inductify (Options opt) = #inductify opt |
713 fun is_inductify (Options opt) = #inductify opt |
705 |
714 |
706 fun compilation (Options opt) = #compilation opt |
715 fun compilation (Options opt) = #compilation opt |
|
716 |
|
717 fun detect_switches (Options opt) = #detect_switches opt |
707 |
718 |
708 val default_options = Options { |
719 val default_options = Options { |
709 expected_modes = NONE, |
720 expected_modes = NONE, |
710 proposed_modes = NONE, |
721 proposed_modes = NONE, |
711 proposed_names = [], |
722 proposed_names = [], |
721 function_flattening = false, |
732 function_flattening = false, |
722 specialise = false, |
733 specialise = false, |
723 fail_safe_function_flattening = false, |
734 fail_safe_function_flattening = false, |
724 no_higher_order_predicate = [], |
735 no_higher_order_predicate = [], |
725 inductify = false, |
736 inductify = false, |
|
737 detect_switches = true, |
726 compilation = Pred |
738 compilation = Pred |
727 } |
739 } |
728 |
740 |
729 val bool_options = ["show_steps", "show_intermediate_results", "show_proof_trace", "show_modes", |
741 val bool_options = ["show_steps", "show_intermediate_results", "show_proof_trace", "show_modes", |
730 "show_mode_inference", "show_compilation", "skip_proof", "inductify", "no_function_flattening", |
742 "show_mode_inference", "show_compilation", "skip_proof", "inductify", "no_function_flattening", |
731 "specialise", "no_topmost_reordering"] |
743 "detect_switches", "specialise", "no_topmost_reordering"] |
732 |
744 |
733 fun print_step options s = |
745 fun print_step options s = |
734 if show_steps options then tracing s else () |
746 if show_steps options then tracing s else () |
735 |
747 |
736 (* simple transformations *) |
748 (* simple transformations *) |