5

What are the main differences between an SMT solver, like CVC4, and Prolog? Can one do something the other cannot?

My plan is to produce queries using R, send them to an SMT solver, and to modify queries based on the SMT output. I am basically searching for the largest optimal path given a set of criteria. I believe I can do this problem in Prolog or SMT, but I can't find any good list of pros/cons for either system.

Frank
  • 952
  • 1
  • 9
  • 23
  • 3
    Prolog is not an SMT solver, but it is possible to write an [SMT solver in Prolog](https://www.sciencedirect.com/science/article/pii/S030439751200165X). – Anderson Green Jan 02 '20 at 02:34
  • 1
    Thanks, that is what I am wondering. What is the real difference, because Prolog pretty much understands first order logic right? (Predicates, functions, ect). And you can do satisfiability checks with Prolog, so I really want to know how Prolog differentiates itself. What can you do in one that can't be done in the other? If I have a problem in FOL, why should I use Prolog instead of an SMT solver to do satisfiability problems in FOL? – Frank Jan 02 '20 at 04:39
  • @Frank Prolog understands the Horn clause fragment of (really intuitionistic, not classical) first order logic over terms (trees = syntactic structures), with a lot of extra stuff that makes sense only in an operational setting (I/O, examining the current state of the computation, performing arithmetic evaluation). Functions as such are not a concept of Prolog. It is really a general purpose programming language couched in terms of constraining variables, not optimized for SMT solving. An SMT solver would bring a lot of extras to the table. I suppose yr problem is not really fully FOL either? – David Tonhofer Jan 02 '20 at 09:54
  • 2
    The "lot of extra stuff" includes constraint extensions (mostly FD,Z,Q,R). – false Jan 02 '20 at 11:34
  • From a theoretical perspective, you can express a Prolog (without I/O) progam as SMT problem and vice versa because they are both Turing complete. In practice, there are certainly differences: Prolog's depth-first search approach allows you to write efficient programs but in some cases it is a disadvantage when you have to jump a lot of hoops to avoid infinite recursion paths. – lambda.xy.x Jan 02 '20 at 15:17
  • 1
    In general, the input language of SMT is richer: it has built-in support higher-order logic, arrays, bit-vectors, etc. The drawback is that as soon as you are in an undecidable fragment (if you need weak quantifiers, for example), the SMT solver uses a heuristic and might even give up just based on the signature. – lambda.xy.x Jan 02 '20 at 15:18
  • 1
    Btw one more fundamental difference: a Prolog program with the query gives you an answer substitution when both together are unsatisfiable. A direct SMT translation would need to extract the substitution from the proof. You directly get a model if your input is satisfiable - there's no direct equivalent in Prolog. – lambda.xy.x Jan 02 '20 at 15:23
  • 1
    @lambda.xy.x `jump a lot of hoops to avoid infinite recursion paths` Are you aware of tabling? – Guy Coder Jan 04 '20 at 00:54
  • 2
    `I can't find any good list of pros/cons for either system` In some sense you question is subjective because I am sure some problems are better with Prolog or Prolog with constraints, or Prolog with tabling, or SMT. You don't give us enough specifics in your question. – Guy Coder Jan 04 '20 at 00:57
  • 1
    @GuyCoder afaik tabling stores only ground terms and is then limited to finitely bounded cases. As such it is a great tool for specific cases but it certainly can't solve that problem in general. – lambda.xy.x Jan 06 '20 at 12:25

0 Answers0