Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
2d5e626
classification tree and slct implementation
FredrikTaquist Sep 3, 2025
4b3ff4e
update out-of-date code and fix errors
FredrikTaquist Sep 4, 2025
7f37b3d
add sllambda algorithm and replace ralambda with sllambda
FredrikTaquist Nov 5, 2025
c3fc70a
bugfixing
FredrikTaquist Nov 5, 2025
510acdb
remove method call introduced in java 21
FredrikTaquist Nov 6, 2025
37a794b
fix query counting in caching oracle and update query numbers
FredrikTaquist Nov 6, 2025
a700572
fix to caching oracle query counting
FredrikTaquist Nov 6, 2025
5398c1d
remove unused files
FredrikTaquist Nov 7, 2025
bf76607
apply spotless
FredrikTaquist Nov 7, 2025
decd5ea
remove one additional unused file
FredrikTaquist Nov 7, 2025
a424449
change variable name to keep codespell happy
FredrikTaquist Nov 7, 2025
5574133
remove some prints
FredrikTaquist Nov 7, 2025
4b8e253
remove unused dependency
FredrikTaquist Nov 7, 2025
0041267
remove unused and commented out code
FredrikTaquist Nov 7, 2025
acf70bd
improve readability with code reorganization and documentation/comments
FredrikTaquist Nov 11, 2025
943222e
apply spotless
FredrikTaquist Nov 11, 2025
0d7dbcc
fix mistake in ClassificationTree::suffixRevealsNewGuard
FredrikTaquist Nov 11, 2025
9e4a661
add test case for issue #78
FredrikTaquist Nov 12, 2025
422a5a6
rename test so it runs automatically
FredrikTaquist Nov 12, 2025
392c6a2
attempt number 2 at renaming test
FredrikTaquist Nov 12, 2025
1b5d55b
fix ineq theory guard merging bug
FredrikTaquist Nov 12, 2025
63a02bd
add test case revealing bug
FredrikTaquist Nov 14, 2025
0519bc8
fix bug with comparing sdts using inequality theory
FredrikTaquist Nov 14, 2025
dd2105c
add test revealing non-determinacy bug
FredrikTaquist Nov 15, 2025
c65f8f1
include ra transitions in ra run
FredrikTaquist Nov 15, 2025
64cc631
remove unused methods
FredrikTaquist Nov 15, 2025
1d1c92c
update login test query count
FredrikTaquist Nov 15, 2025
1f918d4
fix error in RARun::getGuard
FredrikTaquist Nov 17, 2025
fea8076
small fixes, tidying up, and removing unused code
FredrikTaquist Nov 18, 2025
da67b9b
suffix value restrictions for ce analysis of eq theory
FredrikTaquist Dec 19, 2025
4ce6cd4
add methods for restricting extended suffixes
FredrikTaquist Jan 13, 2026
7a7b63e
add hash code to restrictions
FredrikTaquist Jan 20, 2026
24f692f
change eq theory tree query to correctly construct optimized sdts
FredrikTaquist Jan 20, 2026
7a4d0b4
fix PrefixFinder to handle guards of optimized sdts
FredrikTaquist Jan 20, 2026
a983659
add restrictions to refined suffixes for register closedness
FredrikTaquist Jan 20, 2026
07596b6
restrictions for refined suffixes
FredrikTaquist Feb 6, 2026
96633a9
add new code for fresh values optimization
FredrikTaquist Feb 10, 2026
e1abf55
fix unmapped registers/equalities in restrictions
FredrikTaquist Feb 10, 2026
12edc54
comment out unused method and test
FredrikTaquist Feb 11, 2026
b24ddb8
fix some tests
FredrikTaquist Feb 11, 2026
a4bcf96
spotless
FredrikTaquist Feb 11, 2026
f83b287
improvements and fixes to ce analysis restrictions
FredrikTaquist Feb 17, 2026
ef9fcf3
fix restrictions from sdt
FredrikTaquist Feb 20, 2026
e360a58
fix some bugs and tests
FredrikTaquist Feb 20, 2026
1e20b9f
remove unused and commented out code
FredrikTaquist Feb 23, 2026
cadd53f
remove method used only in test and refactor said test
FredrikTaquist Feb 23, 2026
068a170
remove unused and commented out code
FredrikTaquist Feb 23, 2026
5107051
add some documentation
FredrikTaquist Feb 23, 2026
77c396e
improvements to sdt path restrictions
FredrikTaquist Feb 24, 2026
09b2116
cleanup and add comments
FredrikTaquist Feb 24, 2026
16a8def
add documentation and some code cleanups
FredrikTaquist Feb 24, 2026
c7d7bdc
add constraint solver to SLLambdaRestrictionBuilder constructor
FredrikTaquist Feb 24, 2026
a22d550
some cleanups and documentation
FredrikTaquist Feb 26, 2026
b22da6d
fix spelling error
FredrikTaquist Feb 26, 2026
602f187
add renaming of data values in action to suffix values in register cl…
FredrikTaquist Feb 26, 2026
fa1e1f1
change handling of unknown memorables with restrictions
FredrikTaquist Feb 27, 2026
11c4e1e
small fix to CE analysis restrictions
FredrikTaquist Mar 9, 2026
f3354f8
fix several bugs with restricted suffixes
FredrikTaquist Mar 12, 2026
3b4223a
add changes missing from prior commit
FredrikTaquist Mar 12, 2026
2e60e63
add option for switching suffix optimization version
FredrikTaquist Mar 13, 2026
c2c48ff
add SLLambdaEq learning algorithm and fix several issues
FredrikTaquist May 4, 2026
e3fe9d6
add palindrome sut
FredrikTaquist May 4, 2026
8e4a5ab
fix small error
FredrikTaquist May 7, 2026
c85581f
Add palindrome classes.
pfg666 May 8, 2026
2d5915c
Capitalize IN to fix build issue.
pfg666 May 8, 2026
c893906
quick fix to sllambda PrefixFinder bug
FredrikTaquist May 9, 2026
014188b
fix tree query count
FredrikTaquist May 9, 2026
57b37bf
change java version from 17 to 21 to fix compilation error
FredrikTaquist May 9, 2026
162c16f
undo previous commit
FredrikTaquist May 9, 2026
cc98356
Upgrade to Java 21.
pfg666 May 10, 2026
3034213
Update palindrome test to make it usable for benchmarking and to also…
pfg666 May 14, 2026
79b96c0
Fix error where suffix builder treats guards as restrictions
FredrikTaquist May 28, 2026
e4ca795
Make SLLambda prefix finder independent of SLLambdaEq features
FredrikTaquist May 28, 2026
ce43dd9
Fix stats
FredrikTaquist May 28, 2026
c12eb71
Make SLLambdaRestrictionBuilder specific to SLLambdaEq
FredrikTaquist May 28, 2026
348fabe
Fix to restriction builder version
FredrikTaquist May 28, 2026
7c603ff
Correct type of restriction builder
FredrikTaquist May 28, 2026
e336a06
Change name of SLLambdaEq restriction builder
FredrikTaquist May 28, 2026
a462f77
Use correct restriction builder type for test
FredrikTaquist May 28, 2026
a1e9cf0
add SafeVargs annotation
FredrikTaquist Jun 1, 2026
6d74008
Remove some unused and commented out code
FredrikTaquist Jun 1, 2026
514b5a5
Add option for optimized register closedness
FredrikTaquist Jun 1, 2026
3bed5c7
Remove unused and commented out code
FredrikTaquist Jun 1, 2026
1a85399
Add missing features to Conjuncts/Disjunction restrictions
FredrikTaquist Jun 1, 2026
f61420f
Add bodies for some auto-generated method stubs
FredrikTaquist Jun 1, 2026
a678151
Remove prints from palindrome test
FredrikTaquist Jun 1, 2026
2a6dba2
Add some slleq tests
FredrikTaquist Jun 1, 2026
f42dd25
Remove commented out test
FredrikTaquist Jun 1, 2026
a82dd11
Merge with main
FredrikTaquist Jun 2, 2026
76eec43
Apply update to generic restrictions code from main
FredrikTaquist Jun 2, 2026
97f1f5d
Fix to Palindrome for error prone
FredrikTaquist Jun 2, 2026
ca02366
Apply spotless
FredrikTaquist Jun 2, 2026
0f55c5d
Fix boxing/unboxing
FredrikTaquist Jun 2, 2026
ac3e7f8
Remove unused final
FredrikTaquist Jun 2, 2026
a883ad8
Fix workflow
FredrikTaquist Jun 3, 2026
3a80d73
Fix unresolved conflict
FredrikTaquist Jun 3, 2026
c97b5df
Remove commented out code
FredrikTaquist Jun 3, 2026
3b19f9d
Undo erroneous code change
FredrikTaquist Jun 3, 2026
b7ebb94
Fix minor formatting issue
FredrikTaquist Jun 3, 2026
3e3c2b2
Fix Javadoc errors
FredrikTaquist Jun 3, 2026
69176b8
Remove code for handling suffixes that are not equality theory
FredrikTaquist Jun 3, 2026
808765d
Remove enum for restriction builder version
FredrikTaquist Jun 5, 2026
91a98c9
Add PALINDROME_BENCHMARK option in LearnPalindromTest which enables p…
pfg666 Jul 3, 2026
f87fda1
Also print hypothesis
pfg666 Jul 5, 2026
818e924
Remove unused methods
FredrikTaquist Jul 29, 2026
cac2c90
Move functionality from EqualityTheory to SLLambdaEqRestrictionBuilder
FredrikTaquist Jul 29, 2026
bbccfc8
Fix issue preventing automatic merge with main
FredrikTaquist Jul 30, 2026
2b970bf
Add comments and do some cleanup
FredrikTaquist Jul 31, 2026
ef45213
Comments for prefix finder
FredrikTaquist Jul 31, 2026
f873b6e
Restore functionality for using improved register closedness via IOSi…
FredrikTaquist Jul 31, 2026
ba526de
Minor fixes
FredrikTaquist Jul 31, 2026
41c4964
Remove some commented out code
FredrikTaquist Jul 31, 2026
9bd915f
Remove obsolete test
FredrikTaquist Aug 6, 2026
2af3085
Remove unused code
FredrikTaquist Aug 6, 2026
87f4157
Move method to class where it is used
FredrikTaquist Aug 6, 2026
2e36975
Small fix to documentation
FredrikTaquist Aug 6, 2026
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
13 changes: 13 additions & 0 deletions src/main/java/de/learnlib/ralib/automata/RARun.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import gov.nasa.jpf.constraints.expressions.NumericBooleanExpression;
import gov.nasa.jpf.constraints.expressions.NumericComparator;
import gov.nasa.jpf.constraints.util.ExpressionUtil;
import net.automatalib.word.Word;

