Skip to content

Commit 4192a6f

Browse files
committed
Keep variable annotations in SemanticRule record when converting to SemgusProblem
1 parent 7ebadcf commit 4192a6f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/main/java/org/semgus/java/problem/ProblemGenerator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ private void consumeHornClause(HornClauseEvent event) {
197197
event.constructor().arguments(),
198198
event.head(),
199199
event.bodyRelations(),
200-
event.constraint()));
200+
event.constraint(),
201+
event.variables()));
201202
}
202203

203204
/**
@@ -246,9 +247,7 @@ public SemgusProblem end() {
246247
productions.put(production.operator(), new SemgusProduction(
247248
production.operator(),
248249
termCtor.childTermTypes.stream().map(nonTerminals::get).collect(Collectors.toList()),
249-
termCtor.semanticRules.stream()
250-
.map(r -> new SemanticRule(r.childTermVars(), r.head(), r.bodyRelations(), r.constraint()))
251-
.collect(Collectors.toList())));
250+
new ArrayList<>(termCtor.semanticRules)));
252251
}
253252
}
254253

src/main/java/org/semgus/java/problem/SemanticRule.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package org.semgus.java.problem;
22

3+
import org.semgus.java.object.AnnotatedVar;
34
import org.semgus.java.object.RelationApp;
45
import org.semgus.java.object.SmtTerm;
56
import org.semgus.java.object.TypedVar;
67

78
import java.util.List;
9+
import java.util.Map;
810

911
/**
1012
* A semantic rule associated with a production in a SemGuS problem's grammar specification. This takes the form of a
@@ -14,8 +16,9 @@
1416
* @param head The conclusion of the semantic rule.
1517
* @param bodyRelations The premise relations of the semantic rule.
1618
* @param constraint The semantic constraint of the semantic rule's premise, given as an SMT formula.
19+
* @param variables The collection of all variables referenced in the semantic rule.
1720
*/
1821
public record SemanticRule(List<TypedVar> childTermVars, RelationApp head, List<RelationApp> bodyRelations,
19-
SmtTerm constraint) {
22+
SmtTerm constraint, Map<String, AnnotatedVar> variables) {
2023
// NO-OP
2124
}

0 commit comments

Comments
 (0)