Created
June 29, 2017 13:36
-
-
Save gallais/8010eb17db59db77d552e7553147ee40 to your computer and use it in GitHub Desktop.
Acc
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
module Accessibility where | |
data Acc {A : Set} (R : A → A → Set) (a : A) : Set where | |
step : (∀ b → R b a → Acc R b) → Acc R a | |
□^ : ∀ {A : Set} (R : A → A → Set) → (A → Set) → (A → Set) | |
□^ R P a = ∀ b → R b a → P b | |
[_] : {A : Set} → (A → Set) → Set | |
[ P ] = ∀ {a} → P a | |
infixr 5 _⟶_ | |
_⟶_ : {A : Set} → (A → Set) → (A → Set) → (A → Set) | |
(P ⟶ Q) a = P a → Q a | |
fix : ∀ {A : Set} {R : A → A → Set} → | |
[ Acc R ] → ∀ P → [ □^ R P ⟶ P ] → [ P ] | |
fix {A} {R} acc P f = go acc where | |
go : [ Acc R ⟶ P ] | |
go (step acc) = f (λ b Rba → go (acc b Rba)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment