6 module T = CicNotationPt
8 let parse_error s = Printf.eprintf "%s: " s ;;
9 let rm_q s = String.sub s 1 (String.length s - 2) ;;
13 %token <string> COMMENT
17 %token <string> QSTRING
53 %type <AstTHF.ast list> main
57 | tptp_input EOF {[$1]}
58 | tptp_input main {$1::$2}
60 let start_pos = rhs_start_pos 1 in
61 let end_pos = rhs_end_pos 1 in
62 Printf.eprintf "from line %d char %d to line %d char %d\n"
63 start_pos.pos_lnum (start_pos.pos_cnum - start_pos.pos_bol)
64 end_pos.pos_lnum (end_pos.pos_cnum - end_pos.pos_bol);
75 formula_source_and_infos:
77 | COMMA { assert false }
82 name COMMA formula_type COMMA term formula_source_and_infos
92 | "hypothesis" -> Hypothesis
93 | "definition" -> Definition
95 | "theorem" -> Theorem
96 | "conjecture" -> Conjecture
97 | "lemma_conjecture" -> Lemma_conjecture
98 | "negated_conjecture" -> Negated_conjecture
100 | "unknown" -> Unknown
112 | UNAME { T.Implicit `JustOne,Some (T.Ident($1,None)) }
113 | UNAME COLON term { $3,Some (T.Ident($1,None)) }
117 | vardecl COMMA varlist { $1 :: $3 }
120 | quantifier BEGINVARLIST varlist ENDVARLIST COLON term {
121 List.fold_right (fun v t -> T.Binder($1,v,t)) $3 $6
125 | T.Appl l -> T.Appl (l @ [$3])
126 | x -> T.Appl ([$1; $3])
130 | T.Appl l -> T.Appl (l @ [$3])
131 | x -> T.Appl ([$1; $3])
133 | LPAREN term COLON term RPAREN { T.Cast ($2,$4) }
134 | term TO term { T.Binder (`Pi,($1,None),$3) }
135 | term IEQ term { T.Appl [T.Symbol("'eq",0);$1;$3] }
136 | term IAND term { T.Appl [T.Symbol("'and",0);$1;$3] }
137 | term IOR term { T.Appl [T.Symbol("'or",0);$1;$3] }
138 | NOT term { T.Appl [T.Symbol("'not",0);$2] }
139 | LPAREN term RPAREN {$2}
140 | LNAME { T.Ident($1,None) }
141 | UNAME { T.Ident($1,None) }
142 | TYPE_I { T.Symbol("'i",0) }
143 | TYPE_O { T.Symbol("'o",0) }
144 | TYPE_U { T.Sort `Set }
145 | FALSE { T.Symbol("'false",0)}
146 | TRUE { T.Symbol("'true",0)}
150 | INCLUSION LPAREN QSTRING selection_of_formulae RPAREN DOT {
151 let fname = rm_q $3 in
156 selection_of_formulae:
158 | COMMA name selection_of_formulae { $2::$3 }
161 comment: COMMENT {Comment $1} ;
163 name: NUM { string_of_int $1} | LNAME { $1 } | UNAME { $1 } ;