internal override BranchingRule <TERM> Subst1(TERM path, IContextCore <TERM> solver, Dictionary <TERM, TERM> subst) { TERM condInst = solver.Simplify(solver.ApplySubstitution(condition, subst)); TERM path_and_condInst = And(solver, path, condInst); TERM path_and_not_condInst = And(solver, path, solver.MkNot(condInst)); if (!solver.IsSatisfiable(path_and_condInst)) { return(falseCase.Subst1(path, solver, subst)); } if (!solver.IsSatisfiable(path_and_not_condInst)) { return(trueCase.Subst1(path, solver, subst)); } else { var t = trueCase.Subst1(path_and_condInst, solver, subst); var f = falseCase.Subst1(path_and_not_condInst, solver, subst); if ((t is UndefRule <TERM>) && (f is UndefRule <TERM>)) { return(UndefRule <TERM> .Default); } return(new IteRule <TERM>(condInst, t, f)); } }
public STbRule <TERM> CollapseRedundantITEs(IContextCore <TERM> solver) { switch (this.RuleKind) { case STbRuleKind.Ite: { var t = this.TrueCase.CollapseRedundantITEs(solver); var f = this.FalseCase.CollapseRedundantITEs(solver); if (t.RuleKind == STbRuleKind.Undef && f.RuleKind == STbRuleKind.Undef) { return(t); } else if (t.RuleKind == STbRuleKind.Base && f.RuleKind == STbRuleKind.Base) { var tb = t as BaseRule <TERM>; var fb = f as BaseRule <TERM>; if (tb.State == fb.State && tb.Yields.Length == fb.Yields.Length && !solver.IsSatisfiable(solver.MkOr(GetBaseRuleNonequivalences(solver, tb, fb)))) { return(tb); } } if (f == this.FalseCase && t == this.TrueCase) { return(this); } else { return(new IteRule <TERM>(this.Condition, t, f)); } } default: return(this); } }