Skip to content

Unexpected behaviour for well-definedness during exhale #406

@gauravpartha

Description

@gauravpartha

Carbon's well-definedness encoding for an exhale is currently independent from the actual encoding of the actual exhale itself. In particular, the well-definedness encoding does not take side-effects performed during the exhale into account. This has two consequences:

Issue 1: Unexpected error reporting

exhale acc(x.f) && 0/0 == 0

The above code fragment reports a division by 0 well-definedness error in a state with no permission. Since the first conjunct cannot be exhaled one might rather expect an error message saying that acc(x.f) cannot be exhaled (which is what Silicon does)

Issue 2: Potential unsoundness in the presence of permission introspection

inhale acc(x.f)
exhale acc(x.f) && (perm(x.f) == none ==> 0/0 = 0/0)

verifies in Carbon. Currently, Viper's permission introspection during an exhale takes side-effects before the evaluation of the permission introspection into account. That is, perm(x.f) in the exhale should evaluate to none, which means there is a division by 0 well-definedness error (which is also what Silicon reports).

Carbon's encoding of permission introspection in the actual exhale part does take side-effects into account, but the well-definedness check does not. In particular, if one replaces 0/0 by 1 in the example above, then Carbon complains that 0/0 might not be equal to 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions