2014-11-12 20:27:40 +00:00
|
|
|
|
-- Copyright (c) 2014 Jakob von Raumer. All rights reserved.
|
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
-- Author: Jakob von Raumer
|
|
|
|
|
-- Ported from Coq HoTT
|
2014-11-14 05:05:17 +00:00
|
|
|
|
import hott.equiv hott.funext_varieties
|
2014-11-12 22:37:19 +00:00
|
|
|
|
import data.prod data.sigma data.unit
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
2014-11-14 05:05:17 +00:00
|
|
|
|
open path function prod sigma truncation Equiv IsEquiv unit
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
2014-11-19 01:51:58 +00:00
|
|
|
|
set_option pp.universes true
|
|
|
|
|
|
2014-11-13 00:07:28 +00:00
|
|
|
|
definition isequiv_path {A B : Type} (H : A ≈ B) :=
|
|
|
|
|
(@IsEquiv.transport Type (λX, X) A B H)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
definition equiv_path {A B : Type} (H : A ≈ B) : A ≃ B :=
|
|
|
|
|
Equiv.mk _ (isequiv_path H)
|
|
|
|
|
|
2014-11-12 20:27:40 +00:00
|
|
|
|
-- First, define an axiom free variant of Univalence
|
2014-11-13 00:07:28 +00:00
|
|
|
|
definition ua_type := Π (A B : Type), IsEquiv (@equiv_path A B)
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
|
|
|
|
context
|
2014-11-19 01:51:58 +00:00
|
|
|
|
universe variables l k
|
|
|
|
|
parameter {ua : ua_type.{l+1}}
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
2014-11-19 01:51:58 +00:00
|
|
|
|
protected theorem ua_isequiv_postcompose {A B : Type.{l+1}} {C : Type}
|
|
|
|
|
{w : A → B} {H0 : IsEquiv w} : IsEquiv (@compose C A B w) :=
|
2014-11-14 06:03:17 +00:00
|
|
|
|
let w' := Equiv.mk w H0 in
|
|
|
|
|
let eqinv : A ≈ B := (equiv_path⁻¹ w') in
|
|
|
|
|
let eq' := equiv_path eqinv in
|
|
|
|
|
IsEquiv.adjointify (@compose C A B w)
|
|
|
|
|
(@compose C B A (IsEquiv.inv w))
|
|
|
|
|
(λ (x : C → B),
|
|
|
|
|
have eqretr : eq' ≈ w',
|
|
|
|
|
from (@retr _ _ (@equiv_path A B) (ua A B) w'),
|
|
|
|
|
have invs_eq : (equiv_fun eq')⁻¹ ≈ (equiv_fun w')⁻¹,
|
|
|
|
|
from inv_eq eq' w' eqretr,
|
|
|
|
|
have eqfin : (equiv_fun eq') ∘ ((equiv_fun eq')⁻¹ ∘ x) ≈ x,
|
|
|
|
|
from (λ p,
|
2014-11-19 01:51:58 +00:00
|
|
|
|
(@path.rec_on Type.{l+1} A
|
2014-11-14 06:03:17 +00:00
|
|
|
|
(λ B' p', Π (x' : C → B'), (equiv_fun (equiv_path p'))
|
|
|
|
|
∘ ((equiv_fun (equiv_path p'))⁻¹ ∘ x') ≈ x')
|
|
|
|
|
B p (λ x', idp))
|
|
|
|
|
) eqinv x,
|
|
|
|
|
have eqfin' : (equiv_fun w') ∘ ((equiv_fun eq')⁻¹ ∘ x) ≈ x,
|
|
|
|
|
from eqretr ▹ eqfin,
|
|
|
|
|
have eqfin'' : (equiv_fun w') ∘ ((equiv_fun w')⁻¹ ∘ x) ≈ x,
|
|
|
|
|
from invs_eq ▹ eqfin',
|
|
|
|
|
eqfin''
|
|
|
|
|
)
|
|
|
|
|
(λ (x : C → A),
|
|
|
|
|
have eqretr : eq' ≈ w',
|
|
|
|
|
from (@retr _ _ (@equiv_path A B) (ua A B) w'),
|
|
|
|
|
have invs_eq : (equiv_fun eq')⁻¹ ≈ (equiv_fun w')⁻¹,
|
|
|
|
|
from inv_eq eq' w' eqretr,
|
|
|
|
|
have eqfin : (equiv_fun eq')⁻¹ ∘ ((equiv_fun eq') ∘ x) ≈ x,
|
|
|
|
|
from (λ p, path.rec_on p idp) eqinv,
|
|
|
|
|
have eqfin' : (equiv_fun eq')⁻¹ ∘ ((equiv_fun w') ∘ x) ≈ x,
|
|
|
|
|
from eqretr ▹ eqfin,
|
|
|
|
|
have eqfin'' : (equiv_fun w')⁻¹ ∘ ((equiv_fun w') ∘ x) ≈ x,
|
|
|
|
|
from invs_eq ▹ eqfin',
|
|
|
|
|
eqfin''
|
|
|
|
|
)
|
|
|
|
|
|
2014-11-12 20:27:40 +00:00
|
|
|
|
-- We are ready to prove functional extensionality,
|
|
|
|
|
-- starting with the naive non-dependent version.
|
|
|
|
|
protected definition diagonal [reducible] (B : Type) : Type
|
|
|
|
|
:= Σ xy : B × B, pr₁ xy ≈ pr₂ xy
|
|
|
|
|
|
2014-11-19 01:51:58 +00:00
|
|
|
|
protected definition isequiv_src_compose {A B C : Type}
|
2014-11-12 20:27:40 +00:00
|
|
|
|
: @IsEquiv (A → diagonal B)
|
|
|
|
|
(A → B)
|
|
|
|
|
(compose (pr₁ ∘ dpr1))
|
|
|
|
|
:= @ua_isequiv_postcompose _ _ _ (pr₁ ∘ dpr1)
|
|
|
|
|
(IsEquiv.adjointify (pr₁ ∘ dpr1)
|
|
|
|
|
(λ x, dpair (x , x) idp) (λx, idp)
|
|
|
|
|
(λ x, sigma.rec_on x
|
|
|
|
|
(λ xy, prod.rec_on xy
|
|
|
|
|
(λ b c p, path.rec_on p idp))))
|
|
|
|
|
|
2014-11-19 01:51:58 +00:00
|
|
|
|
protected definition isequiv_tgt_compose {A B C : Type}
|
2014-11-12 20:27:40 +00:00
|
|
|
|
: @IsEquiv (A → diagonal B)
|
|
|
|
|
(A → B)
|
|
|
|
|
(compose (pr₂ ∘ dpr1))
|
|
|
|
|
:= @ua_isequiv_postcompose _ _ _ (pr2 ∘ dpr1)
|
|
|
|
|
(IsEquiv.adjointify (pr2 ∘ dpr1)
|
|
|
|
|
(λ x, dpair (x , x) idp) (λx, idp)
|
|
|
|
|
(λ x, sigma.rec_on x
|
|
|
|
|
(λ xy, prod.rec_on xy
|
|
|
|
|
(λ b c p, path.rec_on p idp))))
|
|
|
|
|
|
2014-11-19 01:51:58 +00:00
|
|
|
|
theorem ua_implies_funext_nondep {A B : Type.{l+1}}
|
2014-11-12 22:37:19 +00:00
|
|
|
|
: Π {f g : A → B}, f ∼ g → f ≈ g
|
2014-11-12 20:27:40 +00:00
|
|
|
|
:= (λ (f g : A → B) (p : f ∼ g),
|
|
|
|
|
let d := λ (x : A), dpair (f x , f x) idp in
|
|
|
|
|
let e := λ (x : A), dpair (f x , g x) (p x) in
|
|
|
|
|
let precomp1 := compose (pr₁ ∘ dpr1) in
|
|
|
|
|
have equiv1 [visible] : IsEquiv precomp1,
|
|
|
|
|
from @isequiv_src_compose A B (diagonal B),
|
|
|
|
|
have equiv2 [visible] : Π x y, IsEquiv (ap precomp1),
|
|
|
|
|
from IsEquiv.ap_closed precomp1,
|
|
|
|
|
have H' : Π (x y : A → diagonal B),
|
|
|
|
|
pr₁ ∘ dpr1 ∘ x ≈ pr₁ ∘ dpr1 ∘ y → x ≈ y,
|
|
|
|
|
from (λ x y, IsEquiv.inv (ap precomp1)),
|
|
|
|
|
have eq2 : pr₁ ∘ dpr1 ∘ d ≈ pr₁ ∘ dpr1 ∘ e,
|
|
|
|
|
from idp,
|
|
|
|
|
have eq0 : d ≈ e,
|
|
|
|
|
from H' d e eq2,
|
|
|
|
|
have eq1 : (pr₂ ∘ dpr1) ∘ d ≈ (pr₂ ∘ dpr1) ∘ e,
|
|
|
|
|
from ap _ eq0,
|
|
|
|
|
eq1
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2014-11-12 22:37:19 +00:00
|
|
|
|
context
|
2014-11-19 01:51:58 +00:00
|
|
|
|
universe variables l k
|
|
|
|
|
parameters {ua1 : ua_type.{l+1}} {ua2 : ua_type.{l+2}}
|
|
|
|
|
--parameters {ua1 ua2 : ua_type}
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
2014-11-12 22:37:19 +00:00
|
|
|
|
-- Now we use this to prove weak funext, which as we know
|
|
|
|
|
-- implies (with dependent eta) also the strong dependent funext.
|
2014-11-14 06:03:17 +00:00
|
|
|
|
set_option pp.universes true
|
2014-11-19 01:51:58 +00:00
|
|
|
|
check @ua_implies_funext_nondep
|
|
|
|
|
check @weak_funext_implies_funext
|
|
|
|
|
check @ua_type
|
|
|
|
|
definition lift : Type.{l+1} → Type.{l+2} := sorry
|
|
|
|
|
|
2014-11-12 22:37:19 +00:00
|
|
|
|
theorem ua_implies_weak_funext : weak_funext
|
2014-11-19 01:51:58 +00:00
|
|
|
|
:= (λ (A : Type.{l+1}) (P : A → Type.{l+1}) allcontr,
|
|
|
|
|
have liftA : Type.{l+2},
|
|
|
|
|
from lift A,
|
2014-11-12 22:37:19 +00:00
|
|
|
|
let U := (λ (x : A), unit) in
|
|
|
|
|
have pequiv : Πx, P x ≃ U x,
|
2014-11-19 01:51:58 +00:00
|
|
|
|
from (λ x, @equiv_contr_unit(P x) (allcontr x)),
|
2014-11-12 22:37:19 +00:00
|
|
|
|
have psim : Πx, P x ≈ U x,
|
|
|
|
|
from (λ x, @IsEquiv.inv _ _
|
2014-11-19 01:51:58 +00:00
|
|
|
|
(@equiv_path (P x) (U x)) (ua1 (P x) (U x)) (pequiv x)),
|
2014-11-12 22:37:19 +00:00
|
|
|
|
have p : P ≈ U,
|
2014-11-19 01:51:58 +00:00
|
|
|
|
from @ua_implies_funext_nondep.{l} ua1 A Type.{l+1} P U psim,
|
2014-11-12 22:37:19 +00:00
|
|
|
|
have tU' : is_contr (A → unit),
|
|
|
|
|
from is_contr.mk (λ x, ⋆)
|
2014-11-14 06:03:17 +00:00
|
|
|
|
(λ f, @ua_implies_funext_nondep ua1 _ _ _ _
|
2014-11-12 22:37:19 +00:00
|
|
|
|
(λ x, unit.rec_on (f x) idp)),
|
|
|
|
|
have tU : is_contr (Πx, U x),
|
|
|
|
|
from tU',
|
|
|
|
|
have tlast : is_contr (Πx, P x),
|
|
|
|
|
from path.transport _ (p⁻¹) tU,
|
|
|
|
|
tlast
|
|
|
|
|
)
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
2014-11-12 22:37:19 +00:00
|
|
|
|
end
|
2014-11-12 20:27:40 +00:00
|
|
|
|
|
|
|
|
|
-- In the following we will proof function extensionality using the univalence axiom
|
2014-11-12 22:37:19 +00:00
|
|
|
|
-- TODO: check out why I have to generalize on A and P here
|
|
|
|
|
definition ua_implies_funext_type {ua : ua_type.{1}} : @funext_type :=
|
|
|
|
|
(λ A P, weak_funext_implies_funext (@ua_implies_weak_funext ua))
|