Created
September 29, 2018 04:28
-
-
Save gallais/eb3b22fdfe0509286d65dee6d4134b44 to your computer and use it in GitHub Desktop.
Generic combinator for injectivity proofs.
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
open import Relation.Binary.PropositionalEquality | |
open import Relation.Binary.HeterogeneousEquality | |
open import Data.Maybe | |
open import Function | |
cong⁻¹ : ∀ {A B : Set} {a a'} (f : A → Maybe B) → | |
(eq : a ≡ a') → | |
from-just (f a) ≅ from-just (f a') | |
cong⁻¹ {a = a} f refl = refl | |
data A : Set where | |
C : A → A | |
D : A → A → A | |
C-injective : ∀ {a b} → C a ≡ C b → a ≅ b | |
C-injective = cong⁻¹ λ { (C a) → just a; _ → nothing } | |
D₁-injective : ∀ {a b c} → D a b ≡ D b c → a ≅ b | |
D₁-injective = cong⁻¹ λ { (D a _) → just a; _ → nothing } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment