Skip to content

Commit

Permalink
Remove dynamic invariants (#223)
Browse files Browse the repository at this point in the history
This was used for `callsInPlace` verification but is no longer
necessary.
  • Loading branch information
jesyspa authored and Eric-Song-Nop committed Jul 30, 2024
1 parent d7eda23 commit 1effbea
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ class ProgramConverter(val session: FirSession, override val config: PluginConfi
addIfNotNull(it.type.uniquePredicateAccessInvariant()?.fillHole(it))
}
}
addAll(subSignature.params.flatMap { it.dynamicInvariants() })
addAll(returnVariable.pureInvariants())
addAll(returnVariable.provenInvariants())
addAll(returnVariable.allAccessInvariants())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ interface TypeEmbedding {
*/
fun pureInvariants(): List<TypeInvariantEmbedding> = emptyList()

/**
* Invariants that should correlate the old and new value of a value of this type
* over a function call. When a caller gives away permissions to the callee, these
* dynamic invariants give properties about the modifications of the argument as
* part of the functions post conditions.
* This is exclusively necessary for CallsInPlace.
*/
fun dynamicInvariants(): List<TypeInvariantEmbedding> = emptyList()

/**
* Get a nullable version of this type embedding.
*
Expand Down Expand Up @@ -158,6 +149,7 @@ data class NullableTypeEmbedding(val elementType: TypeEmbedding) : TypeEmbedding
}

override fun accessInvariants(): List<TypeInvariantEmbedding> = elementType.accessInvariants().map { IfNonNullInvariant(it) }
override fun pureInvariants(): List<TypeInvariantEmbedding> = elementType.pureInvariants().map { IfNonNullInvariant(it) }

// Note: this function will replace accessInvariants when nested unfold will be implemented
override fun sharedPredicateAccessInvariant(): TypeInvariantEmbedding? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ sealed interface VariableEmbedding : PureExpEmbedding, PropertyAccessEmbedding {

fun allAccessInvariants() = accessInvariants() + listOfNotNull(sharedPredicateAccessInvariant())

fun dynamicInvariants(): List<ExpEmbedding> = type.dynamicInvariants().fillHoles(this)

override val debugTreeView: TreeView
get() = NamedBranchingNode("Var", PlaintextLeaf(name.mangled))
}
Expand Down

0 comments on commit 1effbea

Please sign in to comment.