Git Product home page Git Product logo

yafolps's Introduction

YAFOLPS (Yet Another First-Order Logic Problem Solver)

Semester project on mathematical logic of the fourth semester of Software Engineering, Department of System Programming, Faculty of Mathematics and Mechanics, St. Petersburg State University.

Goal

We must determine whether the input formula in First-Order Logic is a tautology or not. For this to be done, we have implemented the resolution method.

EBNF (Extended Backus–Naur form)

<Forall> ::= "!"
<Exists> ::= "?"
<LogicAnd> ::= "&"
<LogicOr> ::= "|"
<LogicNegation> ::= "-"
<LogicImplication> ::= ">"
<Top> ::= "^"
<Bottom> ::= "_"

<Char> ::= [a-z] | [A-Z] | [0-9] | "_"
<Var> ::= [A-Z] (<Char>)*
<Term> ::= <Var> | [a-z] (<Char>)* "(" ((<Term> ",")* <Term>) ")"

<Quantifier> ::= <Forall> | <Exists>
<LogicOperation> ::= <LogicAnd> | <LogicOr> | <LogicImplication>

<PredicateSymbol> ::= [a-z] (<Char>)* "(" ((<Term> ",")* <Term>) ")"

<Singleton> ::= <Top> | <Bottom> | <PredicateSymbol>
<Formula> ::= <Singleton> | "(" <Formula> ")"
  | <Formula> <LogicOperation> <Formula> 
  | <Quantifier> <Var> "(" <Formula> ")" 

Usage

stack build && stack exec -- YAFOLPS-exe <args>

Args

  • --input-file filename / --i filename -- Reads a formula from a file. Without specifying this option reads a formula from standard input.
  • --print-formula / -f -- Prints the formula that have been read.
  • --print-ast / -a -- Prints the AST of the formula.
  • --print-ssf / -s -- Prints the SSF of the negated formula.
  • --print-solution / -r -- Prints "VALID" if is the formula is a tautology, otherwise prints "NOT VALID".

Examples

  • stack build && stack exec -- YAFOLPS-exe --i examples/1.txt -fas -- Prints formula, AST and SSF
  • stack build && stack exec -- YAFOLPS-exe --i examples/1.txt -r -- Prints "NOT VALID"
  • stack build && stack exec -- YAFOLPS-exe --i examples/2.txt -r -- Prints "NOT VALID"
  • stack build && stack exec -- YAFOLPS-exe --i examples/3.txt -r -- Prints "NOT VALID"
  • stack build && stack exec -- YAFOLPS-exe --i examples/4.txt -r -- Prints "VALID"
  • stack build && stack exec -- YAFOLPS-exe --i examples/Top.txt -r -- Prints "VALID"
  • stack build && stack exec -- YAFOLPS-exe --i examples/Bottom.txt -r -- Prints "VALID"

Tests

  • stack test -- Prints results on the Hilbert's axioms

Test results

yafolps's People

Contributors

sergeykuz1001 avatar vadyushkins avatar

Watchers

 avatar

yafolps's Issues

Something wrong with ConverterToSSF

I think there is a problem somewhere in the ConverterToSSF.hs

  • stack build && stack exec -- YAFOLPS-exe --i test/exampleTop.txt -s Prints:
SSF 
    { quants = []
    , matrix = []
    } 
  • stack build && stack exec -- YAFOLPS-exe --i test/exampleBottom.txt -s Prints:
SSF 
    { quants = []
    , matrix = []
    } 
  • stack build && stack exec -- YAFOLPS-exe --i test/example4.txt -s Prints:
SSF 
    { quants = []
    , matrix = []
    } 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.