lean2/library/hott/axioms/funext.lean

38 lines
1.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
-- Released under Apache 2.0 license as described in the file LICENSE.
-- Author: Jeremy Avigad, Jakob von Raumer
-- Ported from Coq HoTT
-- TODO: take a look at the Coq tricks
import hott.path hott.equiv
open path
set_option pp.universes true
-- Funext
-- ------
-- Define function extensionality as a type class
inductive funext.{l} [class] : Type.{l+3} :=
mk : (Π (A : Type.{l+1}) (P : A → Type.{l+2}) (f g : Π x, P x), IsEquiv (@apD10 A P f g))
→ funext.{l}
namespace funext
context
universe l
parameters [F : funext.{l}] {A : Type.{l+1}} {P : A → Type.{l+2}} (f g : Π x, P x)
protected definition ap [instance] : IsEquiv (@apD10 A P f g) :=
rec_on F (λ (H : Π A P f g, _), !H)
definition path_forall : f g → f ≈ g :=
@IsEquiv.inv _ _ (@apD10 A P f g) ap
end
definition path_forall2 [F : funext] {A B : Type} {P : A → B → Type}
(f g : Πx y, P x y) : (Πx y, f x y ≈ g x y) → f ≈ g :=
λ E, path_forall f g (λx, path_forall (f x) (g x) (E x))
end funext