Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually merge commits that for some reason did not make it here automatically #1

Merged
merged 54 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
38e7b04
collect debug information in Silicon
Sep 22, 2023
f99fe36
interaction - first commit
AndreaKe Nov 30, 2023
0689266
add versioned variables to parser
AndreaKe Dec 4, 2023
404cd7e
add id to DebugExp
AndreaKe Dec 7, 2023
2a46f97
add ast.LocalVarWithVersion
AndreaKe Dec 7, 2023
c16c5c1
add ast.DebugLabelledOld
AndreaKe Dec 10, 2023
37032c5
create verifier for debugging - first try
AndreaKe Dec 10, 2023
c68fa62
typecheck variables with version
AndreaKe Jan 2, 2024
6d58512
optimize debug workflow and printing
AndreaKe Jan 10, 2024
1ce563b
pass prover preamble assumptions to debugger
AndreaKe Jan 12, 2024
6bee2cc
optimize debug messages
AndreaKe Jan 12, 2024
2b0e496
cleanup
AndreaKe Jan 17, 2024
2cbf4fa
implement sourcePNodeInfo
AndreaKe Jan 20, 2024
3727cd8
extract custom silver behavior
AndreaKe Jan 26, 2024
045aa37
extract PType from SourcePInfo
AndreaKe Jan 27, 2024
ce5d60a
fixes
AndreaKe Jan 27, 2024
533e790
add enableDebug config flag
AndreaKe Jan 27, 2024
2a1d2da
cleanup
AndreaKe Mar 11, 2024
23f4185
fix debug labels
AndreaKe Mar 11, 2024
fb6e6b9
cleanup
AndreaKe Mar 11, 2024
c0fe8b4
fix error messages in debug mode
AndreaKe Mar 12, 2024
243d3bc
Using the right pair type, fixing package structure
marcoeilers Jun 17, 2024
7b64b7f
Merge, things compile again
marcoeilers Aug 16, 2024
efd9bd5
Fixed wand issue, better reporting of asserted term, extended debuggi…
marcoeilers Aug 16, 2024
5dc1a63
cleaned up }else
marcoeilers Aug 16, 2024
dce2c1b
Various small fixes
marcoeilers Aug 20, 2024
b4cbcd0
Fixing some expressions, better printing of chunks (WIP)
marcoeilers Aug 21, 2024
8234b70
Small fixes
marcoeilers Aug 22, 2024
e6814d0
Silver version
marcoeilers Aug 22, 2024
95c13f5
Passing None for debug expressions when debuggin is disabled
marcoeilers Aug 26, 2024
2151ff6
Adding last missing implementations
marcoeilers Aug 27, 2024
63d1716
Not collecting axioms and declarations unless necessary, and resettin…
marcoeilers Aug 27, 2024
7718479
Cleanup
marcoeilers Aug 27, 2024
77c7d5c
More cleanup
marcoeilers Aug 27, 2024
740ff9c
Removing test files
marcoeilers Aug 28, 2024
0b689de
Simplifying DebugExps early, limiting assumption printing in debugger…
marcoeilers Aug 28, 2024
b6c1e5b
Fixing quantified and implication assumptions, short circuit expressions
marcoeilers Aug 29, 2024
032990f
Several small fixes, avoiding performance problems when assumption tr…
marcoeilers Aug 30, 2024
ec5c49d
Better displaying of QP chunks, ARP constraints, branch conditions
marcoeilers Sep 1, 2024
779ecbb
Fixed incorrect parameter name
marcoeilers Sep 1, 2024
a4970db
Properly resetting preamble assumptions
marcoeilers Sep 1, 2024
9f20584
Merge pull request #863 from viperproject/meilers_debugger_optional_exps
marcoeilers Sep 1, 2024
625fd5f
Trying to fix Github issue
marcoeilers Sep 2, 2024
325fa63
Merge branch 'master' into meilers_debugger_optional_exps
marcoeilers Sep 2, 2024
43970c8
Merge pull request #864 from viperproject/meilers_debugger_optional_exps
marcoeilers Sep 2, 2024
39d9625
Update silver submodule
Sep 2, 2024
4fc123c
Fixed pretty-printing of quantified chunks
marcoeilers Sep 2, 2024
c56647a
Merge branch 'master' into meilers_debugging_qp_fix
marcoeilers Sep 2, 2024
e3a690b
Merge pull request #865 from viperproject/meilers_debugging_qp_fix
marcoeilers Sep 2, 2024
73058c2
Trying to fix silver build
marcoeilers Sep 3, 2024
23986cd
Merge
marcoeilers Sep 3, 2024
1e06ef8
Merge pull request #866 from viperproject/meilers_fix_git
marcoeilers Sep 3, 2024
d0690cb
Updates submodules
Dspil Sep 4, 2024
96892ed
Merge pull request #812 from viperproject/auto-update-submodules
Dspil Sep 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions annotation/Terms.example.scala
Original file line number Diff line number Diff line change
Expand Up @@ -842,49 +842,6 @@ object AtLeast extends /* OptimisingBinaryArithmeticOperation with */ ((Term, Te
}
}

