Skip to content

Commit

Permalink
Revert changes to add asserting/assuming expressions. This is now imp…
Browse files Browse the repository at this point in the history
…lemented in #1277.
  • Loading branch information
bobismijnnaam committed Dec 10, 2024
1 parent d722c64 commit 7ba053f
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 366 deletions.
6 changes: 0 additions & 6 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,3 @@
# Date: Tue May 28 19:06:33 2024 +0200
# reformat scala sources
7a81a51d7791bc2e407fcfc6aef24bc1d1a52850

# Bob Rubbens: wanted to merge some stuff in after reformatting
fecd37bf5922332cc449f0ef95f79b09f370aa8e

# (I think the same happened to Philip Tasche)
97fb61d23cf04a909145ecb28946d1297d947ef4
8 changes: 0 additions & 8 deletions src/col/vct/col/ast/Node.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2175,14 +2175,6 @@ final case class ActionPerm[G](loc: Expr[G], perm: Expr[G])(
implicit val o: Origin
) extends Expr[G] with ActionPermImpl[G]

final case class Assuming[G](assn: Expr[G], inner: Expr[G])(
implicit val o: Origin
) extends Expr[G] with AssumingImpl[G]
final case class Asserting[G](assn: Expr[G], inner: Expr[G])(
val blame: Blame[AssertFailed]
)(implicit val o: Origin)
extends Expr[G] with AssertingImpl[G]

