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

Internal error for rewriting without --confluence-check #5396

Closed
jespercockx opened this issue May 17, 2021 · 2 comments
Closed

Internal error for rewriting without --confluence-check #5396

jespercockx opened this issue May 17, 2021 · 2 comments
Assignees
Labels
internal-error Concerning internal errors of Agda rewriting Rewrite rules, rewrite rule matching type: bug Issues and pull requests about actual bugs
Milestone

Comments

@jespercockx
Copy link
Member

(This is a continuation of #3846)

Currently, when you use --rewriting without --confluence-check it is possible to get an internal error, e.g.

{-# OPTIONS --rewriting #-}

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

{-# BUILTIN REWRITE _≡_ #-}

not : Bool  Bool
not true = false
not false = true

postulate rew : Nat ≡ Bool
{-# REWRITE rew #-}

0' : Bool
0' = 0

test : not 0' ≡ true
test = refl

We should consider changing this so we get a proper error message when using --rewriting "unsafely".

@jespercockx jespercockx added type: bug Issues and pull requests about actual bugs rewriting Rewrite rules, rewrite rule matching internal-error Concerning internal errors of Agda labels May 17, 2021
@jespercockx jespercockx added this to the 2.6.3 milestone May 17, 2021
@jespercockx jespercockx self-assigned this May 17, 2021
@jespercockx
Copy link
Member Author

jespercockx commented Aug 26, 2021

The example I posted above no longer triggers an internal error, and does not actually exploit non-confluence. Here is a better example:

{-# OPTIONS --rewriting #-}

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

{-# BUILTIN REWRITE _≡_ #-}

not : Bool  Bool
not true = false
not false = true

data Unit : Set where
  unit : Unit

postulate
  X : Unit  Set
  X-Nat : X unit ≡ Nat
  X-Bool : (u : Unit)  X u ≡ Bool
{-# REWRITE X-Nat #-}

0' : (u : Unit)  X u
0' unit = 0

{-# REWRITE X-Bool #-}

test : (u : Unit)  not (0' u) ≡ true
test unit = refl

Error:

An internal error has occurred. Please report this as a bug.
Location of the error: __IMPOSSIBLE__, called at src/full/Agda/TypeChecking/Reduce/Fast.hs:1378:20 in Agda-2.6.3-5R57xsQ0HMBLt8bMbFjt5h:Agda.TypeChecking.Reduce.Fast

Error with --no-fast-reduce:

An internal error has occurred. Please report this as a bug.
Location of the error: __IMPOSSIBLE__, called at src/full/Agda/TypeChecking/CompiledClause/Match.hs:202:9 in Agda-2.6.3-5R57xsQ0HMBLt8bMbFjt5h:Agda.TypeChecking.CompiledClause.Match

jespercockx added a commit to jespercockx/agda that referenced this issue Aug 27, 2021
andreasabel pushed a commit that referenced this issue Nov 17, 2021
@andreasabel andreasabel modified the milestones: 2.6.3, 2.6.2.1 Nov 19, 2021
@andreasabel
Copy link
Member

Cherry-picked onto maint-2.6.2, scheduled for 2.6.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal-error Concerning internal errors of Agda rewriting Rewrite rules, rewrite rule matching type: bug Issues and pull requests about actual bugs
Projects
None yet
Development

No branches or pull requests

2 participants