-
Notifications
You must be signed in to change notification settings - Fork 52
Auto-including well-foundedness functions and axioms when they are used #710
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c667d67
Auto-including decreases functions and axioms when they are used
marcoeilers fb41857
Properly handling unknown types, empty decreases clauses
marcoeilers 273c8c5
Removed now invalid test, fixed issue of equal decreases expressions …
marcoeilers 8287778
Merge branch 'master' into meilers_decreases_autoimport
marcoeilers 4555edf
Merge branch 'master' into meilers_decreases_autoimport
marcoeilers f2fb201
Fix typo
marcoeilers d38b2a4
Emit warning if well-foundedness functions are constrained by incorre…
marcoeilers 91fc42e
Deprecating rational well founded order, adding perm replacement, ada…
marcoeilers 0e1f857
Merge branch 'master' into meilers_decreases_autoimport
marcoeilers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
src/main/scala/viper/silver/frontend/ViperPAstProvider.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| // | ||
| // Copyright (c) 2011-2021 ETH Zurich. | ||
|
|
||
| package viper.silver.frontend | ||
|
|
||
|
|
||
| import ch.qos.logback.classic.Logger | ||
| import viper.silver.ast.Program | ||
| import viper.silver.logger.ViperStdOutLogger | ||
| import viper.silver.plugin.SilverPluginManager | ||
| import viper.silver.reporter.{AstConstructionFailureMessage, AstConstructionSuccessMessage, Reporter} | ||
| import viper.silver.verifier.{Failure, Success, VerificationResult, Verifier} | ||
|
|
||
| import java.nio.file.Path | ||
|
|
||
|
|
||
| class ViperPAstProvider(override val reporter: Reporter, | ||
| override implicit val logger: Logger = ViperStdOutLogger("ViperPAstProvider", "INFO").get, | ||
| private val disablePlugins: Boolean = false) extends SilFrontend { | ||
|
|
||
| class Config(args: Seq[String]) extends SilFrontendConfig(args, "ViperPAstProviderConfig") { | ||
| verify() | ||
| } | ||
|
|
||
| class PAstProvidingVerifier(rep: Reporter) extends Verifier { | ||
| private var _config: Config = _ | ||
|
|
||
| def config: Config = _config | ||
|
|
||
| override def name = "Viper PAST Constructor" | ||
|
|
||
| override def version = "" | ||
|
|
||
| override def buildVersion = "" | ||
|
|
||
| override def copyright: String = "(c) Copyright ETH Zurich 2012 - 2023" | ||
|
|
||
| override def signature: String = name | ||
|
|
||
| override def debugInfo(info: Seq[(String, Any)]): Unit = {} | ||
|
|
||
| override def dependencies: Seq[Nothing] = Nil | ||
|
|
||
| override def start(): Unit = () | ||
|
|
||
| override def stop(): Unit = {} | ||
|
|
||
| override def verify(program: Program): VerificationResult = Success | ||
|
|
||
| override def parseCommandLine(args: Seq[String]): Unit = { | ||
| _config = new Config(args) | ||
| } | ||
|
|
||
| override def reporter: Reporter = rep | ||
| } | ||
|
|
||
| // All phases after sematic analysis omitted | ||
| override val phases: Seq[Phase] = Seq(Parsing, SemanticAnalysis) | ||
|
|
||
| override def result: VerificationResult = { | ||
|
|
||
| if (_errors.isEmpty) { | ||
| require(state >= DefaultStates.SemanticAnalysis) | ||
| Success | ||
| } | ||
| else { | ||
| Failure(_errors) | ||
| } | ||
| } | ||
|
|
||
| protected var instance: PAstProvidingVerifier = _ | ||
|
|
||
| override def createVerifier(fullCmd: String): Verifier = { | ||
| instance = new PAstProvidingVerifier(reporter) | ||
| instance | ||
| } | ||
|
|
||
| override def configureVerifier(args: Seq[String]): SilFrontendConfig = { | ||
| instance.parseCommandLine(args) | ||
| instance.config | ||
| } | ||
|
|
||
| override def reset(input: Path): Unit = { | ||
| super.reset(input) | ||
| if (_config != null) { | ||
| noPluginsManager = SilverPluginManager(None)(reporter, logger, _config, fp) | ||
| } | ||
| } | ||
|
|
||
| private var noPluginsManager = SilverPluginManager(None)(reporter, logger, _config, fp) | ||
| override def plugins: SilverPluginManager = { | ||
| if (disablePlugins) noPluginsManager | ||
| else { | ||
| super.plugins | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
src/test/resources/termination/errorMessages/notDefined.vpr
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/resources/termination/functions/basic/unconstrainedType.vpr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // Any copyright is dedicated to the Public Domain. | ||
| // http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
|
|
||
| domain Huh {} | ||
|
|
||
| function fac(i: Int, h: Huh): Int | ||
| requires i >= 0 | ||
| decreases h | ||
| { | ||
| //:: ExpectedOutput(termination.failed:tuple.false) | ||
| i == 0 ? 1 : i * fac(i - 1, h) | ||
| } |
1 change: 0 additions & 1 deletion
1
src/test/resources/termination/functions/existingExamples/McCarthys91Fnc.sil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/test/resources/termination/functions/expressions/forall.vpr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.