Buggy code:
public class RewriteEngineUtils { public static boolean isSubsorted ( Term big , Term small , TermContext context ) { } public static boolean isSubsortedEq ( Term big , Term small , TermContext context ) { } public static Substitution < Variable , Term > evaluateConditions ( Rule rule , Substitution < Variable , Term > substitution , TermContext context ) { Substitution < Variable , Term > crntSubst = substitution ; for ( Variable variable : rule . freshConstants ( ) ) { crntSubst = crntSubst . plus ( variable , FreshOperations . fresh ( variable . sort ( ) , context ) ) ; } Profiler . startTimer ( EVALUATE_LOOKUP_CHOICE_TIMER ) ; int i = 0 ; for ( Equality equality : rule . lookups ( ) . equalities ( ) ) { Term lookupOrChoice = equality . leftHandSide ( ) ; Term nonLookupOrChoice = equality . rightHandSide ( ) ; <START_BUG> List < RHSInstruction > instructions = rule . instructionsOfRequires ( ) . get ( i ) ; <END_BUG> Term evalLookupOrChoice = KAbstractRewriteMachine . construct ( instructions , crntSubst , null , context , false ) ; boolean resolved = false ; if ( ( evalLookupOrChoice instanceof Bottom ) || ( DataStructures . isLookupOrChoice ( evalLookupOrChoice ) ) ) { if ( ( ! resolved ) && ( RuleAuditing . isAuditBegun ( ) ) ) { System . err . println ( ( ( ( "Matching<seq2seq4repair_space>failure:<seq2seq4repair_space>unable<seq2seq4repair_space>to<seq2seq4repair_space>resolve<seq2seq4repair_space>collection<seq2seq4repair_space>operation<seq2seq4repair_space>" + ( lookupOrChoice . substitute ( crntSubst , context ) ) ) + ";<seq2seq4repair_space>evaluated<seq2seq4repair_space>to<seq2seq4repair_space>" ) + evalLookupOrChoice ) ) ; } } else { if ( nonLookupOrChoice instanceof Variable ) { Variable variable = ( ( Variable ) ( nonLookupOrChoice ) ) ; if ( context . definition ( ) . subsorts ( ) . isSubsortedEq ( variable . sort ( ) , evalLookupOrChoice . sort ( ) ) ) { Substitution < Variable , Term > newSubst = crntSubst . plus ( variable , evalLookupOrChoice ) ; resolved = newSubst != null ; if ( ( ! resolved ) && ( RuleAuditing . isAuditBegun ( ) ) ) { System . err . println ( ( ( ( ( ( "Matching<seq2seq4repair_space>failure:<seq2seq4repair_space>" + variable ) + "<seq2seq4repair_space>must<seq2seq4repair_space>match<seq2seq4repair_space>both<seq2seq4repair_space>" ) + ( crntSubst . get ( variable ) ) ) + "<seq2seq4repair_space>and<seq2seq4repair_space>" ) + evalLookupOrChoice ) ) ; } crntSubst = newSubst ; } } else { Term evalNonLookupOrChoice = nonLookupOrChoice . substituteAndEvaluate ( crntSubst , context ) ; PatternMatcher lookupMatcher = new PatternMatcher ( rule . isLemma ( ) , context ) ; if ( lookupMatcher . patternMatch ( evalLookupOrChoice , evalNonLookupOrChoice ) ) { if ( nonLookupOrChoice . variableSet ( ) . containsAll ( lookupMatcher . substitution ( ) . keySet ( ) ) ) { resolved = true ; crntSubst = crntSubst . plusAll ( lookupMatcher . substitution ( ) ) ; } else if ( ( ! resolved ) && ( RuleAuditing . isAuditBegun ( ) ) ) { System . err . println ( ( ( ( "Matching<seq2seq4repair_space>failure:<seq2seq4repair_space>substitution<seq2seq4repair_space>" + ( lookupMatcher . substitution ( ) ) ) + "<seq2seq4repair_space>missing<seq2seq4repair_space>variables<seq2seq4repair_space>" ) + ( Sets . difference ( lookupMatcher . substitution ( ) . keySet ( ) , nonLookupOrChoice . variableSet ( ) ) ) ) ) ; } } } } if ( ! resolved ) { crntSubst = null ; break ; } ++ i ; } Profiler . stopTimer ( EVALUATE_LOOKUP_CHOICE_TIMER ) ; Profiler . startTimer ( EVALUATE_REQUIRES_TIMER ) ; if ( crntSubst != null ) { i = 0 ; for ( Term require : rule . requires ( ) ) { Term evaluatedReq = KAbstractRewriteMachine . construct ( rule . instructionsOfRequires ( ) . get ( i ) , crntSubst , null , context , false ) ; if ( ! ( evaluatedReq . equals ( TRUE ) ) ) { if ( RuleAuditing . isAuditBegun ( ) ) { System . err . println ( ( ( ( "Side<seq2seq4repair_space>condition<seq2seq4repair_space>failure:<seq2seq4repair_space>" + ( require . substituteWithBinders ( crntSubst , context ) ) ) + "<seq2seq4repair_space>evaluated<seq2seq4repair_space>to<seq2seq4repair_space>" ) + evaluatedReq ) ) ; } crntSubst = null ; break ; } i ++ ; } } Profiler . stopTimer ( EVALUATE_REQUIRES_TIMER ) ; return crntSubst ; } public static List < Substitution < Variable , Term > > evaluateConditions ( Rule rule , List < Substitution < Variable , Term > > substitutions , TermContext context ) { } public static Term evaluateLookupOrChoice ( Term lookupOrChoice , Map < Variable , Term > subst , TermContext context ) { } public static List < Map < Variable , Term > > getMultiSubstitutions ( Map < Variable , Term > fSubstitution , Collection < Collection < Map < Variable , Term > > > multiSubstitutions ) { } public static Map < Variable , Term > composeSubstitution ( Map < Variable , Term > subst1 , Map < Variable , Term > subst2 ) { } @ SafeVarargs public static Map < Variable , Term > composeSubstitution ( Map < Variable , Term > ... substs ) { } }

Fix:
List < RHSInstruction > instructions = rule . instructionsOfLookups ( ) . get ( i ) ;