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

ADT is facing some canonicalization issue during module instantiation #248

Open
adwait opened this issue May 11, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@adwait
Copy link
Contributor

adwait commented May 11, 2024

The following code (using SMTLIB2Interface):

module main {

    datatype t = B(f: t) | A();

    var a : t;

    init {
        havoc a;

        if (is_A(a)) { } else {
            if (is_B(a)) { } 
            else {
                assert (false);
            }
        }
    }

    next {
        havoc a;

        if (is_A(a)) { } else {
            if (is_B(a) && is_A(a.f)) { } 
            else {
                assert (false);
            }
        }
    }

    control {
        v = induction;
        print_module;
        check;
        print_results;
        v.print_cex ();
    }
}

results in an instantiated module with the following lang.DataType:

 type t = t = | (B,List((_rec_f,t = | (B,List((_rec_f,t))) | (A,List())))) | (A,List()); // test.ucl

Rather, it should have been:

 type t = t = | (B,List((_rec_f,t = (self) t))) | (A,List()); // test.ucl

using the SelfReference type at the second level (instead of the third).

This is even before lang-to-SMT conversion. It breaks downstream fixes (#243,#247) in generateDatatype as the ADT leads to two SMT declare-datatype commands.

@adwait adwait added the bug Something isn't working label May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants