Skip to content

Commit f1bb253

Browse files
committed
Slightly improved position finding in edit tactic
1 parent 7fe09a3 commit f1bb253

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

keymaerax-core/src/main/scala/edu/cmu/cs/ls/keymaerax/btactics/ToolTactics.scala

+6-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,12 @@ private object ToolTactics {
215215
})) skip
216216
else transform(expandTo)(pos)
217217
} catch {
218-
case _: UnificationException => transform(expandTo)(pos)
218+
case ex: UnificationException =>
219+
//@note looks for specific transform position until we have better formula diff
220+
FormulaTools.posOf(e, ex.e2.asExpr) match {
221+
case Some(pp) => transform(ex.e1.asExpr)(pos.topLevel ++ pp) | transform(expandTo)(pos)
222+
case _ => transform(expandTo)(pos)
223+
}
219224
}
220225
})
221226

keymaerax-webui/src/test/scala/edu/cmu/cs/ls/keymaerax/btactics/ToolTacticsTests.scala

+10
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,14 @@ class ToolTacticsTests extends TacticTestBase {
248248
"abs_0>0, abs_2>3, a>=0 & abs_0=a | a<0 & abs_0=-a, b>=0 & abs_1=b | b<0 & abs_1=-b, c>=0 & abs_2=c | c<0 & abs_2=-c ==> abs_0>0 | abs_1>1 | abs_2>2".asSequent
249249
}
250250

251+
it should "transform in programs" in withQE { _ =>
252+
val result = proveBy("x<0 -> [x:=x-1+0*z;]x<0".asFormula, edit("x<0 -> [x:=x-1;]x<0".asFormula)(1))
253+
result.subgoals.loneElement shouldBe "==> x<0 -> [x:=x-1;]x<0".asSequent
254+
}
255+
256+
it should "transform postcondition of modal" in withQE { _ =>
257+
val result = proveBy("x<0 -> [x:=x-1;](x<0&v^2>=0)".asFormula, edit("x<0 -> [x:=x-1;]x<0".asFormula)(1))
258+
result.subgoals.loneElement shouldBe "==> x<0 -> [x:=x-1;]x<0".asSequent
259+
}
260+
251261
}

0 commit comments

Comments
 (0)