/*
Helper class for permissions
*/

final class Rational(n: BigInt, d: BigInt) extends Ordered[Rational] {
require(d != 0, "Denominator of Rational must not be 0.")

private val g = n.gcd(d)
val numerator: BigInt = n / g * d.signum
val denominator: BigInt = d.abs / g

def +(that: Rational): Rational = {
val newNum = this.numerator * that.denominator + that.numerator * this.denominator
val newDen = this.denominator * that.denominator
Rational(newNum, newDen)
}
def -(that: Rational): Rational = this + (-that)
def unary_- = Rational(-numerator, denominator)
def abs = Rational(numerator.abs, denominator)
def signum = Rational(numerator.signum, 1)

def *(that: Rational): Rational = Rational(this.numerator * that.numerator, this.denominator * that.denominator)
def /(that: Rational): Rational = this * that.inverse
def inverse = Rational(denominator, numerator)

def compare(that: Rational) = (this.numerator * that.denominator - that.numerator * this.denominator).signum

override def equals(obj: Any) = obj match {
case that: Rational => this.numerator == that.numerator && this.denominator == that.denominator
case _ => false
}

override lazy val toString = s"$numerator/$denominator"
}

object Rational extends ((BigInt, BigInt) => Rational) {
val zero = Rational(0, 1)
val one = Rational(1, 1)

def apply(numer: BigInt, denom: BigInt) = new Rational(numer, denom)
def unapply(r: Rational) = Some(r.numerator, r.denominator)
}

/*
* Permissions
*/
Expand Down
6 changes: 6 additions & 0 deletions src/main/scala/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,12 @@ class Config(args: Seq[String]) extends SilFrontendConfig(args, "Silicon") {
noshort = true
)

val enableDebugging: ScallopOption[Boolean] = opt[Boolean]("enableDebugging",
descr = "Enable debugging mode",
default = Some(false),
noshort = true
)

/* Option validation (trailing file argument is validated by parent class) */

