Skip to content

Commit 5fcae31

Browse files
authored
Fix provenance explanations for multiple constraints (#2585)
1 parent e68c5b6 commit 5fcae31

7 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/ast2ram/provenance/SubproofGenerator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ Own<ram::Operation> SubproofGenerator::generateReturnInstantiatedValues(const as
205205
for (const auto* constraint : ast::getBodyLiterals<const ast::BinaryConstraint>(clause)) {
206206
values.push_back(context.translateValue(*valueIndex, constraint->getLHS()));
207207
values.push_back(context.translateValue(*valueIndex, constraint->getRHS()));
208+
values.push_back(mk<ram::UndefValue>());
209+
values.push_back(mk<ram::UndefValue>());
208210
}
209211

210212
// final provenance negation

tests/provenance/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ souffle_provenance_test(cprog1)
2222
souffle_provenance_test(eqrel_tests3 COMPILED_SPLITTED)
2323
souffle_provenance_test(explain_float_unsigned)
2424
souffle_provenance_test(high_arity)
25+
souffle_provenance_test(multiple_constraints)
2526
souffle_provenance_test(negation)
2627
souffle_provenance_test(path)
2728
souffle_provenance_test(path_explain_negation)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 2 3
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Souffle - A Datalog Compiler
2+
// Copyright (c) 2026 The Souffle Developers. All rights reserved
3+
// Licensed under the Universal Permissive License v 1.0 as shown at:
4+
// - https://opensource.org/licenses/UPL
5+
// - <souffle root>/licenses/SOUFFLE-UPL.txt
6+
7+
// This code tests provenance explanations for rules with multiple constraints.
8+
9+
.pragma "provenance" "explain"
10+
11+
.decl node(x: number)
12+
13+
.decl link(x: number, y: number, z: number)
14+
.output link
15+
16+
node(1).
17+
node(2).
18+
node(3).
19+
20+
link(x, y, z) :- node(x), node(y), node(z), x < y, y < z.

tests/provenance/multiple_constraints/multiple_constraints.err

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
explain link(1, 2, 3)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node(1) node(2) node(3) 1 < 2 2 < 3
2+
--------------------------------(R1)
3+
link(1, 2, 3)

0 commit comments

Comments
 (0)