Debian Codegraph @

src/Reflection/AST/Meta.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Metavariables used in the reflection machinery
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Reflection.AST.Meta where
10
11 import Data.Nat.Properties as ℕ using (_≟_)
12 open import Function.Base using (_on_)
13 open import Relation.Nullary.Decidable.Core using (map′)
14 open import Relation.Binary.Core using (Rel)
15 open import Relation.Binary.Definitions using (Decidable; DecidableEquality)
16 import Relation.Binary.Construct.On as On using (decidable)
17 open import Relation.Binary.PropositionalEquality.Core using (_≡_; cong)
18
19 open import Agda.Builtin.Reflection public
20 using (Meta) renaming (primMetaToNat to toℕ; primMetaEquality to _≡ᵇ_)
21
22 open import Agda.Builtin.Reflection.Properties public
23 renaming (primMetaToNatInjective to toℕ-injective)
24
25 -- Equality of metas is decidable.
26
27 infix 4 _≈?_ _≟_ _≈_
28
29 _≈_ : Rel Meta _
30 _≈_ = _≡_ on toℕ
31
32 _≈?_ : Decidable _≈_
33 _≈?_ = On.decidable toℕ _≡_ ℕ._≟_
34
35 _≟_ : DecidableEquality Meta
36 m ≟ n = map′ (toℕ-injective _ _) (cong toℕ) (m ≈? n)