Class BddEquivalenceChecker
java.lang.Object
software.amazon.smithy.rulesengine.logic.bdd.BddEquivalenceChecker
Verifies functional equivalence between a CFG and its BDD representation.
This verifier uses structural equivalence checking to ensure that both representations produce the same result. When the BDD has fewer than 20 conditions, the checking is exhaustive. When there are more, random samples are checked up to the earlier of max samples being reached or the max duration being reached.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Exception thrown when verification fails. -
Method Summary
Modifier and TypeMethodDescriptionstatic BddEquivalenceChecker
setMaxDuration
(Duration timeout) Sets the maximum amount of time to take for the verification (runs until timeout or max samples met).setMaxSamples
(int maxSamples) Sets the maximum number of samples to test for large condition sets.void
verify()
Verifies that the BDD produces identical results to the CFG.
-
Method Details
-
of
-
setMaxSamples
Sets the maximum number of samples to test for large condition sets.Defaults to a max of 1M samples. Set to
<= 0
to disable the max.- Parameters:
maxSamples
- the maximum number of samples- Returns:
- this verifier for method chaining
-
setMaxDuration
Sets the maximum amount of time to take for the verification (runs until timeout or max samples met).Defaults to a 1-minute timeout if not overridden.
- Parameters:
timeout
- the timeout duration- Returns:
- this verifier for method chaining
-
verify
public void verify()Verifies that the BDD produces identical results to the CFG.- Throws:
BddEquivalenceChecker.VerificationException
- if any discrepancy is found
-