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

Conversion incompleteness with Definitional UIP #18865

Open
yannl35133 opened this issue Mar 29, 2024 · 2 comments · May be fixed by #18884
Open

Conversion incompleteness with Definitional UIP #18865

yannl35133 opened this issue Mar 29, 2024 · 2 comments · May be fixed by #18884
Labels
kind: bug An error, flaw, fault or unintended behaviour.

Comments

@yannl35133
Copy link
Contributor

Description of the problem

For a term t, Check @eq_refl _ t. gives tt = tt but Check @eq_refl _ t : tt = tt fails.

The root cause (for which I reverse engineered an example) is that CClosure.conv cannot access the qmap to normalize qvars during its conversions, yet such unification qvars may appear.
The issue also arises when I try to implement non-linear rewrite rules using the same function for testing conversion.

Small Coq file to reproduce the bug

#[universes(polymorphic)]
Inductive sig@{s s' s''|u v| } {A:Type@{s|u}} (P:A -> Type@{s'|v}) : Type@{s''|max(u,v)} :=
    exist : forall x:A, P x -> sig P.

Notation "{ x : A & P }" := (sig (A:=A) (fun x => P)) (at level 0, x at level 99) : type_scope.

#[universes(polymorphic)]
Definition proj1_sig@{s s'|u v| } {A:Type@{s|u}} {P:A -> Type@{s'|v}} (e:sig@{_ _ s|_ _} P) :=
  match e with
  | exist _ a b => a
  end.

Notation "x .1" := (proj1_sig x) (at level 1, left associativity, format "x .1").

Definition projT1_eq {A} {P : A -> Type} {u v : { a : A & P a }} (p : u = v) : u.1 = v.1
  := match p with eq_refl => eq_refl end.

Context {A} {P : A -> Type} {u : { a : A & P a }} (b : P u.1).

Set Definitional UIP.

Inductive SEq (A : Type) (a : A) : forall (B : Type), B -> SProp := Seq_refl : SEq A a A a.

Check
@eq_refl _
  ((fun (A : Type) (a : A) (B: Type) (b : B) (e : SEq A a B b) =>
  match e with Seq_refl _ _ => tt end) _ (P u.1) _ (P u.1)
  ((fun x : SEq _ (P u.1) _ (P u.1) => x) (Seq_refl _ _))).

Check @eq_refl _
  ((fun (A : Type) (a : A) (B: Type) (b : B) (e : SEq A a B b) =>
  match e with Seq_refl _ _ => tt end) _ (P u.1) _ (P u.1)
  ((fun x : SEq _ (P u.1) _ (P u.1) => x) (Seq_refl _ _)))
  : tt = tt.

Version of Coq where this bug occurs

8.19.1, master (fc1b697e47)

Last version of Coq where the bug did not occur

No response

@yannl35133 yannl35133 added kind: bug An error, flaw, fault or unintended behaviour. needs: triage The validity of this issue needs to be checked, or the issue itself updated. labels Mar 29, 2024
@ppedrot
Copy link
Member

ppedrot commented Apr 1, 2024

Definitional UIP is already incomplete due to non-termination, do we care about this one?

@SkySkimmer
Copy link
Contributor

I guess Yann cares because of

The issue also arises when I try to implement non-linear rewrite rules using the same function for testing conversion.

@yannl35133 yannl35133 linked a pull request Apr 2, 2024 that will close this issue
1 task
@SkySkimmer SkySkimmer removed the needs: triage The validity of this issue needs to be checked, or the issue itself updated. label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug An error, flaw, fault or unintended behaviour.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants