679 ("Cannot interpret types as formulas", tptp_fmla) |
676 ("Cannot interpret types as formulas", tptp_fmla) |
680 | THF_typing (tptp_formula, _) => (*FIXME ignoring type info*) |
677 | THF_typing (tptp_formula, _) => (*FIXME ignoring type info*) |
681 interpret_formula config language |
678 interpret_formula config language |
682 const_map var_types type_map tptp_formula thy |
679 const_map var_types type_map tptp_formula thy |
683 |
680 |
684 |
|
685 (*Extract name of inference rule, and the inferences it relies on*) |
|
686 (*This is tuned to work with LEO-II, and is brittle to upstream |
|
687 changes of the proof protocol.*) |
|
688 fun extract_inference_info annot = |
|
689 let |
|
690 fun get_line_id (General_Data (Number (Int_num, num))) = [num] |
|
691 | get_line_id (General_Data (Atomic_Word name)) = [name] |
|
692 | get_line_id (General_Term (Number (Int_num, num), _ (*e.g. a bind*))) = [num] |
|
693 | get_line_id _ = [] |
|
694 (*e.g. General_Data (Application ("theory", [General_Data |
|
695 (Atomic_Word "equality")])) -- which would come from E through LEO-II*) |
|
696 in |
|
697 case annot of |
|
698 NONE => NONE |
|
699 | SOME annot => |
|
700 (case annot of |
|
701 (General_Data (Application ("inference", |
|
702 [General_Data (Atomic_Word inference_name), |
|
703 _, |
|
704 General_List related_lines])), _) => |
|
705 (SOME (inference_name, map get_line_id related_lines |> List.concat)) |
|
706 | _ => NONE) |
|
707 end |
|
708 |
|
709 |
|
710 (*Extract the type from a typing*) |
681 (*Extract the type from a typing*) |
711 local |
682 local |
712 fun extract_type tptp_type = |
683 fun extract_type tptp_type = |
713 case tptp_type of |
684 case tptp_type of |
714 Fmla_type typ => fmlatype_to_type typ |
685 Fmla_type typ => fmlatype_to_type typ |
822 there's no need to unify it with the type_map parameter.*) |
793 there's no need to unify it with the type_map parameter.*) |
823 in |
794 in |
824 ((type_map, const_map, |
795 ((type_map, const_map, |
825 [(label, role, tptp_formula, |
796 [(label, role, tptp_formula, |
826 Syntax.check_term (Proof_Context.init_global thy') t, |
797 Syntax.check_term (Proof_Context.init_global thy') t, |
827 extract_inference_info annotation_opt)]), thy') |
798 TPTP_Proof.extract_inference_info annotation_opt)]), thy') |
828 end |
799 end |
829 |
800 |
830 and interpret_problem new_basic_types config path_prefix lines type_map const_map thy = |
801 and interpret_problem new_basic_types config path_prefix lines type_map const_map thy = |
831 let |
802 let |
832 val thy_name = Context.theory_name thy |
803 val thy_name = Context.theory_name thy |