Last active
October 6, 2015 00:57
Revisions
-
copumpkin renamed this gist
Feb 15, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
copumpkin renamed this gist
Jun 10, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
copumpkin created this gist
Jun 10, 2012 .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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ module Scratch where open import Level open import Function open import Relation.Binary.PropositionalEquality import Relation.Binary.EqReasoning as EqReasoning -- Legend has it that parametricity is just dinaturality module Parametricity {a} {F G : Set a → Set a → Set a} (mapF : ∀ {A B C D} → (A → B) → (C → D) → F B C → F A D) (mapG : ∀ {A B C D} → (A → B) → (C → D) → G B C → G A D) where postulate -- Agda doesn't know that its own polymorphic functions are dinatural, so we must teach it about itself dinatural : ∀ (f : ∀ {A} → F A A → G A A) {A B : Set a} (g : A → B) → ∀ x → mapG id g (f (mapF g id x)) ≡ mapG g id (f (mapF id g x)) open Parametricity {zero} {λ A B → A → B} {λ _ A → A} (λ f g h → g ∘ h ∘ f) (λ _ f → f) definition : (fix : {A : Set} → (A → A) → A) {A : Set} (g : A → A) → fix g ≡ g (fix g) definition fix g = sym (dinatural fix g id)