/**
* Data structure containing the locations, register valuations, symbol instances
Expand Down Expand Up @@ -135,6 +136,18 @@ private Expression<Boolean> outputGuard(OutputTransition t) {
return ExpressionUtil.and(expressions);
}

public Word<PSymbolInstance> getPrefix(int id) {
return Word.fromArray(symbols, 0, id);
}

public Word<PSymbolInstance> getSuffix(int id) {
return Word.fromArray(symbols, id, symbols.length - id);
}

public Word<PSymbolInstance> getWord() {
return getPrefix(symbols.length);
}

@Override
public String toString() {
if (locations.length == 0) {
Expand Down
82 changes: 69 additions & 13 deletions src/main/java/de/learnlib/ralib/ceanalysis/PrefixFinder.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.learnlib.ralib.ceanalysis;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
Expand All @@ -21,6 +22,8 @@
import de.learnlib.ralib.data.DataValue;
import de.learnlib.ralib.data.Mapping;
import de.learnlib.ralib.data.RegisterValuation;
import de.learnlib.ralib.data.SDTGuardElement;
import de.learnlib.ralib.data.SDTRelabeling;
import de.learnlib.ralib.data.SymbolicDataValue;
import de.learnlib.ralib.data.SymbolicDataValue.Parameter;
import de.learnlib.ralib.data.SymbolicDataValue.Register;
Expand All @@ -34,6 +37,7 @@
import de.learnlib.ralib.smt.ReplacingValuesVisitor;
import de.learnlib.ralib.theory.SDT;
import de.learnlib.ralib.theory.Theory;
import de.learnlib.ralib.words.DataWords;
import de.learnlib.ralib.words.PSymbolInstance;
import de.learnlib.ralib.words.ParameterizedSymbol;
import gov.nasa.jpf.constraints.api.Expression;
Expand All @@ -57,17 +61,17 @@ public enum ResultType {
*/
public record Result(Word<PSymbolInstance> prefix, ResultType result) {};

