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

Rewrite rules with non-linear patterns do not work in presence of Prop #3525

Closed
jespercockx opened this issue Jan 28, 2019 · 4 comments
Assignees
Milestone

Comments

@jespercockx
Copy link
Member

@jespercockx jespercockx commented Jan 28, 2019

Reported by Simon Boulier:

{-# OPTIONS --prop --rewriting #-}

open import Agda.Builtin.Nat
open import Agda.Builtin.Equality

{-# BUILTIN REWRITE _≡_ #-}

data _≐_ {ℓ} {A : Set ℓ} (x : A) : A → Prop ℓ where
  refl : x ≐ x

postulate
  subst :  {ℓ ℓ′} {A : Set ℓ} (P : A  Set ℓ′)
         (x y : A)  x ≐ y  P x  P y
  subst-rew :  {ℓ ℓ′} {A : Set ℓ} (P : A  Set ℓ′)
             {x : A} (e : x ≐ x) (p : P x)  subst P x x e p ≡ p
{-# REWRITE subst-rew #-}

data Box (A : Prop) : Set where
  box : A -> Box A

foo : (A : Prop)(x y : A)(P : Box A  Set)(p : P (box x))  subst P (box x) (box y) refl p ≐ p
foo A x y P p = refl -- refl does not type check

The problem is that the rewriting implementation uses untyped equality for checking the non-linear parts of patterns, which doesn't do the right thing in the presence of Prop's.

@jespercockx jespercockx self-assigned this Jan 28, 2019
@jespercockx jespercockx added this to the 2.6.1 milestone Feb 11, 2019
@jespercockx

This comment has been minimized.

Copy link
Member Author

@jespercockx jespercockx commented Feb 11, 2019

I'm working on a fix, but it won't be ready for 2.6.0 since it required a lot of refactoring of the conversion checker.

@jespercockx jespercockx referenced this issue Feb 25, 2019
3 of 3 tasks complete
jespercockx added a commit to jespercockx/agda that referenced this issue Mar 16, 2019
@jespercockx

This comment has been minimized.

Copy link
Member Author

@jespercockx jespercockx commented Mar 16, 2019

I finished my fix and pushed it to my fork of Agda (https://github.com/jespercockx/agda/tree/MonadConversion). However, the fix depends on #3589 which still needs some work, so the fix will have to wait a bit before it gets into master.

@SimonBoulier

This comment has been minimized.

Copy link

@SimonBoulier SimonBoulier commented Mar 18, 2019

Wow, great!
I will test it when I have a bit of time.

jespercockx added a commit to jespercockx/agda that referenced this issue Apr 18, 2019
jespercockx added a commit to jespercockx/agda that referenced this issue Apr 18, 2019
jespercockx added a commit to jespercockx/agda that referenced this issue Apr 18, 2019
@erydo erydo closed this in 70236aa May 7, 2019
@SimonBoulier

This comment has been minimized.

Copy link

@SimonBoulier SimonBoulier commented Jun 7, 2019

It works well, thank you :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.