Package daikon.inv.ternary.threeScalar
Class FunctionBinary
- Object
-
- Invariant
-
- TernaryInvariant
-
- ThreeScalar
-
- FunctionBinary
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
FunctionBinary.BitwiseAndLong_xyz
,FunctionBinary.BitwiseAndLong_yxz
,FunctionBinary.BitwiseAndLong_zxy
,FunctionBinary.BitwiseOrLong_xyz
,FunctionBinary.BitwiseOrLong_yxz
,FunctionBinary.BitwiseOrLong_zxy
,FunctionBinary.BitwiseXorLong_xyz
,FunctionBinary.BitwiseXorLong_yxz
,FunctionBinary.BitwiseXorLong_zxy
,FunctionBinary.DivisionLong_xyz
,FunctionBinary.DivisionLong_xzy
,FunctionBinary.DivisionLong_yxz
,FunctionBinary.DivisionLong_yzx
,FunctionBinary.DivisionLong_zxy
,FunctionBinary.DivisionLong_zyx
,FunctionBinary.GcdLong_xyz
,FunctionBinary.GcdLong_yxz
,FunctionBinary.GcdLong_zxy
,FunctionBinary.LogicalAndLong_xyz
,FunctionBinary.LogicalAndLong_yxz
,FunctionBinary.LogicalAndLong_zxy
,FunctionBinary.LogicalOrLong_xyz
,FunctionBinary.LogicalOrLong_yxz
,FunctionBinary.LogicalOrLong_zxy
,FunctionBinary.LogicalXorLong_xyz
,FunctionBinary.LogicalXorLong_yxz
,FunctionBinary.LogicalXorLong_zxy
,FunctionBinary.LshiftLong_xyz
,FunctionBinary.LshiftLong_xzy
,FunctionBinary.LshiftLong_yxz
,FunctionBinary.LshiftLong_yzx
,FunctionBinary.LshiftLong_zxy
,FunctionBinary.LshiftLong_zyx
,FunctionBinary.MaximumLong_xyz
,FunctionBinary.MaximumLong_yxz
,FunctionBinary.MaximumLong_zxy
,FunctionBinary.MinimumLong_xyz
,FunctionBinary.MinimumLong_yxz
,FunctionBinary.MinimumLong_zxy
,FunctionBinary.ModLong_xyz
,FunctionBinary.ModLong_xzy
,FunctionBinary.ModLong_yxz
,FunctionBinary.ModLong_yzx
,FunctionBinary.ModLong_zxy
,FunctionBinary.ModLong_zyx
,FunctionBinary.MultiplyLong_xyz
,FunctionBinary.MultiplyLong_yxz
,FunctionBinary.MultiplyLong_zxy
,FunctionBinary.PowerLong_xyz
,FunctionBinary.PowerLong_xzy
,FunctionBinary.PowerLong_yxz
,FunctionBinary.PowerLong_yzx
,FunctionBinary.PowerLong_zxy
,FunctionBinary.PowerLong_zyx
,FunctionBinary.RshiftSignedLong_xyz
,FunctionBinary.RshiftSignedLong_xzy
,FunctionBinary.RshiftSignedLong_yxz
,FunctionBinary.RshiftSignedLong_yzx
,FunctionBinary.RshiftSignedLong_zxy
,FunctionBinary.RshiftSignedLong_zyx
,FunctionBinary.RshiftUnsignedLong_xyz
,FunctionBinary.RshiftUnsignedLong_xzy
,FunctionBinary.RshiftUnsignedLong_yxz
,FunctionBinary.RshiftUnsignedLong_yzx
,FunctionBinary.RshiftUnsignedLong_zxy
,FunctionBinary.RshiftUnsignedLong_zyx
public abstract class FunctionBinary extends ThreeScalar
Base class for each of the FunctionBinary functions and permutatons. Most of the work is done here. The subclasses basically define the function and return information describing the function and permutation to these methods.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FunctionBinary.BitwiseAndLong_xyz
Represents the invariantx = BitwiseAnd(y, z)
over three long scalars.static class
FunctionBinary.BitwiseAndLong_yxz
Represents the invarianty = BitwiseAnd(x, z)
over three long scalars.static class
FunctionBinary.BitwiseAndLong_zxy
Represents the invariantz = BitwiseAnd(x, y)
over three long scalars.static class
FunctionBinary.BitwiseOrLong_xyz
Represents the invariantx = BitwiseOr(y, z)
over three long scalars.static class
FunctionBinary.BitwiseOrLong_yxz
Represents the invarianty = BitwiseOr(x, z)
over three long scalars.static class
FunctionBinary.BitwiseOrLong_zxy
Represents the invariantz = BitwiseOr(x, y)
over three long scalars.static class
FunctionBinary.BitwiseXorLong_xyz
Represents the invariantx = BitwiseXor(y, z)
over three long scalars.static class
FunctionBinary.BitwiseXorLong_yxz
Represents the invarianty = BitwiseXor(x, z)
over three long scalars.static class
FunctionBinary.BitwiseXorLong_zxy
Represents the invariantz = BitwiseXor(x, y)
over three long scalars.static class
FunctionBinary.DivisionLong_xyz
Represents the invariantx = Division(y, z)
over three long scalars.static class
FunctionBinary.DivisionLong_xzy
Represents the invariantx = Division(z, y)
over three long scalars.static class
FunctionBinary.DivisionLong_yxz
Represents the invarianty = Division(x, z)
over three long scalars.static class
FunctionBinary.DivisionLong_yzx
Represents the invarianty = Division(z, x)
over three long scalars.static class
FunctionBinary.DivisionLong_zxy
Represents the invariantz = Division(x, y)
over three long scalars.static class
FunctionBinary.DivisionLong_zyx
Represents the invariantz = Division(y, x)
over three long scalars.static class
FunctionBinary.GcdLong_xyz
Represents the invariantx = Gcd(y, z)
over three long scalars.static class
FunctionBinary.GcdLong_yxz
Represents the invarianty = Gcd(x, z)
over three long scalars.static class
FunctionBinary.GcdLong_zxy
Represents the invariantz = Gcd(x, y)
over three long scalars.static class
FunctionBinary.LogicalAndLong_xyz
Represents the invariantx = LogicalAnd(y, z)
over three long scalars.static class
FunctionBinary.LogicalAndLong_yxz
Represents the invarianty = LogicalAnd(x, z)
over three long scalars.static class
FunctionBinary.LogicalAndLong_zxy
Represents the invariantz = LogicalAnd(x, y)
over three long scalars.static class
FunctionBinary.LogicalOrLong_xyz
Represents the invariantx = LogicalOr(y, z)
over three long scalars.static class
FunctionBinary.LogicalOrLong_yxz
Represents the invarianty = LogicalOr(x, z)
over three long scalars.static class
FunctionBinary.LogicalOrLong_zxy
Represents the invariantz = LogicalOr(x, y)
over three long scalars.static class
FunctionBinary.LogicalXorLong_xyz
Represents the invariantx = LogicalXor(y, z)
over three long scalars.static class
FunctionBinary.LogicalXorLong_yxz
Represents the invarianty = LogicalXor(x, z)
over three long scalars.static class
FunctionBinary.LogicalXorLong_zxy
Represents the invariantz = LogicalXor(x, y)
over three long scalars.static class
FunctionBinary.LshiftLong_xyz
Represents the invariantx = Lshift(y, z)
over three long scalars.static class
FunctionBinary.LshiftLong_xzy
Represents the invariantx = Lshift(z, y)
over three long scalars.static class
FunctionBinary.LshiftLong_yxz
Represents the invarianty = Lshift(x, z)
over three long scalars.static class
FunctionBinary.LshiftLong_yzx
Represents the invarianty = Lshift(z, x)
over three long scalars.static class
FunctionBinary.LshiftLong_zxy
Represents the invariantz = Lshift(x, y)
over three long scalars.static class
FunctionBinary.LshiftLong_zyx
Represents the invariantz = Lshift(y, x)
over three long scalars.static class
FunctionBinary.MaximumLong_xyz
Represents the invariantx = Maximum(y, z)
over three long scalars.static class
FunctionBinary.MaximumLong_yxz
Represents the invarianty = Maximum(x, z)
over three long scalars.static class
FunctionBinary.MaximumLong_zxy
Represents the invariantz = Maximum(x, y)
over three long scalars.static class
FunctionBinary.MinimumLong_xyz
Represents the invariantx = Minimum(y, z)
over three long scalars.static class
FunctionBinary.MinimumLong_yxz
Represents the invarianty = Minimum(x, z)
over three long scalars.static class
FunctionBinary.MinimumLong_zxy
Represents the invariantz = Minimum(x, y)
over three long scalars.static class
FunctionBinary.ModLong_xyz
Represents the invariantx = Mod(y, z)
over three long scalars.static class
FunctionBinary.ModLong_xzy
Represents the invariantx = Mod(z, y)
over three long scalars.static class
FunctionBinary.ModLong_yxz
Represents the invarianty = Mod(x, z)
over three long scalars.static class
FunctionBinary.ModLong_yzx
Represents the invarianty = Mod(z, x)
over three long scalars.static class
FunctionBinary.ModLong_zxy
Represents the invariantz = Mod(x, y)
over three long scalars.static class
FunctionBinary.ModLong_zyx
Represents the invariantz = Mod(y, x)
over three long scalars.static class
FunctionBinary.MultiplyLong_xyz
Represents the invariantx = Multiply(y, z)
over three long scalars.static class
FunctionBinary.MultiplyLong_yxz
Represents the invarianty = Multiply(x, z)
over three long scalars.static class
FunctionBinary.MultiplyLong_zxy
Represents the invariantz = Multiply(x, y)
over three long scalars.static class
FunctionBinary.PowerLong_xyz
Represents the invariantx = Power(y, z)
over three long scalars.static class
FunctionBinary.PowerLong_xzy
Represents the invariantx = Power(z, y)
over three long scalars.static class
FunctionBinary.PowerLong_yxz
Represents the invarianty = Power(x, z)
over three long scalars.static class
FunctionBinary.PowerLong_yzx
Represents the invarianty = Power(z, x)
over three long scalars.static class
FunctionBinary.PowerLong_zxy
Represents the invariantz = Power(x, y)
over three long scalars.static class
FunctionBinary.PowerLong_zyx
Represents the invariantz = Power(y, x)
over three long scalars.static class
FunctionBinary.RshiftSignedLong_xyz
Represents the invariantx = RshiftSigned(y, z)
over three long scalars.static class
FunctionBinary.RshiftSignedLong_xzy
Represents the invariantx = RshiftSigned(z, y)
over three long scalars.static class
FunctionBinary.RshiftSignedLong_yxz
Represents the invarianty = RshiftSigned(x, z)
over three long scalars.static class
FunctionBinary.RshiftSignedLong_yzx
Represents the invarianty = RshiftSigned(z, x)
over three long scalars.static class
FunctionBinary.RshiftSignedLong_zxy
Represents the invariantz = RshiftSigned(x, y)
over three long scalars.static class
FunctionBinary.RshiftSignedLong_zyx
Represents the invariantz = RshiftSigned(y, x)
over three long scalars.static class
FunctionBinary.RshiftUnsignedLong_xyz
Represents the invariantx = RshiftUnsigned(y, z)
over three long scalars.static class
FunctionBinary.RshiftUnsignedLong_xzy
Represents the invariantx = RshiftUnsigned(z, y)
over three long scalars.static class
FunctionBinary.RshiftUnsignedLong_yxz
Represents the invarianty = RshiftUnsigned(x, z)
over three long scalars.static class
FunctionBinary.RshiftUnsignedLong_yzx
Represents the invarianty = RshiftUnsigned(z, x)
over three long scalars.static class
FunctionBinary.RshiftUnsignedLong_zxy
Represents the invariantz = RshiftUnsigned(x, y)
over three long scalars.static class
FunctionBinary.RshiftUnsignedLong_zyx
Represents the invariantz = RshiftUnsigned(y, x)
over three long scalars.-
Nested classes/interfaces inherited from class Invariant
Invariant.ClassVarnameComparator, Invariant.ClassVarnameFormulaComparator, Invariant.InvariantComparatorForPrinting, Invariant.Match
-
-
Field Summary
Fields Modifier and Type Field Description static Logger
debug
static boolean
dkconfig_enabled
Boolean.-
Fields inherited from class Invariant
CONFIDENCE_JUSTIFIED, CONFIDENCE_NEVER, CONFIDENCE_UNJUSTIFIED, debugFlow, debugGuarding, debugIsObvious, debugIsWorthPrinting, debugPrint, debugPrintEquality, dkconfig_confidence_limit, dkconfig_fuzzy_ratio, dkconfig_simplify_define_predicates, falsified, invariantEnabledDefault, isGuardingPredicate, min_mod_non_missing_samples, ppt, PROBABILITY_JUSTIFIED, PROBABILITY_NEVER, PROBABILITY_UNJUSTIFIED
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FunctionBinary()
protected
FunctionBinary(PptSlice ppt)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description InvariantStatus
add_ordered(long result, long arg1, long arg2, int count)
Apply the specified sample to the function, returning the result.VarInfo
argVar1()
Permuted arg1 var.VarInfo
argVar2()
Permuted arg2 var.InvariantStatus
check_ordered(long result, long arg1, long arg2, int count)
Apply the specified sample to the function, returning the result.double
computeConfidence()
This method computes the confidence that this invariant occurred by chance.boolean
enabled()
returns whether or not this invariant is enabledString
format_csharp_contract()
String
format_simplify()
String
format_using(OutputFormat format)
Return a printed representation of this invariant, in the given format.static List<Invariant>
get_proto_all()
Returns a list of all of the FunctionBinary prototype invariants.boolean
instantiate_ok(VarInfo[] vis)
FunctionBinary is only valid on isIntegral() types.boolean
isBitwiseAnd()
boolean
isBitwiseOr()
boolean
isBitwiseXor()
boolean
isDivision()
boolean
isGcd()
boolean
isLogicalAnd()
boolean
isLogicalOr()
boolean
isLogicalXor()
boolean
isLshift()
boolean
isMaximum()
boolean
isMinimum()
boolean
isMod()
boolean
isMultiply()
@Nullable DiscardInfo
isObviousDynamically(VarInfo[] vis)
Return non-null if this invariant is necessarily true from a fact that can be determined dynamically (after checking data) -- for the given varInfos rather than the varInfos of this.boolean
isPower()
boolean
isRshiftSigned()
boolean
isRshiftUnsigned()
boolean
isSameFormula(Invariant other)
Returns true iff the two invariants represent the same mathematical formula.String
repr()
For printing invariants, there are two interfaces: repr gives a low-level representation (Invariant.repr_prob()
also prints the confidence), andInvariant.format()
gives a high-level representation for user output.VarInfo
resultVar()
Permuted result var.protected Invariant
resurrect_done(int[] permutation)
Reorganize our already-seen state as if the variables had shifted order underneath us (re-arrangement given by the permutation).-
Methods inherited from class ThreeScalar
add, add_modified, add_unmodified, check, check_modified, check_unmodified, valid_types, var1, var2, var3
-
Methods inherited from class Invariant
add_sample, asInvClass, checkRep, clear_falsified, clone, clone_and_permute, conf_is_ge, confidence_and, confidence_and, confidence_or, createGuardedInvariant, createGuardingPredicate, enoughSamples, falsify, find, format, format_classname, format_too_few_samples, format_unimplemented, formatFuzzy, get_comparability, get_ni_suppressions, getConfidence, getGuardingList, getGuardingList, hasUninterestingConstant, instantiate, instantiate_dyn, is_false, is_ni_suppressed, isActive, isAllPrestate, isEqualityComparison, isExact, isExclusiveFormula, isObvious, isObviousDynamically, isObviousDynamically_SomeInEquality, isObviousDynamically_SomeInEqualityHelper, isObviousStatically, isObviousStatically, isObviousStatically_AllInEquality, isObviousStatically_SomeInEquality, isObviousStatically_SomeInEqualityHelper, isReflexive, isSameInvariant, isValidEscExpression, isValidExpression, isWorthPrinting, justified, log, log, logDetail, logOn, match, merge, mergeFormulasOk, permute, prob_and, prob_and, prob_is_ge, prob_or, repCheck, repr_prob, resurrect, simplify_format_double, simplify_format_long, simplify_format_string, state_match, toString, toString, transfer, usesVar, usesVar, usesVarDerived, varNames
-
-
-
-
Field Detail
-
dkconfig_enabled
public static boolean dkconfig_enabled
Boolean. True if FunctionBinary invariants should be considered.
-
-
Constructor Detail
-
FunctionBinary
protected FunctionBinary(PptSlice ppt)
-
FunctionBinary
protected FunctionBinary()
-
-
Method Detail
-
enabled
public boolean enabled()
returns whether or not this invariant is enabled
-
instantiate_ok
public boolean instantiate_ok(VarInfo[] vis)
FunctionBinary is only valid on isIntegral() types.- Overrides:
instantiate_ok
in classInvariant
- See Also:
Invariant.valid_types(VarInfo[])
-
get_proto_all
public static List<Invariant> get_proto_all()
Returns a list of all of the FunctionBinary prototype invariants.
-
check_ordered
public InvariantStatus check_ordered(long result, long arg1, long arg2, int count)
Apply the specified sample to the function, returning the result. The caller is responsible for permuting the arguments.
-
add_ordered
public InvariantStatus add_ordered(long result, long arg1, long arg2, int count)
Apply the specified sample to the function, returning the result. The caller is responsible for permuting the arguments.
-
resurrect_done
protected Invariant resurrect_done(int[] permutation)
Reorganize our already-seen state as if the variables had shifted order underneath us (re-arrangement given by the permutation). We accomplish this by returning the class that corresponds to the new permutation.- Overrides:
resurrect_done
in classTernaryInvariant
- Parameters:
permutation
- the permutation- Returns:
- the permuted invariant
-
repr
public String repr(@GuardSatisfied FunctionBinary this)
Description copied from class:Invariant
For printing invariants, there are two interfaces: repr gives a low-level representation (Invariant.repr_prob()
also prints the confidence), andInvariant.format()
gives a high-level representation for user output.
-
format_using
@SideEffectFree public String format_using(@GuardSatisfied FunctionBinary this, OutputFormat format)
Description copied from class:Invariant
Return a printed representation of this invariant, in the given format.- Specified by:
format_using
in classInvariant
-
format_simplify
public String format_simplify(@GuardSatisfied FunctionBinary this)
-
format_csharp_contract
public String format_csharp_contract(@GuardSatisfied FunctionBinary this)
-
isSameFormula
@Pure public boolean isSameFormula(Invariant other)
Description copied from class:Invariant
Returns true iff the two invariants represent the same mathematical formula. Does not consider the context such as variable names, confidences, sample counts, value counts, or related quantities. As a rule of thumb, if two invariants format the same, this method returns true. Furthermore, in many cases, if an invariant does not involve computed constants (as "x>c" and "y=ax+b" do for constants a, b, and c), then this method vacuously returns true.- Specified by:
isSameFormula
in classInvariant
- Parameters:
other
- the invariant to compare to this one- Returns:
- true iff the two invariants represent the same mathematical formula. Does not consider
-
computeConfidence
public double computeConfidence()
Description copied from class:Invariant
This method computes the confidence that this invariant occurred by chance. Clients should callInvariant.getConfidence()
instead.This method need not check the value of field "falsified", as the caller does that.
- Specified by:
computeConfidence
in classInvariant
- Returns:
- confidence of this invariant
- See Also:
Invariant.getConfidence()
-
isObviousDynamically
@Pure public @Nullable DiscardInfo isObviousDynamically(VarInfo[] vis)
Description copied from class:Invariant
Return non-null if this invariant is necessarily true from a fact that can be determined dynamically (after checking data) -- for the given varInfos rather than the varInfos of this. Conceptually, this means, "Is this invariant dynamically obvious if its VarInfos were switched with vis?" Intended to be overriden by subclasses so they can filter invariants after checking; the overriding method should first call "super.isObviousDynamically(vis)". Since this method is dynamic, it should only be called after all processing.- Overrides:
isObviousDynamically
in classInvariant
-
isMultiply
@Pure public boolean isMultiply()
-
isMinimum
@Pure public boolean isMinimum()
-
isMaximum
@Pure public boolean isMaximum()
-
isDivision
@Pure public boolean isDivision()
-
isPower
@Pure public boolean isPower()
-
isBitwiseAnd
@Pure public boolean isBitwiseAnd()
-
isLogicalAnd
@Pure public boolean isLogicalAnd()
-
isBitwiseXor
@Pure public boolean isBitwiseXor()
-
isLogicalXor
@Pure public boolean isLogicalXor()
-
isBitwiseOr
@Pure public boolean isBitwiseOr()
-
isLogicalOr
@Pure public boolean isLogicalOr()
-
isGcd
@Pure public boolean isGcd()
-
isMod
@Pure public boolean isMod()
-
isLshift
@Pure public boolean isLshift()
-
isRshiftSigned
@Pure public boolean isRshiftSigned()
-
isRshiftUnsigned
@Pure public boolean isRshiftUnsigned()
-
-