Created
December 11, 2017 00:04
-
-
Save jcreedcmu/576e0e42ecdd5d4a2526c39ce307a3ca to your computer and use it in GitHub Desktop.
Internalized parametricity
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
| {-# OPTIONS --without-K --rewriting #-} | |
| module Sharp where | |
| open import HoTT hiding ( O; Path; _*_ ) | |
| module WithArity (C : Set) where | |
| postulate | |
| π : Set | |
| Ξ· : C β π | |
| Path : β {β} (A : π β Set β) (a : (c : C) β A (Ξ· c)) β Set β | |
| _*_ : β {β} {A : π β Set β} {a : (c : C) β A (Ξ· c)} | |
| β Path A a β (i : π) β A i | |
| lam : β {β} {A : π β Set β} (f : (i : π) β A i) | |
| β Path A (f β Ξ·) | |
| Ξ·-rewrite : β {β} {A : π β Set β} {a : (c : C) β A (Ξ· c)} | |
| (p : Path A a) (c : C) β (p * (Ξ· c)) β¦ a c | |
| {-# REWRITE Ξ·-rewrite #-} | |
| syntax Path (Ξ» i -> A) a = a β i Β· A | |
| embu : β {β} {A : C β Set β} (p : A β i Β· Set β) | |
| (a : (c : C) β A c) β Set β | |
| embu {β} {A} p a = a β i Β· (p * i) | |
| embf : β {β} {A : π β Set β} {B : (i : π) (x : A i) β Set β} | |
| {f : (c : C) β (x : A (Ξ· c)) β B (Ξ· c) x} | |
| β (f β i Β· Ξ (A i) (B i)) | |
| β ((x : (i : π) β A i) β (Ξ» c β f c (x (Ξ· c))) β i Β· B i (x i)) | |
| embf p x = lam (Ξ» i β (p * i) (x i)) | |
| postulate | |
| embu-equiv : β {β} {A : C β Set β} β is-equiv (embu {β} {A}) | |
| embf-equiv : β {β} {A : π β Set β} {B : (i : π) (x : A i) β Set β} | |
| {f : (c : C) (x : A (Ξ· c)) β B (Ξ· c) x} | |
| β is-equiv (embf {β} {A} {B} {f}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some comments might be a nice addition to this code...