Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ new ] Added real higher-order matching to rewriting machinery
- Loading branch information
Jesper Cockx
committed
Apr 21, 2016
1 parent
bdd4dac
commit 1674387
Showing
8 changed files
with
89 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{-# OPTIONS --rewriting #-} | ||
|
||
open import Common.Nat | ||
open import Common.Equality | ||
|
||
postulate _↦_ : ∀ {a} {A : Set a} → A → A → Set | ||
|
||
{-# BUILTIN REWRITE _↦_ #-} | ||
|
||
postulate | ||
P : ∀ {a} {A : Set a} → A → Set | ||
|
||
postulate rew₁ : (f : Nat → Nat → Nat) → P (λ (x y z : Nat) → f z x) ↦ P f | ||
|
||
{-# REWRITE rew₁ #-} | ||
|
||
f : Nat → Nat → Nat → Nat | ||
f x _ z = x + z | ||
|
||
test : P f ≡ P (λ x z → z + x) | ||
test = refl | ||
|
||
postulate rew₂ : (f : Nat → Nat) → P (λ (x y : Nat) → f y) ↦ P f | ||
|
||
{-# REWRITE rew₂ #-} | ||
|
||
g : Nat → Nat → Nat | ||
g x y = y | ||
|
||
test₂ : P g ≡ P (λ (y : Nat) → y) | ||
test₂ = refl | ||
|
||
h : Nat → Nat → Nat → Nat | ||
h x y z = x | ||
|
||
test₃ : P h ≡ P (λ (z : Nat) → z) | ||
test₃ = refl |