/** * 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); }