validateOpt(prover) {
Expand Down
74 changes: 65 additions & 9 deletions src/main/scala/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@

package viper.silicon

import scala.annotation.implicitNotFound
import scala.collection.immutable.ArraySeq
import viper.silicon.state.terms._
import viper.silicon.verifier.Verifier
import viper.silver
import viper.silver.ast.utility.Triggers.TriggerGenerationWithAddAndSubtract
import viper.silver.ast.utility.rewriter.Traverse
import viper.silver.ast.SourcePNodeInfo
import viper.silver.components.StatefulComponent
import viper.silver.verifier.{VerificationError, errors}
import viper.silver.parser.{PExp, PType, PUnknown, PUnnamedTypedDeclaration}
import viper.silver.verifier.errors.Internal
import viper.silver.verifier.reasons.{FeatureUnsupported, UnexpectedNode}
import viper.silver.ast.utility.rewriter.Traverse
import viper.silicon.state.terms.{Sort, Term, Var}
import viper.silicon.verifier.Verifier
import viper.silver.ast.utility.Triggers.TriggerGenerationWithAddAndSubtract
import viper.silver.verifier.{VerificationError, errors}

import scala.annotation.implicitNotFound
import scala.collection.immutable.ArraySeq

package object utils {
def freshSnap: (Sort, Verifier) => Var = (sort, v) => v.decider.fresh(sort)
def freshSnap: (Sort, Verifier) => Var = (sort, v) => v.decider.fresh(sort, Option.when(Verifier.config.enableDebugging())(PUnknown()))
def toSf(t: Term): (Sort, Verifier) => Term = (sort, _) => t.convert(sort)

def mapReduceLeft[E](it: Iterable[E], f: E => E, op: (E, E) => E, unit: E): E =
Expand Down Expand Up @@ -131,6 +134,59 @@ package object utils {
(e0: silver.ast.Exp, e1: silver.ast.Exp) => silver.ast.Or(e0, e1)(e0.pos, e0.info),
silver.ast.FalseLit()(emptyPos))

def removeKnownToBeTrueExp(exps: List[silver.ast.Exp], terms: List[Term]): List[silver.ast.Exp] = {
exps.zip(terms).filter(t => t._2 != True).map(e => e._1)
}

def simplifyVariableName(str: String) : String = {
str.substring(0, str.lastIndexOf("@"))
}

def replaceVarsInExp(e: silver.ast.Exp, varNames: Seq[String], replacements: Seq[silver.ast.Exp]): silver.ast.Exp = {
silver.utility.Sanitizer.replaceFreeVariablesInExpression(e, varNames.zip(replacements).toMap, Set())
}

def extractPTypeFromStmt(stmt: silver.ast.Stmt): PType = {
stmt.info.getUniqueInfo[SourcePNodeInfo] match {
case Some(info) =>
val sourceNode = info.sourcePNode
sourceNode match {
case decl: PUnnamedTypedDeclaration => decl.typ
case _ => PUnknown()
}
case _ => PUnknown()
}
}

def extractPTypeFromExp(exp: silver.ast.Exp): PType = {
exp.info.getUniqueInfo[SourcePNodeInfo] match {
case Some(info) =>
val sourceNode = info.sourcePNode
sourceNode match {
case e: PExp => e.typ
case d: PUnnamedTypedDeclaration => d.typ
case _ => PUnknown()
}
case _ => PUnknown()
}
}

def buildMinExp(exps: Seq[silver.ast.Exp], typ: silver.ast.Type): silver.ast.Exp = {
exps match {
case Seq(e) => e
case Seq(e0, e1) => silver.ast.DebugPermMin(e0, e1)(e0.pos, e0.info)
case exps if exps.length > 2 => silver.ast.DebugPermMin(exps.head, buildMinExp(exps.tail, typ))(exps.head.pos, exps.head.info)
}
}

def buildQuantExp(quantifier: Quantifier, vars: Seq[silver.ast.LocalVarDecl], eBody: silver.ast.Exp, eTrigger: Seq[silver.ast.Trigger]): silver.ast.Exp = {
quantifier match {
case Forall => silver.ast.Forall(vars, eTrigger, eBody)(eBody.pos, eBody.info, eBody.errT)
case Exists => silver.ast.Exists(vars, eTrigger, eBody)(eBody.pos, eBody.info, eBody.errT)
}
}


/** Note: be aware of Silver issue #95!*/
def rewriteRangeContains(program: silver.ast.Program): silver.ast.Program =
program.transform({
Expand Down Expand Up @@ -211,7 +267,7 @@ package object utils {
def toUnambiguousShortString(resource: silver.ast.Resource): String = {
resource match {
case l: silver.ast.Location => l.name
case m: silver.ast.MagicWand => m.toString()
case m: silver.ast.MagicWand => m.toString
case [email protected] => s"${silver.ast.MagicWandOp.op}@${sourceLineColumn(m)}"
}
}
Expand Down
Loading
Loading