private final CTHypothesis hyp;
private final ClassificationTree ct;
protected final CTHypothesis hyp;
protected final ClassificationTree ct;

private final TreeOracle sulOracle;
private final Map<DataType, Theory> teachers;
protected final TreeOracle sulOracle;
protected final Map<DataType, Theory> teachers;

private final SymbolicSuffixRestrictionBuilder restrBuilder;
protected final SymbolicSuffixRestrictionBuilder restrBuilder;

private final ConstraintSolver solver;
protected final ConstraintSolver solver;

private final Constants consts;
protected final Constants consts;

public PrefixFinder(TreeOracle sulOracle, CTHypothesis hyp, ClassificationTree ct,
Map<DataType, Theory> teachers, SymbolicSuffixRestrictionBuilder restrBuilder,
Expand Down Expand Up @@ -101,9 +105,8 @@ public Result analyzeCounterExample(Word<PSymbolInstance> ce) {
SymbolicSuffix vNext = new SymbolicSuffix(ce.prefix(i), ce.suffix(ce.length() - i), restrBuilder);
SymbolicSuffix v = new SymbolicSuffix(ce.prefix(i-1), ce.suffix(ce.length() - i + 1), restrBuilder);

Expression<Boolean> gHyp = run.getGuard(i, consts);

for (ShortPrefix u : hyp.getLeaf(loc).getShortPrefixes()) {
Expression<Boolean> gHyp = getHypGuard(run, i, u);
SDT sdt = sulOracle.treeQuery(u, v);

Set<DataValue> uVals = hyp.getLeaf(loc).getPrefix(u).getRegisters();
Expand Down Expand Up @@ -188,7 +191,7 @@ private Set<Mapping<DataValue, DataValue>> extendedValuationRenamings(SDT uSDT,
DataValue[] sdtValsArr = sdtVals.toArray(new DataValue[sdtVals.size()]);

// gather data values from prefix of run at index id
List<DataValue> runVals = new ArrayList<>();
ArrayList<DataValue> runVals = new ArrayList<>();
for (int i = 1; i <= id-1; i++) {
for (DataValue d : run.getTransitionSymbol(i).getParameterValues()) {
runVals.add(d);
Expand Down Expand Up @@ -231,7 +234,7 @@ private Set<Mapping<DataValue, DataValue>> extendedValuationRenamings(SDT uSDT,
* @param d
* @return array containing data values of {@code list}, with one occurrence of {@code d} removed
*/
private List<DataValue> removeFirst(List<DataValue> list, DataValue d) {
private ArrayList<DataValue> removeFirst(ArrayList<DataValue> list, DataValue d) {
ArrayList<DataValue> ret = new ArrayList<>();
ret.addAll(list);
for (int i = 0; i < list.size(); i++) {
Expand Down Expand Up @@ -270,13 +273,15 @@ private Optional<Result> checkTransition(RALocation loc,
// instantiate a representative data value for the conjunction
DataType[] types = action.getPtypes();
DataValue[] reprDataVals = new DataValue[types.length];
List<DataValue> prior = new ArrayList<>();
for (int i = 0; i < types.length; i++) {
Optional<DataValue> reprDataVal = teachers.get(types[i]).instantiate(u, action, conjunction, i+1, consts, solver);
Optional<DataValue> reprDataVal = teachers.get(types[i]).instantiate(u, action, conjunction, i+1, prior, consts, solver);
if (reprDataVal.isEmpty()) {
// guard unsat
return Optional.empty();
}
reprDataVals[i] = reprDataVal.get();
prior.add(reprDataVals[i]);
}
PSymbolInstance psi = new PSymbolInstance(action, reprDataVals);
Word<PSymbolInstance> uExtSUL = u.append(psi);
Expand All @@ -292,7 +297,7 @@ private Optional<Result> checkTransition(RALocation loc,
SDT uExtHypSDT = sulOracle.treeQuery(uExtHyp, v).toRegisterSDT(uExtHyp, consts);
SDT uExtSULSDT = sulOracle.treeQuery(uExtSUL, v).toRegisterSDT(uExtSUL, consts);

if (SDT.equivalentUnderId(uExtHypSDT, uExtSULSDT)) {
if (this.equivalentSDTsWithEqualityMapping(uExtSULSDT, uExtHypSDT, uExtSUL)) {
return Optional.empty(); // there is an equivalent extension, so no discrepancy
}
}
Expand Down Expand Up @@ -372,4 +377,55 @@ private boolean isGuardSatisfied(Expression<Boolean> guard, Mapping<DataValue, D

return solver.isSatisfiable(guardRenamed, mapping);
}

/**
* Get the guard in the hypothesis which the last symbol of {@code u} transitions through
* in {@code run}.
*
* @param run
* @param i
* @param u
* @return
*/
private Expression<Boolean> getHypGuard(RARun run, int i, Word<PSymbolInstance> u) {
RegisterValuation runVal = run.getValuation(i - 1);
RegisterValuation uVal = hyp.getRun(u).getValuation(u.size());
Mapping<DataValue, DataValue> renaming = new Mapping<>();
for (Map.Entry<Register, DataValue> runValEntry : runVal.entrySet()) {
DataValue replace = runValEntry.getValue();
DataValue by = uVal.get(runValEntry.getKey());
renaming.put(replace, by);
}

ReplacingValuesVisitor rvv = new ReplacingValuesVisitor();
Expression<Boolean> guard = run.getGuard(i, consts);
return rvv.apply(guard, renaming);
}

/**
* For each register r<sub>i</sub> in {@code sdtElse} that is not present in {@code sdtIf}, check whether data value d<sub>i</sub> of {@code uIf} is equal to some other register in {@code sdtIf}.
* If so, maps r<sub>i</sub> to that register and returns {@code true} if {@code sdtIf} and {@code sdtElse} are equivalent under that remapping.
*
* @param sdtIf
* @param sdtElse
* @param uIf
* @param uElse
* @return {@code true} if and only if {@code sdtIf} and {@code sdtElse} are equivalent when collapsing equivalent registers of {@code uIf}
*/
private boolean equivalentSDTsWithEqualityMapping(SDT sdtIf, SDT sdtElse, Word<PSymbolInstance> uIf) {
ArrayList<DataValue> uIfVals = new ArrayList<>(Arrays.asList(DataWords.valsOf(uIf)));
Mapping<Register, Register> renaming = new Mapping<>();
for (SDTGuardElement elem : sdtElse.getVariables()) {
if (elem instanceof Register r && !sdtIf.getVariables().contains(r)) {
DataValue d = uIfVals.get(r.getId() - 1);
assert d != null : "Incompatible SDTs";
int index = uIfVals.indexOf(d);
if (index >= 0) {
Register rEq = new Register(d.getDataType(), index + 1);
renaming.put(r, rEq);
}
}
}
return sdtIf.isEquivalent(sdtElse, SDTRelabeling.fromMapping(renaming));
}
}
Loading
Loading