47411
|
1 |
(* Title: HOL/TPTP/TPTP_Parser/tptp_proof.ML
|
|
2 |
Author: Nik Sultana, Cambridge University Computer Laboratory
|
|
3 |
|
|
4 |
Collection of functions for handling TPTP proofs.
|
|
5 |
*)
|
|
6 |
|
|
7 |
signature TPTP_PROOF =
|
|
8 |
sig
|
|
9 |
val extract_inference_info : (TPTP_Syntax.general_term * 'a list) option ->
|
|
10 |
(string * string list) option
|
|
11 |
end
|
|
12 |
|
|
13 |
|
|
14 |
structure TPTP_Proof : TPTP_PROOF =
|
|
15 |
struct
|
|
16 |
|
|
17 |
open TPTP_Syntax
|
|
18 |
|
|
19 |
(*Extract name of inference rule, and the inferences it relies on*)
|
|
20 |
(*This is tuned to work with LEO-II, and is brittle wrt upstream
|
|
21 |
changes of the proof protocol.*)
|
|
22 |
fun extract_inference_info annot =
|
|
23 |
let
|
|
24 |
fun get_line_id (General_Data (Number (Int_num, num))) = [num]
|
|
25 |
| get_line_id (General_Data (Atomic_Word name)) = [name]
|
|
26 |
| get_line_id (General_Term (Number (Int_num, num), _ (*e.g. a bind*))) = [num]
|
|
27 |
| get_line_id _ = []
|
|
28 |
(*e.g. General_Data (Application ("theory", [General_Data
|
|
29 |
(Atomic_Word "equality")])) -- which would come from E through LEO-II*)
|
|
30 |
in
|
|
31 |
case annot of
|
|
32 |
NONE => NONE
|
|
33 |
| SOME annot =>
|
|
34 |
(case annot of
|
|
35 |
(General_Data (Application ("inference",
|
|
36 |
[General_Data (Atomic_Word inference_name),
|
|
37 |
_,
|
|
38 |
General_List related_lines])), _) =>
|
|
39 |
(SOME (inference_name, map get_line_id related_lines |> List.concat))
|
|
40 |
| _ => NONE)
|
|
41 |
end
|
|
42 |
|
|
43 |
end
|