-
Notifications
You must be signed in to change notification settings - Fork 339
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 when using REWRITE
in private
block
#5470
Comments
Aha - got a MWE! Looks like it has to do with defining -- Bar.agda
{-# OPTIONS --prop --without-K --rewriting #-}
module Bar where
open import Data.Nat
open import Data.Nat.Properties
open import Relation.Binary.PropositionalEquality
open import Agda.Builtin.Equality.Rewrite
private
foo : ℕ → ℕ
foo zero = zero
foo (suc n) = suc (foo n + zero)
bar : ℕ → ℕ
bar n = foo n
private
lemma : ∀ n → foo n ≡ n
lemma zero = refl
lemma (suc n) = cong suc (trans (+-identityʳ (foo n)) (lemma n))
{-# REWRITE lemma #-} -- Example.agda
{-# OPTIONS --prop --rewriting #-}
module Example where
open import Data.Nat
open import Data.Nat.Properties
open import Bar
open import Data.List
example : ∀ l → 0 ≤ bar (length l)
example l =
let open ≤-Reasoning in
begin
{! !}
≡⟨ {! !} ⟩
{! !}
∎
|
(Possible that #5451 is related.) |
REWRITE
in private
block
Thanks for the small example. {-# OPTIONS --rewriting #-}
module Issue5470Import where
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
open import Agda.Builtin.Equality.Rewrite
private
postulate
foo : Nat → Nat
bar : Nat → Nat
bar n = foo n
private
postulate
lemma : ∀ n → foo n ≡ n
{-# REWRITE lemma #-}
{-# OPTIONS --rewriting #-}
{-# OPTIONS -v impossible:10 #-}
module Issue5470 where
open import Agda.Builtin.Nat
open import Agda.Builtin.Equality
open import Issue5470Import
postulate
_≤_ : (n m : Nat) → Set
≤-refl : ∀{n} → n ≤ n
infix 4 _IsRelatedTo_
data _IsRelatedTo_ (x : Nat) : (y : Nat) → Set where
equals : x IsRelatedTo x
begin : ∀ {x y} → x IsRelatedTo y → x ≤ y
begin equals = ≤-refl
example : ∀ n → 0 ≤ bar n
example n = begin equals
-- Unbound name: Issue5470Import.lemma[0,10]@ModuleNameHash 8608063155492000951 That's what I call a MWE! ;-) |
The problem is that agda/src/full/Agda/TypeChecking/Monad/Signature.hs Lines 1100 to 1106 in ef433be
I wonder whether this is the golden way to instantiate a rewrite rule, given that rewrite rules live in their own structure in the interface. Maybe the desired information should be added to this record so that rewrite rules remain independent from the signature, @jespercockx ? agda/src/full/Agda/TypeChecking/Monad/Base.hs Lines 1709 to 1718 in ef433be
|
|
For a Setting I am trying out a simple fix of |
After moving a local
module Foo
to a new fileData/Nat/Foo.agda
, I encountered the following error message:The new file typechecks on its own, but when I add
open import Data.Nat.Foo
to my existing file, the given error is produced.(I'm using
--rewriting
in both files - not sure if that's relevant.)The text was updated successfully, but these errors were encountered: