1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/tests/positive/TypeAlias.juvix
janmasrovira 39a300eaa2
Support type aliases (#1404)
* add a simple positive test

* add lambda expressions to microjuvix language

* add basic normalization of type aliases

* fix test name

* normalize only functions on types

* normalize when matching

* fix type of inductive names

* improve detection of normalizing functions

* remove obsolete comment

* match constructor return type

* add test for issue 1333

* fix existing tests

* use lambda case

* add strong normalization

* Add test cases for type aliases and another fix

Co-authored-by: Jonathan Cubides <jonathan.cubides@uib.no>
2022-07-25 12:30:18 +02:00

41 lines
592 B
Plaintext

module TypeAlias;
inductive T {
t : T;
};
inductive T2 {
t2 : T2;
};
alias : Type;
alias ≔ T;
x : alias;
x ≔ t;
id : Type → Type;
id x ≔ x;
infixr 9 ⊙;
⊙ : (Type → Type) → (Type → Type) → Type → Type;
⊙ f g x ≔ f (g x);
x2 : (id ⊙ id) alias;
x2 ≔ t;
flip : (Type → Type → Type) → id Type → Type → (id ⊙ id) Type;
flip f a b ≔ f b a;
inductive Pair (A : Type) (B : Type) {
mkPair : id T → id (id A) → B → Pair A B;
};
p : {A : Type} → A → Pair A A;
p a ≔ mkPair t a a;
x' : flip Pair (id _) T2;
x' ≔ mkPair x t2 t;
end;