2023-10-23 00:39:02 +00:00
|
|
|
module extraexercises where
|
|
|
|
|
|
|
|
open import Data.Nat
|
|
|
|
open import Relation.Binary.PropositionalEquality as Eq
|
|
|
|
open Eq.≡-Reasoning
|
2023-11-02 08:36:58 +00:00
|
|
|
|
|
|
|
J : {A : Set}
|
|
|
|
→ (C : (x y : A) → x ≡ y → Set)
|
|
|
|
→ (c : (x : A) → C x x refl)
|
|
|
|
→ (x y : A) → (p : x ≡ y) → C x y p
|
|
|
|
J C c x x refl = c x
|
|
|
|
|
2023-11-06 04:02:07 +00:00
|
|
|
-- Translation to PMLTT concepts
|
|
|
|
|
|
|
|
id : {A : Set} (a : A) → a ≡ a
|
|
|
|
id a = refl
|
|
|
|
|
|
|
|
idpeel : {A : Set} {a b : A}
|
|
|
|
→ (c : a ≡ b)
|
|
|
|
→ {C : (x y : A) → (z : x ≡ y) → Set}
|
|
|
|
→ (d : (x : A) → C x x (id x))
|
|
|
|
→ C a b c
|
|
|
|
idpeel {A} {a} {b} c {C} d = J C d a b c
|
|
|
|
|
|
|
|
-- Problem 2
|
|
|
|
|
2023-11-02 08:36:58 +00:00
|
|
|
inv : {A : Set} {a b : A}
|
|
|
|
→ (d : a ≡ b)
|
|
|
|
→ sym (sym d) ≡ d
|
|
|
|
inv {A} {a} {b} d =
|
2023-11-06 04:02:07 +00:00
|
|
|
J (λ x y p → sym (sym p) ≡ p) (λ x → refl) a b d
|
2023-11-02 08:36:58 +00:00
|
|
|
|
2023-11-06 04:02:07 +00:00
|
|
|
-- assoc : {A : Set} {a b c d : A}
|
|
|
|
-- → (e : a ≡ b)
|
|
|
|
-- → (f : b ≡ c)
|
|
|
|
-- → (g : c ≡ d)
|
|
|
|
-- → trans (trans e f) g ≡ trans e (trans f g)
|
|
|
|
-- assoc {a} {b} {c} {d} e f g =
|
|
|
|
-- let whatever = (λ f → J (λ x y p → trans (trans x f) y ≡ trans x (trans f y)) (λ x → {! !}) {! !} {! !} {! !}) in
|
|
|
|
-- {! !}
|
|
|
|
|
|
|
|
-- Problem 3
|
|
|
|
|
|
|
|
unitl : {A : Set}
|
|
|
|
→ (a : A)
|
|
|
|
→ {b : A}
|
|
|
|
→ (d : a ≡ b)
|
|
|
|
→ trans (id a) d ≡ d
|
|
|
|
unitl a d = id d
|
|
|
|
|
|
|
|
-- Problem 4
|
|
|
|
|
|
|
|
unitr : {A : Set}
|
|
|
|
→ {a : A}
|
|
|
|
→ (b : A)
|
|
|
|
→ (d : a ≡ b)
|
|
|
|
→ trans d (id b) ≡ d
|
|
|
|
unitr {A} {a} b d = J (λ x y p → trans p (id y) ≡ p) (λ x → id (id x)) a b d
|
|
|
|
|
|
|
|
-- Problem 5
|
2023-11-02 08:36:58 +00:00
|
|
|
|
2023-11-06 04:02:07 +00:00
|
|
|
-- ap : {A : Set}
|
2023-11-02 08:36:58 +00:00
|
|
|
|
|
|
|
-- Problem 6
|
|
|
|
|
|
|
|
-- id : {A : Set} → (a : A) → a ≡ a
|
|
|
|
-- id a = refl
|
|
|
|
|
|
|
|
-- interchange : {A : Set}
|
|
|
|
-- → (a : A)
|
|
|
|
-- → (d : id a ≡ id a)
|
|
|
|
-- → (e : id a ≡ id a)
|
|
|
|
-- → trans d e ≡ trans e d
|
|
|
|
-- interchange a d e =
|
|
|
|
-- let transde = trans d e in
|
|
|
|
-- let transed = trans e d in
|
|
|
|
-- let tmpl = J (λ x y p → {! !}) (λ x → {! !}) (id a) (id a) transde in
|
|
|
|
-- {! !}
|