-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
t/code/error/confusing-identifier-overloading-comp-meta-levels.bel
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,16 @@ | ||
LF tm : type = ; | ||
|
||
schema ctx = tm; | ||
|
||
inductive Ex : ctype = ; | ||
|
||
%{ | ||
In Beluga v1, it was possible to overload identifiers appearing in the | ||
meta-level and the computation-level. | ||
|
||
This is not supported in Beluga v1.1. The numbers in comment below the | ||
expression are labels indicating how variable names were being resolved in v1. | ||
}% | ||
rec f : {g : ctx} → [g ⊢ tm] → Ex → Ex = | ||
mlam g ⇒ fn g ⇒ fn x ⇒ let [_ ⊢ x] = g in f [g] [g ⊢ x] x; | ||
% 1 2 3 4 2 1 1 4 3 |
10 changes: 10 additions & 0 deletions
10
t/code/error/confusing-identifier-overloading-comp-meta-levels.bel.out
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,10 @@ | ||
File "./t/code/error/confusing-identifier-overloading-comp-meta-levels.bel", | ||
line 15, column 48: | ||
15 | mlam g ⇒ fn g ⇒ fn x ⇒ let [_ ⊢ x] = g in f [g] [g ⊢ x] x; | ||
^ | ||
Error: Expected a context variable. | ||
File "./t/code/error/confusing-identifier-overloading-comp-meta-levels.bel", | ||
line 15, column 15: | ||
15 | mlam g ⇒ fn g ⇒ fn x ⇒ let [_ ⊢ x] = g in f [g] [g ⊢ x] x; | ||
^ | ||
Error: g is a bound computation variable. |
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,11 @@ | ||
exp : type. | ||
|
||
eq : exp → exp → type. | ||
|
||
schema ctx = block (x : exp, t : eq x x); | ||
|
||
%{ | ||
The substitution `(eq M M)[..]` is not in normal form. | ||
We expect `eq M[..] M[..]`. | ||
}% | ||
rec reflexivity : {g : ctx} {M : [g ⊢ exp]} [g ⊢ (eq M M)[..]] = ?; |
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,4 @@ | ||
File "./t/code/error/substitution-on-non-normal-term.bel", line 11, column 50: | ||
11 |rec reflexivity : {g : ctx} {M : [g ⊢ exp]} [g ⊢ (eq M M)[..]] = ?; | ||
^^^^^^^^^^^^ | ||
Error: Substitution terms may not appear as contextual LF types. |
41 changes: 41 additions & 0 deletions
41
t/code/success/modules/user-defined-notations-in-modules.bel
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,41 @@ | ||
module Term = struct | ||
LF term : type = | ||
| lam : (term → term) → term | ||
| app : term → term → term | ||
| unit : term; | ||
|
||
--name term M. | ||
end | ||
|
||
module Algorithmic_equality = struct | ||
--open Term. | ||
|
||
% This notation pragma is local to module `Algorithmic_equality` | ||
--infix ≡ none. | ||
|
||
LF ≡ : term → term → type = | ||
| lam : ({x : term} → x ≡ x → M x ≡ N x) → Term.lam M ≡ Term.lam N | ||
| app : M1 ≡ N1 → M2 ≡ N2 → Term.app M1 M2 ≡ Term.app N1 N2 | ||
| unit : Term.unit ≡ Term.unit; | ||
end | ||
|
||
--open Term. | ||
--open Algorithmic_equality. % This brings back the infix notation for `≡` | ||
|
||
schema ctx = block (x : term, eq : x ≡ x); | ||
|
||
rec aeq_reflexivity : (g : ctx) → {M : [g ⊢ term]} → [g ⊢ M ≡ M] = | ||
/ total d (aeq_reflexivity _ d) / | ||
mlam M ⇒ | ||
case [_ ⊢ M] of | ||
| [g ⊢ #p.x] ⇒ [g ⊢ #p.eq] | ||
| [g ⊢ Term.lam \x. F] ⇒ | ||
let [g, b : block (x : term, eq : x ≡ x) ⊢ D] = | ||
aeq_reflexivity [g, b : block (x : term, eq : x ≡ x) ⊢ F[.., b.x]] | ||
in | ||
[g ⊢ Algorithmic_equality.lam \x. \eq. D[.., <x; eq>]] | ||
| [g ⊢ Term.app M1 M2] ⇒ | ||
let [g ⊢ D1] = aeq_reflexivity [g ⊢ M1] in | ||
let [g ⊢ D2] = aeq_reflexivity [g ⊢ M2] in | ||
[g ⊢ Algorithmic_equality.app D1 D2] | ||
| [g ⊢ Term.unit] ⇒ [g ⊢ Algorithmic_equality.unit]; |