Skip to content

Commit

Permalink
qexists bug. install gappa. matmul
Browse files Browse the repository at this point in the history
  • Loading branch information
philzook58 committed Nov 8, 2024
1 parent 5940e62 commit 76670ab
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
7 changes: 5 additions & 2 deletions kdrag/notation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def define(self, args, body):
rmul = SortDispatch(name="rmul")
smt.ExprRef.__rmul__ = lambda x, y: rmul(x, y)

matmul = SortDispatch(name="matmul")
smt.ExprRef.__matmul__ = lambda x, y: matmul(x, y)

neg = SortDispatch(name="neg")
smt.ExprRef.__neg__ = lambda x: neg(x)

Expand Down Expand Up @@ -122,9 +125,9 @@ def QExists(vs: list[smt.ExprRef], *concs) -> smt.BoolRef:
"""
concs = [v.wf() for v in vs if v.sort() in wf.methods] + list(concs)
if len(concs) == 1:
smt.Exists(vars, concs[0])
smt.Exists(vs, concs[0])
else:
smt.Exists(vars, smt.And(concs))
smt.Exists(vs, smt.And(concs))


def ExistsUnique(v: smt.ExprRef, *concs) -> smt.BoolRef:
Expand Down
4 changes: 3 additions & 1 deletion kdrag/solvers/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ nanoCoP-i20.tar.gz
nanoCoP-i20/
Prover9/
kissat/
kissat
kissat
gappa-1.4.2/
gappa-1.4.2.tar.gz
17 changes: 15 additions & 2 deletions kdrag/solvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import concurrent.futures
import logging
import shutil
import re

logger = logging.getLogger("knuckledragger")

Expand Down Expand Up @@ -262,7 +263,10 @@ def check(self):
"--mode",
"smtcomp",
"--input_syntax",
"smtlib2", # "--ignore_unrecognized_logic", "on",
"smtlib2",
# "--ignore_unrecognized_logic", "on",
# "--proof_extra" "fast" / "full"
# "--latex_output" "/tmp/vampire.tex"
]
if "timeout" in self.options:
cmd.extend(["-t", str(self.options["timeout"] // 100) + "d"])
Expand Down Expand Up @@ -300,7 +304,7 @@ def query(self, q):
"--mode",
"casc",
"--question_answering",
"synthesis",
"synthesis", # "answer_literal"
"--proof",
"off",
"--input_syntax",
Expand Down Expand Up @@ -329,6 +333,15 @@ def unsat_core(self):
cores = [smt.Bool(core) for core in cores]
return cores

def proof(self):
res = []
# https://github.com/teorth/equational_theories/blob/main/equational_theories/Generated/VampireProven/src/vampire_proofs_cyc.py
for eqnum, statement, reason in re.findall(
r"(\d+)\. ([^[]+) \[([^\]]+)\]", self.res.stdout.decode()
):
res.append((int(eqnum), statement, reason)) # TODO: Deeper parsing
return res


class VampireTHFSolver(BaseSolver):
def __init__(self):
Expand Down
8 changes: 7 additions & 1 deletion kdrag/solvers/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ echo "Installing Kissat"
git -C kissat pull || git clone https://github.com/arminbiere/kissat.git --depth 1
cd kissat
./configure && make test
cd ..
cd ..

echo "Installing Gappa"
wget -nc https://gappa.gitlabpages.inria.fr/releases/gappa-1.4.2.tar.gz
tar -xzf gappa-1.4.2.tar.gz
cd gappa-1.4.2
./configure && ./remake

0 comments on commit 76670ab

Please sign in to comment.