Skip to content

Commit

Permalink
FixedPtr always TRUE + generalization (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kukovec authored Jan 23, 2023
1 parent 76d8735 commit a249bbf
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@ sealed trait ElemPtr {
* Translate the membership test into an expression that can be understood by Z3SolverContext.
*/
def toSmt: TlaEx

/**
* After certain set operations, every pointer must become a SmtExprElemPtr, because the operation invalidates the
* guarantees of e.g. FixedElemPtr.
*/
def generalize: SmtExprElemPtr = SmtExprElemPtr(elem, toSmt)
}

/**
* An element pointer that always evaluates to a fixed Boolean value. This pointer is used to encode that the element
* unconditionally belongs to a set. For example, when constructing the set `{ 1, 2, 3 }`.
* An element pointer that always evaluates to true. This pointer is used to encode that the element unconditionally
* belongs to a set. For example, when constructing the set `{ 1, 2, 3 }`.
*
* @param elem
* the element this pointer is pointing to.
* @param value
* the value (false or true).
*/
case class FixedElemPtr(elem: ArenaCell, value: Boolean) extends ElemPtr {
override def toSmt: TlaEx = {
tla.bool(value)
}
case class FixedElemPtr(elem: ArenaCell) extends ElemPtr {
override def toSmt: TlaEx = tla.bool(true)
}

/**
Expand All @@ -57,9 +59,8 @@ case class SmtConstElemPtr(elem: ArenaCell) extends ElemPtr {
*/
val uniqueName = s"_bool_elem$id"

override def toSmt: TlaEx = {
tla.name(uniqueName, BoolT1)
}
override def toSmt: TlaEx = tla.name(uniqueName, BoolT1)

}

/**
Expand Down

0 comments on commit a249bbf

Please sign in to comment.