src/HOL/Tools/ATP/atp_proof.ML
changeset 58477 8438bae06e63
parent 58324 65651cb9d191
child 58600 c9e8ad426ab1
equal deleted inserted replaced
58476:6ade4c7109a8 58477:8438bae06e63
   346   (scan_general_id -- Scan.optional ($$ "{" |-- parse_classes --| $$ "}") []
   346   (scan_general_id -- Scan.optional ($$ "{" |-- parse_classes --| $$ "}") []
   347     -- Scan.optional ($$ "(" |-- parse_types --| $$ ")") []
   347     -- Scan.optional ($$ "(" |-- parse_types --| $$ ")") []
   348    >> AType) x
   348    >> AType) x
   349 and parse_types x = (parse_type ::: Scan.repeat ($$ "," |-- parse_type)) x
   349 and parse_types x = (parse_type ::: Scan.repeat ($$ "," |-- parse_type)) x
   350 
   350 
   351 (* We currently ignore TFF and THF types. *)
   351 (* We currently half ignore types. *)
   352 fun parse_type_signature x = Scan.repeat (($$ tptp_has_type || $$ tptp_fun_type) |-- parse_arg) x
   352 fun parse_optional_type_signature x =
       
   353   Scan.option ($$ tptp_has_type |-- parse_type) x
   353 and parse_arg x =
   354 and parse_arg x =
   354   ($$ "(" |-- parse_term --| $$ ")" --| parse_type_signature
   355   ($$ "(" |-- parse_term --| $$ ")" --| parse_optional_type_signature
   355    || scan_general_id --| parse_type_signature
   356    || scan_general_id -- parse_optional_type_signature
   356        -- Scan.optional ($$ "<" |-- parse_types --| $$ ">") []
   357        -- Scan.optional ($$ "<" |-- parse_types --| $$ ">") []
   357        -- Scan.optional ($$ "(" |-- parse_terms --| $$ ")") []
   358        -- Scan.optional ($$ "(" |-- parse_terms --| $$ ")") []
   358      >> ATerm) x
   359      >> (fn (((s, ty_opt), tyargs), args) =>
       
   360        if is_tptp_variable s andalso null tyargs andalso null args andalso is_some ty_opt then
       
   361          ATerm ((s, the_list ty_opt), [])
       
   362        else
       
   363          ATerm ((s, tyargs), args))) x
   359 and parse_term x =
   364 and parse_term x =
   360   (parse_arg -- Scan.repeat ($$ tptp_app |-- parse_arg)
   365   (parse_arg -- Scan.repeat ($$ tptp_app |-- parse_arg)
   361    --| Scan.option parse_type_signature >> list_app) x
   366    --| parse_optional_type_signature >> list_app) x
   362 and parse_terms x = (parse_term ::: Scan.repeat ($$ "," |-- parse_term)) x
   367 and parse_terms x = (parse_term ::: Scan.repeat ($$ "," |-- parse_term)) x
   363 
   368 
   364 fun parse_atom x =
   369 fun parse_atom x =
   365   (parse_term -- Scan.option (Scan.option ($$ tptp_not_infix) --| $$ tptp_equal -- parse_term)
   370   (parse_term -- Scan.option (Scan.option ($$ tptp_not_infix) --| $$ tptp_equal -- parse_term)
   366    >> (fn (u1, NONE) => AAtom u1
   371    >> (fn (u1, NONE) => AAtom u1