sealed trait SmtlibType[G] extends Type[G]
case class TSmtlibArray[G](index: Seq[Type[G]], value: Type[G])(
implicit val o: Origin = DiagnosticOrigin
Expand Down
11 changes: 0 additions & 11 deletions src/col/vct/col/ast/unsorted/AssertingImpl.scala

This file was deleted.

11 changes: 0 additions & 11 deletions src/col/vct/col/ast/unsorted/AssumingImpl.scala

This file was deleted.

7 changes: 1 addition & 6 deletions src/col/vct/col/origin/Blame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ case class CopyClassFailedBeforeCall(
s"Insufficient permission for call `$source`."
}

// Type of `node` here is `Node`, but only to easily allow using this failure for both
// assert statements and assert expressions.
case class AssertFailed(failure: ContractFailure, node: Node[_])
case class AssertFailed(failure: ContractFailure, node: Assert[_])
extends WithContractFailure {
override def baseCode: String = "assertFailed"
override def descInContext: String = "Assertion may not hold, since"
Expand Down Expand Up @@ -1527,9 +1525,6 @@ object NonNullPointerNull
object UnsafeDontCare {
case class Satisfiability(reason: String)
extends UnsafeDontCare[NontrivialUnsatisfiable]
case class Contract(reason: String) extends UnsafeDontCare[ContractedFailure]
case class Invocation(reason: String)
extends UnsafeDontCare[InvocationFailure]
}

trait UnsafeDontCare[T <: VerificationFailure]
Expand Down
2 changes: 0 additions & 2 deletions src/col/vct/col/typerules/CoercingRewriter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2144,8 +2144,6 @@ abstract class CoercingRewriter[Pre <: Generation]()
case PVLEndpointExpr(endpoint, expr) => e
case EndpointExpr(ref, expr) => e
case ChorExpr(expr) => ChorExpr(bool(expr))
case e @ Asserting(assn, inner) => Asserting(bool(assn), inner)(e.blame)
case Assuming(assn, inner) => Assuming(bool(assn), inner)
case CtExpr(inner) => e
case EndpointFamilyExpr(ref) => e
}
Expand Down
2 changes: 1 addition & 1 deletion src/hre/hre/io/ChecksumReadableFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ case class ChecksumReadableFile(
checksumKind: String,
) extends InMemoryCachedReadable {
override def underlyingPath: Option[Path] = Some(file)
override def fileName: String = file.getFileName.toString
override def fileName: String = file.toString
override def isRereadable: Boolean = true
private var checksumCache: Option[String] = None

Expand Down
2 changes: 1 addition & 1 deletion src/hre/hre/io/RWFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.nio.file.{Files, Path}
case class RWFile(file: Path, doWatch: Boolean = true)
extends InMemoryCachedReadable with Writeable {
override def underlyingPath: Option[Path] = Some(file)
override def fileName: String = file.getFileName.toString
override def fileName: String = file.toString
override def isRereadable: Boolean = true

override protected def getWriter: Writer = {
Expand Down
7 changes: 3 additions & 4 deletions src/main/vct/main/stages/Transformation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ object Transformation extends LazyLogging {
Of course, this all while still retaining the functionality of making it possible to pass more simplification rules
using command line flags.
*/
Progress.hiddenStage(s"Loading PVL library file ${readable.fileName}") {
Util.loadPVLLibraryFile(readable, debugOptions)
}
Progress.hiddenStage(
s"Loading PVL library file ${readable.underlyingPath.getOrElse("<unknown>")}"
) { Util.loadPVLLibraryFile(readable, debugOptions) }
}

def simplifierFor(path: PathOrStd, options: Options): RewriterBuilder =
Expand Down Expand Up @@ -418,7 +418,6 @@ case class SilverTransformation(
RefuteToInvertedAssert,
ExplicitResourceValues,
EncodeResourceValues,
EncodeAssertingAssuming,

// Encode parallel blocks
EncodeSendRecv,
Expand Down
2 changes: 1 addition & 1 deletion src/main/vct/options/types/PathOrStd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sealed trait PathOrStd extends InMemoryCachedReadable with Writeable {

override def fileName: String =
this match {
case PathOrStd.Path(path) => path.getFileName.toString
case PathOrStd.Path(path) => path.toString
case PathOrStd.StdInOrOut => "<stdio>"
}

Expand Down
2 changes: 0 additions & 2 deletions src/parsers/antlr4/LangPVLLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ UNFOLDING_ESC: '\\unfolding';
UNFOLDING: 'unfolding';
IN_ESC: '\\in';
IN: 'in';
ASSERTING: 'asserting';
ASSUMING: 'assuming';
NEW: 'new';
ID: 'id';

Expand Down
4 changes: 0 additions & 4 deletions src/parsers/antlr4/LangPVLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ unit
| '(' '\\' '[' identifier ']' expr ')' # pvlShortEndpointExpr
| '(' '\\chor' expr ')' # pvlLongChorExpr
| '(' '\\' '[' ']' expr ')' # pvlShortChorExpr
| '(' 'asserting' expr ')' # pvlBoolAsserting
| '(' 'asserting' expr ';' expr ')' # pvlAsserting
| '(' 'assuming' expr ')' # pvlBoolAssuming
| '(' 'assuming' expr ';' expr ')' # pvlAssuming
| 'this' # pvlThis
| 'null' # pvlNull
| '\\sender' # pvlSender
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/antlr4/SpecLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ CHOOSE: '\\choose';
CHOOSE_FRESH: '\\choose_fresh';
LENGTH: '\\length';
OLD: '\\old';
ASSERT_EXPR: '\\asserting';
ASSUME_EXPR: '\\assuming';
TYPEOF: '\\typeof';
TYPEVALUE: '\\type';
MATRIX: '\\matrix';
Expand Down
4 changes: 0 additions & 4 deletions src/parsers/antlr4/SpecParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ valPrimary
| '\\is_int' '(' langExpr ')' # valIsInt
| '\\choose' '(' langExpr ')' # valChoose
| '\\choose_fresh' '(' langExpr ')' # valChooseFresh
| '(' '\\assuming' langExpr ')' # valBoolAssuming
| '(' '\\assuming' langExpr ';' langExpr ')' # valAssuming
| '(' '\\asserting' langExpr ')' # valBoolAsserting
| '(' '\\asserting' langExpr ';' langExpr ')' # valAsserting
;

// Out spec: defined meaning: a language local
Expand Down
7 changes: 0 additions & 7 deletions src/parsers/vct/parsers/transform/CToCol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2002,13 +2002,6 @@ case class CToCol[G](
case ValIsInt(_, _, arg, _) => SmtlibIsInt(convert(arg))
case ValChoose(_, _, xs, _) => Choose(convert(xs))(blame(e))
case ValChooseFresh(_, _, xs, _) => ChooseFresh(convert(xs))(blame(e))
case ValBoolAssuming(_, _, assn, _) => Assuming(convert(assn), tt)
case ValAssuming(_, _, assn, _, inner, _) =>
Assuming(convert(assn), convert(inner))
case ValBoolAsserting(_, _, assn, _) =>
Asserting(convert(assn), tt)(blame(e))
case ValAsserting(_, _, assn, _, inner, _) =>
Asserting(convert(assn), convert(inner))(blame(e))
}

def convert(implicit e: ValExprPairContext): (Expr[G], Expr[G]) =
Expand Down
7 changes: 0 additions & 7 deletions src/parsers/vct/parsers/transform/JavaToCol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2532,13 +2532,6 @@ case class JavaToCol[G](
case ValNdLength(_, _, dims, _) => NdLength(convert(dims))
case ValChoose(_, _, xs, _) => Choose(convert(xs))(blame(e))
case ValChooseFresh(_, _, xs, _) => ChooseFresh(convert(xs))(blame(e))
case ValBoolAssuming(_, _, assn, _) => Assuming(convert(assn), tt)
case ValAssuming(_, _, assn, _, inner, _) =>
Assuming(convert(assn), convert(inner))
case ValBoolAsserting(_, _, assn, _) =>
Asserting(convert(assn), tt)(blame(e))
case ValAsserting(_, _, assn, _, inner, _) =>
Asserting(convert(assn), convert(inner))(blame(e))
}

def convert(implicit e: ValExprPairContext): (Expr[G], Expr[G]) =
Expand Down
14 changes: 0 additions & 14 deletions src/parsers/vct/parsers/transform/PVLToCol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,6 @@ case class PVLToCol[G](
)
case PvlLongChorExpr(_, _, inner, _) => ChorExpr(convert(inner))
case PvlShortChorExpr(_, _, _, _, inner, _) => ChorExpr(convert(inner))
case PvlBoolAsserting(_, _, assn, _) =>
Asserting(convert(assn), tt)(blame(expr))
case PvlAsserting(_, _, assn, _, inner, _) =>
Asserting(convert(assn), convert(inner))(blame(expr))
case PvlBoolAssuming(_, _, assn, _) => Assuming(convert(assn), tt)
case PvlAssuming(_, _, assn, _, inner, _) =>
Assuming(convert(assn), convert(inner))
case PvlSender(_) => PVLSender()
case PvlReceiver(_) => PVLReceiver()
case PvlMessage(_) => PVLMessage()
Expand Down Expand Up @@ -1993,13 +1986,6 @@ case class PVLToCol[G](
case ValNdLength(_, _, dims, _) => NdLength(convert(dims))
case ValChoose(_, _, xs, _) => Choose(convert(xs))(blame(e))
case ValChooseFresh(_, _, xs, _) => ChooseFresh(convert(xs))(blame(e))
case ValBoolAssuming(_, _, assn, _) => Assuming(convert(assn), tt)
case ValAssuming(_, _, assn, _, inner, _) =>
Assuming(convert(assn), convert(inner))
case ValBoolAsserting(_, _, assn, _) =>
Asserting(convert(assn), tt)(blame(e))
case ValAsserting(_, _, assn, _, inner, _) =>
Asserting(convert(assn), convert(inner))(blame(e))
}

def convert(implicit e: ValExprPairContext): (Expr[G], Expr[G]) =
Expand Down
106 changes: 0 additions & 106 deletions src/rewrite/vct/rewrite/EncodeAssertingAssuming.scala

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7ba053f

Please sign in to comment.