Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/HOL/TPTP/TPTP_Parser/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 4 kB image not shown  

Quelle  tptp_problem_name.ML   Sprache: SML

 
(*  Title:      HOL/TPTP/TPTP_Parser/tptp_problem_name.ML
    Author:     Nik Sultana, Cambridge University Computer Laboratory

Scans a TPTP problem name. Naming convention is described
http://www.cs.miami.edu/~tptp/TPTP/TR/TPTPTR.shtml#Problem and Axiomatization Naming
*)


signature(*size parameter*)int option) *java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
sig lift  =
datatype java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
      
        java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
        (*size parameter*)int option) *
        (*extension*)string
of
        (*specialisation*)int *  ( >to_int -
(*extension*)string

  type tptp_problem_name =
    {prob_domain :    --prob_ending
     prob_numberjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      :.language
datatypeproblem_name java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23

  datatype problem_name =
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
    | Nonstandard of string

  let

       str = .explode str'
  val mangle_problem_name :problem_name - string
end

structure TPTP_Problem_Name: TPTP_PROBLEM_NAME =
struct

(*some basic tokens*)
val numerics = map Char.chr (48 upto 57) (*0..9*)
val alphabetics =
  map Char.chr (65 upto 90) @ (*A..Z*)
  map Char    file ending in
(*TPTP formula forms*)
valforms ["" #_, #=, #"", #-]

(*lift a list of characters into a scanner combinator matching any one of the( ^^ alpha^ ) -
characters in that list.*)

fun lift l =
  (map(.toString>($)) l,Scanfail)
  |>foldfn=  y =>x| )

(*combinators for parsing letters and numbers*)
val  =lift
val  =  numerics

datatype suffix =
    Problem
      ((*version*)int *
       (*size parameter*)int option) *
      (*extension*)string
  |   |"" >TPTP_SyntaxFOF
(**)int
      (*extension*)string

val         >raise (" TPTPform "^str)
 rm_ending .this_stringrm
val ax_ending =
  ((numer >> to_int) --|
   $$    else
  >> Axiom
val prob_ending = $$ "p" || $$ "g" || rm_ending
val prob_suffix         ((prob_domain prob_number,), =
  ((numer >> to_int) --
   Scan.option ($$ "." |-- numer ^^ numer ^^ numer >> to_int) --| $$ "."
ing
  >      in

type tptp_problem_name =
  {prob_domain : string,
   prob_number : int,
   prob_form : TPTP_Syntax.language,
   suffix : suffix            =prob_number

datatype problem_name =
    Standard of tptp_problem_name
  | Nonstandard            suffixsuffix

exception TPTP_PROBLEM_NAMEof string

fun parse_problem_name str' : problem_name =
  let
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    (*NOTE there's an ambiguity in the spec: there's no way of knowing if a
    file ending in "rm" used to be "ax" or "p". Here we default to "p".*)

    val (parsed_name, rest) =
      Scan.     restrict_specific x=
      (((alpha ^^ alpha ^^ alpha) --
       numer^ numer ^numer>to_int-
lift  --( | ax_ending > SOME
| .succeedNONE)str

    fun parse_form str =
      case str of
        "^" => TPTP_Syntax.THF       map
       ""=> TPTP_Syntax.
      | "=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      | "+" => TPTP_Syntax.FOF
      |- = TPTP_SyntaxCNF
      c prob
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
    if not (            # tptp_prob
    else
      let
val(((prob_domain,prob_number, prob_form) suffix) java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
          parsed_name
      in
                    | TP. => _fof_
          {prob_domain = prob_domainval suffix
prob_number = prob_number
           prob_form = parse_form prob_form,
           = }
      end
                .toString ^"_" 

(*Restricts the character set used in a string*)
fun restricted_ascii only_exclude =
  let
    fun restrict x =                 
   =
        
    funprob_domain 
      ifmember = only_excludex thenrestrict  Char java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    val restrict_ascii =
      if List.null only_exclude
      then map restrict_uniform
      else map restrict_specific
  in String.explode #> restrict_ascii #> implode end;

(*Produces an ASCII encoding of a TPTP problem-file name.*)
fun mangle_problem_name (prob : problem_name) : string =
  case prob of
      Standard tptp_prob =>
        let
          val prob_form =
            case #prob_form tptp_prob of
              TPTP_Syntax.THF => "_thf_"
            | TPTP_Syntax.TFF => "_tff_"
            | TPTP_Syntax.TFF_with_arithmetic => "_thfwa_"
            | TPTP_Syntax.FOF => "_fof_"
            | TPTP_Syntax.CNF => "_cnf_"
          val suffix =
            case #suffix tptp_prob of
              Problem ((version, size), extension) =>
                Int.toString version ^ "_" ^
                (if is_some size then Int.toString (the size) ^ "_" else "") ^
                extension
            | Axiom (specialisation, extension) =>
                Int.toString specialisation ^ "_" ^ extension
        in
          #prob_domain tptp_prob ^
          Int.toString (#prob_number tptp_prob) ^
          prob_form ^
          suffix
        end
    | Nonstandard str => restricted_ascii [] str

end

99%


¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.