2014-06-30 11:53:04 -07:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Author: Leonardo de Moura
|
2014-07-31 18:40:09 -07:00
|
|
|
|
2014-09-16 14:58:54 -04:00
|
|
|
-- logic.axioms.funext
|
|
|
|
-- ===================
|
|
|
|
|
2014-11-03 19:22:30 -05:00
|
|
|
import logic.cast algebra.function data.sigma
|
|
|
|
open function eq.ops
|
2014-06-30 11:53:04 -07:00
|
|
|
|
|
|
|
-- Function extensionality
|
2014-11-03 19:22:30 -05:00
|
|
|
axiom funext : ∀ {A : Type} {B : A → Type} {f g : Π a, B a} (H : ∀ a, f a = g a), f = g
|
2014-07-27 21:01:59 -07:00
|
|
|
|
|
|
|
namespace function
|
2014-10-10 16:33:58 -07:00
|
|
|
variables {A B C D: Type}
|
2014-09-19 13:30:08 -07:00
|
|
|
|
2014-12-22 14:54:01 -05:00
|
|
|
theorem compose.assoc (f : C → D) (g : B → C) (h : A → B) : (f ∘ g) ∘ h = f ∘ (g ∘ h) :=
|
2014-09-04 16:36:06 -07:00
|
|
|
funext (take x, rfl)
|
2014-07-27 21:01:59 -07:00
|
|
|
|
2014-12-22 14:54:01 -05:00
|
|
|
theorem compose.left_id (f : A → B) : id ∘ f = f :=
|
2014-09-04 16:36:06 -07:00
|
|
|
funext (take x, rfl)
|
2014-07-27 21:01:59 -07:00
|
|
|
|
2014-12-22 14:54:01 -05:00
|
|
|
theorem compose.right_id (f : A → B) : f ∘ id = f :=
|
2014-09-04 16:36:06 -07:00
|
|
|
funext (take x, rfl)
|
2014-07-27 21:01:59 -07:00
|
|
|
|
2014-07-28 19:58:57 -07:00
|
|
|
theorem compose_const_right (f : B → C) (b : B) : f ∘ (const A b) = const A (f b) :=
|
2014-09-04 16:36:06 -07:00
|
|
|
funext (take x, rfl)
|
2014-11-03 19:22:30 -05:00
|
|
|
|
|
|
|
theorem hfunext {A : Type} {B : A → Type} {B' : A → Type} {f : Π x, B x} {g : Π x, B' x}
|
|
|
|
(H : ∀ a, f a == g a) : f == g :=
|
|
|
|
let HH : B = B' := (funext (λ x, heq.type_eq (H x))) in
|
2014-11-05 16:40:28 -08:00
|
|
|
cast_to_heq (funext (λ a, heq.to_eq (heq.trans (cast_app HH f a) (H a))))
|
2014-11-03 19:22:30 -05:00
|
|
|
|
2014-08-04 17:07:59 -07:00
|
|
|
end function
|