Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions devtools/test-suite/bugs/bug_66-1.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
% result: VALID

fof(h, hypothesis, p ).
fof(nc, negated_conjecture, ~p ).
4 changes: 4 additions & 0 deletions devtools/test-suite/bugs/bug_66-2.p
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
% result: NOT VALID

fof(h, hypothesis, p ).
fof(nc, negated_conjecture, p ).
23 changes: 17 additions & 6 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func initDebuggers() {

func StatementListToFormula(statements []Core.Statement, old_bound int, problemDir string) (form AST.Form, bound int, containsEquality bool) {
and_list := AST.NewFormList()
var not_form AST.Form
var negated_conjecture AST.Form
bound = old_bound

for _, statement := range statements {
Expand Down Expand Up @@ -249,31 +249,42 @@ func StatementListToFormula(statements []Core.Statement, old_bound int, problemD
case Core.Conjecture:
switch f := statement.GetForm().(type) {
case Lib.Some[AST.Form]:
not_form = doConjectureStatement(f.Val)
negated_conjecture = AST.MakerNot(doConjectureStatement(f.Val))
case Lib.None[AST.Form]:
Glob.Anomaly("main", "Conjecture statement "+statement.ToString()+" has no formula")
}

case Core.NegatedConjecture:
switch f := statement.GetForm().(type) {
case Lib.Some[AST.Form]:
negated_conjecture = doConjectureStatement(f.Val)
case Lib.None[AST.Form]:
Glob.Anomaly("main", "Negated conjecture statement "+statement.ToString()+" has no formula")
}

case Core.Type:
switch ty := statement.GetAtomTyping().(type) {
case Lib.Some[Core.TFFAtomTyping]:
doTypeStatement(ty.Val)
case Lib.None[Core.TFFAtomTyping]:
Glob.Anomaly("main", "Type statement "+statement.ToString()+" has no formula")
}

default:
Glob.Fatal("main", fmt.Sprintf("Unmanaged statement role: %s", statement.GetRole().ToString()))
}
}

switch {
case and_list.IsEmpty() && not_form == nil:
case and_list.IsEmpty() && negated_conjecture == nil:
return nil, bound, containsEquality
case and_list.IsEmpty():
return AST.MakerNot(not_form), bound, containsEquality
case not_form == nil:
return negated_conjecture, bound, containsEquality
case negated_conjecture == nil:
return AST.MakerAnd(and_list), bound, containsEquality
default:
flattened := and_list.Flatten()
flattened.Append(AST.MakerNot(not_form))
flattened.Append(negated_conjecture)
return AST.MakerAnd(flattened), bound, containsEquality
}
}
Expand Down