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

[TC] Check for existence of typeclass instance on instantiation of a constrained type variable or abstract type #527

Open
fdupress opened this issue Mar 30, 2024 · 1 comment
Assignees

Comments

@fdupress
Copy link
Member

No description provided.

@fdupress
Copy link
Member Author

The following snippet shows two questionable successes. Both rely on the clone lifting an assumption about an abstract type to the concrete type it is instantiated with, instead of having that assumption checked.

It also shows a non-questionable success. Non-questionable in the sense that there is no world in which it should be a success. (It also means that the scope of the missing constraint check is well beyond clones and I need to rename this issue.)

op p : 'a -> bool.

type class tc = {
  axiom pP : forall (x : tc), p x
}.

theory VeryBad.
theory T.

type t <: tc.

lemma urk : p witness<:t>.
proof. exact: pP. qed.

end T.

type t2.

clone import T as T' with type t <- t2.

lemma urker : p witness<:t2>.
proof. apply: urk. qed.
end VeryBad.

theory AlsoBad.
theory T.

type t <: tc.
end T.

lemma urk ['a <: tc] : p witness<:'a>.
proof. exact: pP. qed.

type t2.
clone T as T' with type t <- t2.

lemma urker : p witness<:t2>.
proof. by apply: urk<:t2>. qed.
end AlsoBad.

theory VeryVeryBad.
type t.

lemma urkest: p witness<:t>.
proof. by apply (pP<:t> witness). qed.
end VeryVeryBad.

@fdupress fdupress changed the title [TC] Check for existence of typeclass instance on cloning-based instantiation of a constrained type [TC] Check for existence of typeclass instance on instantiation of a constrained type variable or abstract type Mar 30, 2024
@strub strub self-assigned this Apr 5, 2024
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

No branches or pull requests

2 participants