Debian Codegraph @

src/Axiom/Extensionality/Heterogeneous.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Results concerning function extensionality for propositional equality
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --with-K --safe #-}
8
9 module Axiom.Extensionality.Heterogeneous where
10
11 import Axiom.Extensionality.Propositional as P
12 using (Extensionality; lower-extensionality)
13 open import Function.Base using (_$_; _∘_)
14 open import Level using (Level; suc)
15 open import Relation.Binary.HeterogeneousEquality.Core
16 using (_≅_; ≅-to-≡; ≡-to-≅)
17 open import Relation.Binary.PropositionalEquality.Core using (_≡_; refl)
18
19 ------------------------------------------------------------------------
20 -- Function extensionality states that if two functions are
21 -- propositionally equal for every input, then the functions themselves
22 -- must be propositionally equal.
23
24 Extensionality : (a b : Level) → Set _
25 Extensionality a b =
26 {A : Set a} {B₁ B₂ : A → Set b}
27 {f₁ : (x : A) → B₁ x} {f₂ : (x : A) → B₂ x} →
28 (∀ x → B₁ x ≡ B₂ x) → (∀ x → f₁ x ≅ f₂ x) → f₁ ≅ f₂
29
30 ------------------------------------------------------------------------
31 -- Properties
32
33 -- This form of extensionality follows from extensionality for _≡_.
34
35 ≡-ext⇒≅-ext : ∀ {ℓ₁ ℓ₂} →
36 P.Extensionality ℓ₁ (suc ℓ₂) →
37 Extensionality ℓ₁ ℓ₂
38 ≡-ext⇒≅-ext {ℓ₁} {ℓ₂} ext B₁≡B₂ f₁≅f₂ with ext B₁≡B₂
39 ... | refl = ≡-to-≅ $ ext′ (≅-to-≡ ∘ f₁≅f₂)
40 where
41 ext′ : P.Extensionality ℓ₁ ℓ₂
42 ext′ = P.lower-extensionality ℓ₁ (suc ℓ₂) ext