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

When needed, add type parameters and variant check to field access #1411

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

Chris-Hawblitzel
Copy link
Collaborator

(fixes #1366 )

As proposed in #1366 , this adds type parameters and an is-variant check to field accessors when the datatype has type parameters and has at least two variants. For example, for Option<V>, we used to just have:

(declare-fun core!option.Option./Some/0 (core!option.Option.) Poly)

(axiom (forall ((x core!option.Option.)) (!
   (= (core!option.Option./Some/0 x) (core!option.Option./Some/?0 x))
   :pattern ((core!option.Option./Some/0 x))
   :qid internal_core!option.Option./Some/0_accessor_definition
   :skolemid skolem_internal_core!option.Option./Some/0_accessor_definition
)))

With the pull request, we now have:

(declare-fun core!option.Option./Some/0 (Dcr Type core!option.Option.) Poly)

(axiom (forall ((V&. Dcr) (V& Type) (x core!option.Option.)) (!
   (=>
    (is-core!option.Option./Some x)
    (= (core!option.Option./Some/0 V&. V& x) (core!option.Option./Some/?0 x))
   )
   :pattern ((core!option.Option./Some/0 V&. V& x))
   :qid internal_core!option.Option./Some/0_accessor_definition
   :skolemid skolem_internal_core!option.Option./Some/0_accessor_definition
)))

I don't have any tests to add for this, because I don't yet know of any way to actually trigger the unsoundness reported in #1366 .

I checked veritas, and all tests pass with one rlimit needing an increase in ironsht.

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@Chris-Hawblitzel Chris-Hawblitzel merged commit 514f227 into main Jan 31, 2025
11 checks passed
@Chris-Hawblitzel Chris-Hawblitzel deleted the field-access branch January 31, 2025 18:53
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.

Unsoundness with Datatype Axioms
2 participants