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

unification unsoundly discards context variables in substitutions #15110

Open
JasonGross opened this issue Nov 3, 2021 · 1 comment
Open
Labels
part: unification The unification mechanism.

Comments

@JasonGross
Copy link
Member

Consider x : nat |- ?e : nat and the pair of unification problems |- ?e@{x:=O} == ?e@{x:=S O} and x : nat |- ?e@{x:=x} == match x with O => O | S _ => O end. The only valid solution of this is ?e := match x with O => O | S _ => O end, which refers to x.
And in fact Coq fails to solve such a problem:

Check let e := (fun x => ?[e]) in
      eq_refl : (e O, e) = (e (S O), fun x => match x with O => O | S _ => O end).
(* Error:
In environment
e := fun _ : nat => ?e : nat -> nat
The term "eq_refl" has type "(e 0, e) = (e 0, e)" while it is expected to have type
 "(e 0, e) = (e 1, fun x : nat => match x with
                                  | 0 | _ => 0
                                  end)" (cannot instantiate "?e" because "x" is not in its scope).
*)

Originally posted by @JasonGross in coq/ceps#59 (comment)

@JasonGross JasonGross added the part: unification The unification mechanism. label Nov 3, 2021
@herbelin
Copy link
Member

herbelin commented Nov 3, 2021

You're right, only dependences in incompatible "neutral terms" could be discarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: unification The unification mechanism.
Projects
None yet
Development

No branches or pull requests

2 participants