2014-06-30 18:53:04 +00: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-08-01 01:40:09 +00:00
|
|
|
|
2014-09-16 18:58:54 +00:00
|
|
|
-- logic.axioms.funext
|
|
|
|
-- ===================
|
|
|
|
|
2014-11-04 00:22:30 +00:00
|
|
|
import logic.cast algebra.function data.sigma
|
|
|
|
open function eq.ops
|
2014-06-30 18:53:04 +00:00
|
|
|
|
|
|
|
-- Function extensionality
|
2014-11-04 00:22:30 +00:00
|
|
|
axiom funext : ∀ {A : Type} {B : A → Type} {f g : Π a, B a} (H : ∀ a, f a = g a), f = g
|
2014-07-28 04:01:59 +00:00
|
|
|
|
|
|
|
namespace function
|
2014-10-10 23:33:58 +00:00
|
|
|
variables {A B C D: Type}
|
2014-09-19 20:30:08 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
theorem compose.assoc (f : C → D) (g : B → C) (h : A → B) : (f ∘ g) ∘ h = f ∘ (g ∘ h) :=
|
2014-09-04 23:36:06 +00:00
|
|
|
funext (take x, rfl)
|
2014-07-28 04:01:59 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
theorem compose.left_id (f : A → B) : id ∘ f = f :=
|
2014-09-04 23:36:06 +00:00
|
|
|
funext (take x, rfl)
|
2014-07-28 04:01:59 +00:00
|
|
|
|
2014-12-22 19:54:01 +00:00
|
|
|
theorem compose.right_id (f : A → B) : f ∘ id = f :=
|
2014-09-04 23:36:06 +00:00
|
|
|
funext (take x, rfl)
|
2014-07-28 04:01:59 +00:00
|
|
|
|
2014-07-29 02:58:57 +00:00
|
|
|
theorem compose_const_right (f : B → C) (b : B) : f ∘ (const A b) = const A (f b) :=
|
2014-09-04 23:36:06 +00:00
|
|
|
funext (take x, rfl)
|
2014-11-04 00:22:30 +00: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-06 00:40:28 +00:00
|
|
|
cast_to_heq (funext (λ a, heq.to_eq (heq.trans (cast_app HH f a) (H a))))
|
2014-11-04 00:22:30 +00:00
|
|
|
|
2014-08-05 00:07:59 +00:00
|
|
|
end function
|