Created
July 30, 2020 00:32
-
-
Save SeverTopan/4ae6e8c3fafa8f2d327b38d3ab1f529d to your computer and use it in GitHub Desktop.
Is it possible to construct cyclic types in Agda?
This file contains hidden or 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
data A : Set | |
data B : Set where | |
b : A → B | |
data A where | |
a : B → A | |
record A′ : Set
record B′ : Set
record A′ where
coinductive
constructor mka
field geta : B′
open A′ public
record B′ where
coinductive
constructor mkb
field getb : A′
open B′ public
a′ : A′
b′ : B′
a′ .geta = b′
b′ .getb = a′
and alternative property
data A : Set
data B : Set where
b : A → B
data A where
a : B → A
data ⊥ : Set where
¬a : A → ⊥
¬b : B → ⊥
¬a (a y) = ¬b y
¬b (b x) = ¬a x
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems as though this should be possible if you could somehow construct both A and B at the same time, and have them refer to one another, but I'm not sure if you can do this in Agda.