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

Missing axiom(s) in the axiomatization of sets #292

Open
viper-admin opened this issue Dec 13, 2019 · 0 comments
Open

Missing axiom(s) in the axiomatization of sets #292

viper-admin opened this issue Dec 13, 2019 · 0 comments
Labels
bug Something isn't working major

Comments

@viper-admin
Copy link
Member

Created by bitbucket user OmerSakar on 2019-12-13 15:25

When reasoning about a set and its subset (using the subset operator), there seems to be an axiom missing that relates the size of the subset to the other set. See the example below.

function setComp(): Set[Int]
ensures forall x: Int :: (x >= 0 && x <= 5) <==> (x in result)

method main2() {
    var set1: Set[Int] 
    set1 := setComp()
    
    assert Set(0, 1, 2, 3) subset set1 
    assert |set1| >= 4 // fails
}

Here we have a function setComp, its result is a set of integers between 0 to 5 (inclusive). In the method main3, we have a set set1 and we assign the result of the function setComp to it.

Reasoning directly about the size of the set is difficult (for example assert |set1| == 6 will not assert on its own). Instead we would like to reason about a lowerbound of the size, given that we can assert that some set (with a known size) is the subset of set1 (e.g. Set(0, 1, 2, 3)).

In the example, we assert that Set(0, 1, 2, 3) is a subset of set1 (on line 7). The expectation is that it can then be asserted that the size of set1 is greater or equal to 4 (as in line 8). Unfortunately, the last assertion fails.

After inspecting the set axioms Viper uses, I see that an axiom is missing which relates the size of the set and the subset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant