1 / 6

Automated Prover9 Implementation in Python

The text demonstrates how to use ReL to evaluate Prover9 statements through a Python script. It includes parsing goals, assumptions, and applying Prover9 rules efficiently. The Python script handles Prover9 elements, runs Prover9 commands, and writes the output to files.

lei
Download Presentation

Automated Prover9 Implementation in Python

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Prover9 Implementation Using ReL to evaluate prover9 statements

  2. Prover9Demo.py Assumptions Goals formulas (goals). mortal (george). end_of_list. formulas (assumptions). man(x) -> mortal(x). man(george). end_of_list

  3. Python.g prover9_assumption_stmt :PRV9 {$prover9_stmt::strings.add($PRV9.text);LPAREN{$prover9_stmt::strings.add ($LPAREN.text);} ASSUMPTS{$prover9_stmt::strings.add ($ASSUMPTS.text);} RPAREN{$prover9_stmt::strings.add($RPAREN.text);} prover9_dot (prover9_clause_stmt)+ //expr ENDL{$prover9_stmt::strings.add($ENDL.text);} prover9_dot prover9_clause_stmt : prover9_predicate (prover9_ops prover9_predicate)* prover9_dot; prover9_predicate :(MINUS {$prover9_stmt::strings.add($MINUS.text);}) NAME{$prover9_stmt::strings.add($NAME.text);} LPAREN {$prover9_stmt::strings.add($LPAREN.text);}prover9_var RPAREN{$prover9_stmt::strings.add($RPAREN.text);};

  4. Constructor ( parse_prv9) -> ^(PRV9<Tuple>[$prover9_stmt.start, null, $expr::ctype, $prover9_stmt::strings, "PRV9"]); parse_prv9 : prover9_assumption_stmt (NEWLINE)* prover9_goals_stmt ;

  5. PyTuple.java else if (mode.equals("PRV9”)) handleProver9(elements, sqlstrings, server, uname, pword, ctype, conn);} ------------------------------------------------------------------------------------------------------------------ public void handleProver9(PyObject[] elements, String prover9_stmts, String server, String uname, String pword,Stringconntype, OracleConnection conn){ try{ FileWriterfstream = new FileWriter("/Users/mullero/dist/rules.txt"); BufferedWriter out = new BufferedWriter(fstream); prover9_stmts = prover9_stmts.replaceAll(";",""); prover9_stmts = prover9_stmts.replaceAll(" ",""); String[] s = prover9_stmts.split("."); int length = s.length; for(inti=0; i < length-1 ; i++){ out.write(s[i] + '.');}

  6. Executing of Prover9 Rules String cmd = "LADR-2009-11A/bin/prover9 -f ../rules.in"; execShellCmd(cmd); ------------------------------------------------------------------------------------------------------------------------------------------------------------------ try { FileWriter fstream2 = new FileWriter("../rules.out"); Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec(cmd); intexitValue = process.waitFor(); System.out.println("exit value: " + exitValue); BufferedReaderbuf = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedWriterout2 = new BufferedWriter(fstream2); String line = ""; while ((line = buf.readLine()) != null) { System.out.println(line); out2.write(line + "\n"); } out2.close();

More Related