Skip to content

Commit b6ebab9

Browse files
committed
Fixed Auto justification issues.
1 parent dcd8bc7 commit b6ebab9

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

shared/src/main/scala/org/sireum/logika/Logika.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,11 @@ import Util._
18351835

18361836
def evalSelect(exp: AST.Exp.Select): ISZ[(State, State.Value)] = {
18371837
val pos = exp.id.attr.posOpt.get
1838+
exp.attr.resOpt.get match {
1839+
case res: AST.ResolvedInfo.Method if res.tpeOpt.isEmpty =>
1840+
println("Here")
1841+
case _ =>
1842+
}
18381843
exp.attr.resOpt.get match {
18391844
case res: AST.ResolvedInfo.BuiltIn if res.kind == AST.ResolvedInfo.BuiltIn.Kind.IsInstanceOf ||
18401845
res.kind == AST.ResolvedInfo.BuiltIn.Kind.AsInstanceOf =>
@@ -4878,7 +4883,7 @@ import Util._
48784883
if (s0.ok) {
48794884
if (step.steps.size > 0) {
48804885
m = stateMap._2 + stepNo ~> StepProofContext.SubProof(stepNo,
4881-
th.normalizeExp(step.steps(0).asInstanceOf[AST.ProofAst.Step.Assume].claim), extractClaims(step.steps),
4886+
step.steps(0).asInstanceOf[AST.ProofAst.Step.Assume].claim, extractClaims(step.steps),
48824887
extractSpcs(1, step.steps))
48834888
}
48844889
return (s0, m)
@@ -4918,7 +4923,7 @@ import Util._
49184923
if (step.steps.nonEmpty && step.steps(0).isInstanceOf[AST.ProofAst.Step.Assume]) {
49194924
return (s0,
49204925
stateMap._2 + stepNo ~> StepProofContext.FreshAssumeSubProof(stepNo, step.context, step.params,
4921-
th.normalizeExp(step.steps(0).asInstanceOf[AST.ProofAst.Step.Assume].claim),
4926+
step.steps(0).asInstanceOf[AST.ProofAst.Step.Assume].claim,
49224927
extractClaims(step.steps), extractSpcs(1, step.steps)))
49234928
} else {
49244929
return (s0,

shared/src/main/scala/org/sireum/logika/plugin/AutoPlugin.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ object AutoPlugin {
356356
r = r + logika.th.normalizeExp(claim) ~> (spc.stepNo, T, claim)
357357
case spc: StepProofContext.SubProof =>
358358
val claims: ISZ[AST.Exp] = for (p <- computeProvenClaims(spc.spcs).entries) yield p._2._3
359-
val claim = AST.Util.bigImply(F, ISZ(spc.assumption, AST.Util.bigAnd(claims, spc.stepNo.posOpt)), spc.stepNo.posOpt)
359+
val claim = AST.Util.bigImply(T, ISZ(spc.assumption, AST.Util.bigAnd(claims, spc.stepNo.posOpt)), spc.stepNo.posOpt)
360360
r = r + logika.th.normalizeExp(claim) ~> (spc.stepNo, F, claim)
361361
case spc: StepProofContext.FreshSubProof =>
362362
val claims: ISZ[AST.Exp] = for (p <- computeProvenClaims(spc.spcs).entries) yield p._2._3
@@ -376,7 +376,7 @@ object AutoPlugin {
376376
params = params :+ AST.Exp.Fun.Param(Some(p.id), p.tipeOpt, p.tipeOpt.get.typedOpt)
377377
}
378378
val claim = AST.Exp.QuantType(F, AST.Exp.Fun(spc.context, params,
379-
AST.Stmt.Expr(AST.Util.bigImply(F, ISZ(spc.assumption, AST.Util.bigAnd(claims, spc.stepNo.posOpt)),
379+
AST.Stmt.Expr(AST.Util.bigImply(T, ISZ(spc.assumption, AST.Util.bigAnd(claims, spc.stepNo.posOpt)),
380380
spc.stepNo.posOpt), tattr), tattr), AST.Attr(spc.stepNo.posOpt))
381381
r = r + logika.th.normalizeExp(claim) ~> (spc.stepNo, F, claim)
382382
}
@@ -465,8 +465,8 @@ object AutoPlugin {
465465
var s0 = state
466466
for (p <- provenClaims.entries) {
467467
if (!p._2._2) {
468-
val (s1, exp) = l.rewriteAt(atMap, s0, p._1, reporter)
469-
s0 = l.evalAssume(smt2, cache, T, "", s1, exp, p._1.posOpt, reporter)._1
468+
val (s1, exp) = l.rewriteAt(atMap, s0, p._2._3, reporter)
469+
s0 = l.evalAssume(smt2, cache, T, "", s1, exp, p._2._3.posOpt, reporter)._1
470470
}
471471
}
472472
val (s2, conclusion) = l.evalRegularStepClaimValue(smt2, cache, s0, step.claim, step.id.posOpt, reporter)
@@ -478,8 +478,7 @@ object AutoPlugin {
478478
}
479479
return err
480480
} else {
481-
val psmt2 = smt2.emptyCache(logika.config)
482-
val (suc, m) = state.unconstrainedClaims
481+
val (suc, _) = state.unconstrainedClaims
483482
var s1 = suc
484483
var ok = T
485484
val provenClaimMap = HashMap ++ (for (p <- provenClaims.entries) yield p._2._1 ~> p._2._3)
@@ -498,9 +497,9 @@ object AutoPlugin {
498497
return err
499498
}
500499
val (s5, exp) = l.rewriteAt(atMap, s1, step.claim, reporter)
501-
val (s6, conclusion) = l.evalRegularStepClaimValue(psmt2, cache, s5, exp, step.id.posOpt, reporter)
500+
val (s6, conclusion) = l.evalRegularStepClaimValue(smt2, cache, s5, exp, step.id.posOpt, reporter)
502501
if (s6.ok) {
503-
val r = checkValid(psmt2, s6, State.Claim.Prop(T, conclusion))
502+
val r = checkValid(smt2, s6, State.Claim.Prop(T, conclusion))
504503
if (r.ok) {
505504
return state(claims = state.claims ++ ops.ISZOps(r.claims).slice(s1.claims.size, r.claims.size), nextFresh = r.nextFresh)
506505
}

shared/src/main/scala/org/sireum/logika/plugin/PredNatDedPlugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ object PredNatDedPlugin {
170170
return err
171171
}
172172
val (params, assumption, subProof): (ISZ[AST.ProofAst.Step.Let.Param], AST.Exp, HashSet[AST.Exp]) = spcMap.get(subProofNo) match {
173-
case Some(sp@StepProofContext.FreshAssumeSubProof(_, _, ps, ac, _, _)) => (ps, ac, HashSet ++ sp.claims)
173+
case Some(sp@StepProofContext.FreshAssumeSubProof(_, _, ps, ac, _, _)) => (ps, logika.th.normalizeExp(ac), HashSet ++ sp.claims)
174174
case _ =>
175175
reporter.error(subProofNo.posOpt, Logika.kind, s"Expecting a parameterized let sub-proof assume step")
176176
return err

shared/src/main/scala/org/sireum/logika/plugin/PropNatDedPlugin.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ import org.sireum.logika.Logika.Reporter
125125
}
126126
val ISZ(subProofNo) = args
127127
val subProof: HashSet[AST.Exp] = spcMap.get(subProofNo) match {
128-
case Some(sp: StepProofContext.SubProof) if sp.assumption == logika.th.normalizeExp(claim.left) => HashSet ++ sp.claims + sp.assumption
128+
case Some(sp: StepProofContext.SubProof) if logika.th.normalizeExp(sp.assumption) == logika.th.normalizeExp(claim.left) => HashSet ++ sp.claims + sp.assumption
129129
case _ =>
130130
reporter.error(subProofNo.posOpt, Logika.kind, s"Expecting a sub-proof step assuming the antecedent of step ${step.id}'s claim")
131131
return F
@@ -215,7 +215,7 @@ import org.sireum.logika.Logika.Reporter
215215
}
216216
val ISZ(subProofNo) = args
217217
val subProof: ISZ[AST.Exp] = spcMap.get(subProofNo) match {
218-
case Some(sp: StepProofContext.SubProof) if sp.assumption == logika.th.normalizeExp(claim.exp) => sp.claims
218+
case Some(sp: StepProofContext.SubProof) if logika.th.normalizeExp(sp.assumption) == logika.th.normalizeExp(claim.exp) => sp.claims
219219
case _ =>
220220
reporter.error(subProofNo.posOpt, Logika.kind, s"Expecting a sub-proof step assuming the operand of step ${step.id}'s claim")
221221
return err

0 commit comments

Comments
 (0)