public DiscardInfo isObviousStatically(VarInfo[] vis) { VarInfo var1 = vis[0]; VarInfo var2 = vis[1]; Object[] obv1 = SubSequence.isObviousSubSequence(var1, var2); Object[] obv2 = SubSequence.isObviousSubSequence(var2, var1); if (obv1[1] != null) { Global.implied_noninstantiated_invariants++; return new DiscardInfo(this, (DiscardCode) obv1[0], (String) obv1[1]); } else if (obv2[1] != null) { Global.implied_noninstantiated_invariants++; return new DiscardInfo(this, (DiscardCode) obv1[0], (String) obv1[1]); } // Don't instantiate if the variables can't have order if (!var1.aux.getFlag(VarInfoAux.HAS_ORDER) || !var2.aux.getFlag(VarInfoAux.HAS_ORDER)) { if (debug.isLoggable(Level.FINE)) { debug.fine( "Not instantitating for because order has no meaning: " + var1.name() + " and " + var2.name()); } return new DiscardInfo( this, DiscardCode.obvious, "Obvious statically since order has no meaning"); } return super.isObviousStatically(vis); }
/** * Checks to see if the same invariant exists over supersequences of these variables: * * <p>(A[] op B[]) ^ (i == j) ==> A[i..] op B[j..] (A[] op B[]) ^ (i == j) ==> A[..i] op B[..j] */ private DiscardInfo superseq_implies(VarInfo[] vis) { // Make sure the variables are SequenceScalarSubsequence with the same start/end VarInfo v1 = vis[0]; VarInfo v2 = vis[1]; if (!v1.isDerived() || !(v1.derived instanceof SequenceScalarSubsequence)) return (null); if (!v2.isDerived() || !(v2.derived instanceof SequenceScalarSubsequence)) return (null); SequenceScalarSubsequence der1 = (SequenceScalarSubsequence) v1.derived; SequenceScalarSubsequence der2 = (SequenceScalarSubsequence) v2.derived; if ((der1.from_start != der2.from_start) || (der1.index_shift != der2.index_shift)) return (null); // Make sure the subscripts are equal DiscardInfo di = new DiscardInfo(this, DiscardCode.obvious, ""); if (!ppt.parent.check_implied_canonical(di, der1.sclvar(), der2.sclvar(), IntEqual.get_proto())) return (null); // See if the super-sequences have the same invariant if (!ppt.parent.check_implied_canonical( di, der1.seqvar(), der2.seqvar(), PairwiseIntLessThan.get_proto())) return (null); // Add in the vis variables to di reason (if they are different) di.add_implied_vis(vis); return (di); }
/* IOA */ public String format_ioa() { if (var1().isIOASet() || var2().isIOASet()) return "Not valid for sets: " + format(); Quantify.IOAQuantification quant1 = VarInfo.get_ioa_quantify(var1()); Quantify.IOAQuantification quant2 = VarInfo.get_ioa_quantify(var2()); return quant1.getQuantifierExp() + quant1.getVarIndexedString(0) + " " + "< " + quant2.getVarIndexedString(0) + quant1.getClosingExp(); }
public String format_simplify() { String[] form = VarInfo.simplify_quantify(QuantFlags.element_wise(), var1(), var2()); return form[0] + "(< " + form[1] + " " + form[2] + ")" + form[3]; }
public String format_esc() { String[] form = VarInfo.esc_quantify(var1(), var2()); return form[0] + "(" + form[1] + " < " + form[2] + ")" + form[3]; }