Skip to content
Snippets Groups Projects
Commit bd958218 authored by Etienne Kneuss's avatar Etienne Kneuss
Browse files

Fix IntInduction

parent 1be039de
No related branches found
No related tags found
No related merge requests found
...@@ -24,12 +24,13 @@ case object IntInduction extends Rule("Int Induction") with Heuristic { ...@@ -24,12 +24,13 @@ case object IntInduction extends Rule("Int Induction") with Heuristic {
val postXsMap = (p.xs zip postXs).toMap.mapValues(Variable(_)) val postXsMap = (p.xs zip postXs).toMap.mapValues(Variable(_))
val newPhi = subst(origId -> Variable(inductOn), p.phi) val newPhi = subst(origId -> Variable(inductOn), p.phi)
val newPc = subst(origId -> Variable(inductOn), p.pc)
val postCondGT = substAll(postXsMap + (origId -> Minus(Variable(inductOn), IntLiteral(1))), p.phi) val postCondGT = substAll(postXsMap + (origId -> Minus(Variable(inductOn), IntLiteral(1))), p.phi)
val postCondLT = substAll(postXsMap + (origId -> Plus(Variable(inductOn), IntLiteral(1))), p.phi) val postCondLT = substAll(postXsMap + (origId -> Plus(Variable(inductOn), IntLiteral(1))), p.phi)
val subBase = Problem(List(), p.pc, subst(origId -> IntLiteral(0), p.phi), p.xs) val subBase = Problem(List(), subst(origId -> IntLiteral(0), p.pc), subst(origId -> IntLiteral(0), p.phi), p.xs)
val subGT = Problem(inductOn :: postXs, And(Seq(GreaterThan(Variable(inductOn), IntLiteral(0)), postCondGT, p.pc)), newPhi, p.xs) val subGT = Problem(inductOn :: postXs, And(Seq(GreaterThan(Variable(inductOn), IntLiteral(0)), postCondGT, newPc)), newPhi, p.xs)
val subLT = Problem(inductOn :: postXs, And(Seq(LessThan(Variable(inductOn), IntLiteral(0)), postCondLT, p.pc)), newPhi, p.xs) val subLT = Problem(inductOn :: postXs, And(Seq(LessThan(Variable(inductOn), IntLiteral(0)), postCondLT, newPc)), newPhi, p.xs)
val onSuccess: List[Solution] => Option[Solution] = { val onSuccess: List[Solution] => Option[Solution] = {
case List(base, gt, lt) => case List(base, gt, lt) =>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment