Skip to content

Commit

Permalink
Rewriting system.
Browse files Browse the repository at this point in the history
  • Loading branch information
robby-phd committed Mar 5, 2024
1 parent 5c73080 commit e964d7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jvm/src/test/scala/org/sireum/logika/example/list.sc
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ object List {

} else {

lookupUpdateEq(next, key, value) // either this or proof step #5 below

Deduce(
//@formatter:off
1 ( map Cons(p, next) ) by Auto,
Expand Down
8 changes: 8 additions & 0 deletions shared/src/main/scala/org/sireum/logika/RewritingSystem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ object RewritingSystem {
st"""Begin $title ${exp.prettyST} ..."""
}

@datatype class BeginST(val title: ST) extends Trace {
@strictpure def toST: ST =
st"""Begin $title"""
}

@datatype class Eval(val desc: ST,
val from: AST.CoreExp.Base,
val to: AST.CoreExp.Base) extends Trace {
Expand Down Expand Up @@ -2388,6 +2393,9 @@ object RewritingSystem {
for (i <- 0 until params.size) {
map = map + (params.size - i) ~> args(i)
}
if (shouldTrace) {
trace = trace :+ Trace.BeginST(st"function application ${f.prettyST}(${(for (arg <- ops.ISZOps(args).slice(0, if (args.size > params.size) params.size else args.size)) yield arg.prettyST, ", ")})")
}
evalBaseH(map, body) match {
case Some(body2) =>
if (args.size > params.size) {
Expand Down

0 comments on commit e964d7f

Please sign in to comment.