Skip to content

Default value adt fixes#1384

Draft
lorchrob wants to merge 6 commits into
kind2-mc:developfrom
lorchrob:default-value-adt-fixes
Draft

Default value adt fixes#1384
lorchrob wants to merge 6 commits into
kind2-mc:developfrom
lorchrob:default-value-adt-fixes

Conversation

@lorchrob

Copy link
Copy Markdown
Contributor

Two bug fixes

First, a straightforward bug fix in default_value in lustreDesugarADTs.ml

Second ---
Say we have t = C(0), and t' = C(0), but t and t' have different junk fields. Say we have set s. When determining t in s or t' in s, clearly only the non-junk fields should be considered. But, our encoding is a mapping from all the fields to a boolean value. So, in my opinion, the cleanest thing to do is to canonicalize junk fields to a default value -- when compiling t in s for ADT expression t, we essentially compute s[t_tag][canonicalize(t_field0)][canonicalize(t_field1)]..., where canonicalize is just an ITE: if constructor_selected then t_fieldn else default_value. Then clearly, we have to also update set insertion analogously.
To be clear, what we were doing before this PR is s[t_tag][t_field0][t_field1]..., the same thing but without the canonicalize ITE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant