Skip to content

Commit d58c986

Browse files
committed
Changed proof output of initial clauses from "input" to more concrete file/name convention.
1 parent db39904 commit d58c986

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

clauses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def parseClause(lexer):
274274
lexer.AcceptTok(Token.FullStop)
275275

276276
res = Clause(lits, type, name)
277-
res.setDerivation(Derivation("input"))
277+
res.setInputDeriv(lexer.getName(), name)
278278
return res
279279

280280

derivations.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,17 @@ def setName(self, name = None):
7979
Derivable.derivedIdCounter=Derivable.derivedIdCounter+1
8080

8181
def setDerivation(self, derivation):
82+
"""
83+
Set the derivation that created this derivable.
84+
"""
8285
self.derivation = derivation
8386

87+
def setInputDeriv(self, filename, name):
88+
"""
89+
Special case: It's an input object.
90+
"""
91+
self.derivation = Derivation("file('%s', %s)"%(filename,name))
92+
8493
def getParents(self):
8594
"""
8695
Return a list of all ancestors of this node in the derivation
@@ -176,8 +185,8 @@ def __repr__(self):
176185
"""
177186
Return a string for the derivation in TPTP-3 format.
178187
"""
179-
if self.operator == "input":
180-
return "input"
188+
if self.operator.startswith("file("):
189+
return self.operator
181190
elif self.operator == "eq_axiom":
182191
return "eq_axiom"
183192
elif self.operator == "reference":
@@ -194,7 +203,7 @@ def getParents(self):
194203
Return a list of all derived objects that are used in this
195204
derivation.
196205
"""
197-
if self.operator == "input":
206+
if self.operator.startswith("file("):
198207
return []
199208
elif self.operator == "eq_axiom":
200209
return []

fofspec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ def tptpLexer(source, refdir):
6060
name = os.path.join(refdir, source)
6161
try:
6262
fp = open(name, "r")
63-
lex = Lexer(fp.read())
63+
lex = Lexer(fp.read(), name)
6464
fp.close()
6565
refdir = os.path.dirname(name)
6666
except IOError:
6767
tptp = os.getenv("TPTP")
6868
if tptp:
6969
name = os.path.join(tptp, source)
7070
fp = open(name, "r")
71-
lex = Lexer(fp.read())
71+
lex = Lexer(fp.read()), name
7272
fp.close()
7373
refdir = os.path.dirname(name)
7474
else:

formulas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def parseWFormula(lexer):
490490
lexer.AcceptTok(Token.FullStop)
491491

492492
res = WFormula(form, type, name)
493-
res.setDerivation(Derivation("input"))
493+
res.setInputDeriv(lexer.getName(), name)
494494

495495
return res
496496

lexer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class Token(object):
113113
Or = Ident("|")
114114
And = Ident("&")
115115
Implies = Ident("=>")
116+
AltImplies = Ident("->")
116117
BImplies = Ident("<=")
117118
Equiv = Ident("<=>")
118119
Xor = Ident("<~>")
@@ -163,6 +164,7 @@ class Lexer(object):
163164
(re.compile("\|"), Token.Or),
164165
(re.compile("&"), Token.And),
165166
(re.compile("=>"), Token.Implies),
167+
(re.compile("->"), Token.Implies),
166168
(re.compile("<=>"), Token.Equiv),
167169
(re.compile("<="), Token.BImplies),
168170
(re.compile("<~>"), Token.Xor),
@@ -192,6 +194,9 @@ def __init__(self, source, name="user string"):
192194
self.pos = 0
193195
self.name = name
194196

197+
def getName(self):
198+
return self.name
199+
195200
def Push(self, token):
196201
"""
197202
Return a token to the token stack. This allows basically

unification.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ def mgu(t1, t2):
212212
Try to unify t1 and t2, return substitution on success, or None on failure.
213213
"""
214214
res = mguTermList([t1], [t2], Substitution())
215+
res2 = "False"
216+
if res:
217+
res2 = "True"
218+
# print("# :", term2String(t1), " : ", term2String(t2), " => ", res2);
215219
return res
216220

217221

0 commit comments

Comments
 (0)