2015-05-23 04:21:16 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2014 Floris van Doorn. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Author: Floris van Doorn
|
2014-08-23 00:56:25 +00:00
|
|
|
|
2015-05-23 04:21:16 +00:00
|
|
|
An explicit treatment of quotients, without using Lean's built-in quotient types.
|
|
|
|
-/
|
2014-12-01 04:34:12 +00:00
|
|
|
import logic data.subtype logic.cast algebra.relation data.prod
|
2014-10-05 17:50:13 +00:00
|
|
|
import logic.instances
|
2014-09-11 21:57:15 +00:00
|
|
|
import .util
|
2014-08-17 21:41:23 +00:00
|
|
|
|
2014-10-02 00:51:17 +00:00
|
|
|
open relation prod inhabited nonempty tactic eq.ops
|
2014-09-03 23:00:38 +00:00
|
|
|
open subtype relation.iff_ops
|
2014-08-20 22:49:44 +00:00
|
|
|
|
2014-08-17 21:41:23 +00:00
|
|
|
namespace quotient
|
|
|
|
|
2015-05-23 04:21:16 +00:00
|
|
|
/- definition and basics -/
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
-- TODO: make this a structure
|
2014-09-17 21:39:05 +00:00
|
|
|
definition is_quotient {A B : Type} (R : A → A → Prop) (abs : A → B) (rep : B → A) : Prop :=
|
2014-08-17 21:41:23 +00:00
|
|
|
(∀b, abs (rep b) = b) ∧
|
|
|
|
(∀b, R (rep b) (rep b)) ∧
|
|
|
|
(∀r s, R r s ↔ (R r r ∧ R s s ∧ abs r = abs s))
|
|
|
|
|
|
|
|
theorem intro {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(H1 : ∀b, abs (rep b) = b) (H2 : ∀b, R (rep b) (rep b))
|
2014-08-22 01:24:22 +00:00
|
|
|
(H3 : ∀r s, R r s ↔ (R r r ∧ R s s ∧ abs r = abs s)) : is_quotient R abs rep :=
|
2014-09-04 23:36:06 +00:00
|
|
|
and.intro H1 (and.intro H2 H3)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
2014-08-20 02:32:44 +00:00
|
|
|
theorem and_absorb_left {a : Prop} (b : Prop) (Ha : a) : a ∧ b ↔ b :=
|
2014-09-05 04:25:21 +00:00
|
|
|
iff.intro (assume Hab, and.elim_right Hab) (assume Hb, and.intro Ha Hb)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem intro_refl {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(H1 : reflexive R) (H2 : ∀b, abs (rep b) = b)
|
|
|
|
(H3 : ∀r s, R r s ↔ abs r = abs s) : is_quotient R abs rep :=
|
|
|
|
intro
|
|
|
|
H2
|
|
|
|
(take b, H1 (rep b))
|
|
|
|
(take r s,
|
|
|
|
have H4 : R r s ↔ R s s ∧ abs r = abs s,
|
2014-08-22 01:24:22 +00:00
|
|
|
from
|
2014-08-20 22:49:44 +00:00
|
|
|
subst (symm (and_absorb_left _ (H1 s))) (H3 r s),
|
|
|
|
subst (symm (and_absorb_left _ (H1 r))) H4)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem abs_rep {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
2014-08-22 01:24:22 +00:00
|
|
|
(Q : is_quotient R abs rep) (b : B) : abs (rep b) = b :=
|
2014-09-05 00:44:53 +00:00
|
|
|
and.elim_left Q b
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem refl_rep {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
2014-08-22 01:24:22 +00:00
|
|
|
(Q : is_quotient R abs rep) (b : B) : R (rep b) (rep b) :=
|
2014-09-05 00:44:53 +00:00
|
|
|
and.elim_left (and.elim_right Q) b
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem R_iff {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) (r s : A) : R r s ↔ (R r r ∧ R s s ∧ abs r = abs s) :=
|
2014-09-05 00:44:53 +00:00
|
|
|
and.elim_right (and.elim_right Q) r s
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem refl_left {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {r s : A} (H : R r s) : R r r :=
|
2014-09-05 04:25:21 +00:00
|
|
|
and.elim_left (iff.elim_left (R_iff Q r s) H)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem refl_right {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {r s : A} (H : R r s) : R s s :=
|
2014-09-05 04:25:21 +00:00
|
|
|
and.elim_left (and.elim_right (iff.elim_left (R_iff Q r s) H))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem eq_abs {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {r s : A} (H : R r s) : abs r = abs s :=
|
2014-09-05 04:25:21 +00:00
|
|
|
and.elim_right (and.elim_right (iff.elim_left (R_iff Q r s) H))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem R_intro {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {r s : A} (H1 : R r r) (H2 : R s s) (H3 : abs r = abs s) : R r s :=
|
2014-09-05 04:25:21 +00:00
|
|
|
iff.elim_right (R_iff Q r s) (and.intro H1 (and.intro H2 H3))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem R_intro_refl {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) (H1 : reflexive R) {r s : A} (H2 : abs r = abs s) : R r s :=
|
2014-09-05 04:25:21 +00:00
|
|
|
iff.elim_right (R_iff Q r s) (and.intro (H1 r) (and.intro (H1 s) H2))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem rep_eq {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {a b : B} (H : R (rep a) (rep b)) : a = b :=
|
|
|
|
calc
|
2014-09-05 01:41:06 +00:00
|
|
|
a = abs (rep a) : eq.symm (abs_rep Q a)
|
2014-08-17 21:41:23 +00:00
|
|
|
... = abs (rep b) : {eq_abs Q H}
|
|
|
|
... = b : abs_rep Q b
|
|
|
|
|
|
|
|
theorem R_rep_abs {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {a : A} (H : R a a) : R a (rep (abs a)) :=
|
2014-09-05 01:41:06 +00:00
|
|
|
have H3 : abs a = abs (rep (abs a)), from eq.symm (abs_rep Q (abs a)),
|
2014-08-17 21:41:23 +00:00
|
|
|
R_intro Q H (refl_rep Q (abs a)) H3
|
|
|
|
|
|
|
|
theorem quotient_imp_symm {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) : symmetric R :=
|
|
|
|
take a b : A,
|
|
|
|
assume H : R a b,
|
|
|
|
have Ha : R a a, from refl_left Q H,
|
|
|
|
have Hb : R b b, from refl_right Q H,
|
2014-09-05 01:41:06 +00:00
|
|
|
have Hab : abs b = abs a, from eq.symm (eq_abs Q H),
|
2014-08-17 21:41:23 +00:00
|
|
|
R_intro Q Hb Ha Hab
|
|
|
|
|
|
|
|
theorem quotient_imp_trans {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) : transitive R :=
|
|
|
|
take a b c : A,
|
|
|
|
assume Hab : R a b,
|
|
|
|
assume Hbc : R b c,
|
|
|
|
have Ha : R a a, from refl_left Q Hab,
|
|
|
|
have Hc : R c c, from refl_right Q Hbc,
|
2014-09-05 01:41:06 +00:00
|
|
|
have Hac : abs a = abs c, from eq.trans (eq_abs Q Hab) (eq_abs Q Hbc),
|
2014-08-17 21:41:23 +00:00
|
|
|
R_intro Q Ha Hc Hac
|
|
|
|
|
2015-05-23 04:21:16 +00:00
|
|
|
/- recursion -/
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
-- (maybe some are superfluous)
|
|
|
|
|
|
|
|
definition rec {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {C : B → Type} (f : forall (a : A), C (abs a)) (b : B) : C b :=
|
2014-11-04 00:22:30 +00:00
|
|
|
eq.rec_on (abs_rep Q b) (f (rep b))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem comp {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {C : B → Type} {f : forall (a : A), C (abs a)}
|
2014-11-04 00:22:30 +00:00
|
|
|
(H : forall (r s : A) (H' : R r s), eq.rec_on (eq_abs Q H') (f r) = f s)
|
2014-08-17 21:41:23 +00:00
|
|
|
{a : A} (Ha : R a a) : rec Q f (abs a) = f a :=
|
2015-02-25 22:30:42 +00:00
|
|
|
assert H2 : R a (rep (abs a)), from
|
2014-10-31 01:44:05 +00:00
|
|
|
R_rep_abs Q Ha,
|
2015-02-25 22:30:42 +00:00
|
|
|
assert Heq : abs (rep (abs a)) = abs a, from
|
2014-10-31 01:44:05 +00:00
|
|
|
abs_rep Q (abs a),
|
2014-08-17 21:41:23 +00:00
|
|
|
calc
|
2014-11-04 00:22:30 +00:00
|
|
|
rec Q f (abs a) = eq.rec_on Heq (f (rep (abs a))) : rfl
|
|
|
|
... = eq.rec_on Heq (eq.rec_on (Heq⁻¹) (f a)) : {(H _ _ H2)⁻¹}
|
2014-10-31 01:44:05 +00:00
|
|
|
... = f a : eq.rec_on_compose (eq_abs Q H2) _ _
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
definition rec_constant {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {C : Type} (f : A → C) (b : B) : C :=
|
|
|
|
f (rep b)
|
|
|
|
|
|
|
|
theorem comp_constant {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {C : Type} {f : A → C}
|
|
|
|
(H : forall (r s : A) (H' : R r s), f r = f s)
|
|
|
|
{a : A} (Ha : R a a) : rec_constant Q f (abs a) = f a :=
|
|
|
|
have H2 : R a (rep (abs a)), from R_rep_abs Q Ha,
|
|
|
|
calc
|
|
|
|
rec_constant Q f (abs a) = f (rep (abs a)) : rfl
|
2014-09-05 01:41:06 +00:00
|
|
|
... = f a : {(H _ _ H2)⁻¹}
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
definition rec_binary {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {C : Type} (f : A → A → C) (b c : B) : C :=
|
|
|
|
f (rep b) (rep c)
|
|
|
|
|
|
|
|
theorem comp_binary {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {C : Type} {f : A → A → C}
|
|
|
|
(H : forall (a a' b b' : A) (Ha : R a a') (Hb : R b b'), f a b = f a' b')
|
|
|
|
{a b : A} (Ha : R a a) (Hb : R b b) : rec_binary Q f (abs a) (abs b) = f a b :=
|
|
|
|
have H2 : R a (rep (abs a)), from R_rep_abs Q Ha,
|
|
|
|
have H3 : R b (rep (abs b)), from R_rep_abs Q Hb,
|
|
|
|
calc
|
|
|
|
rec_binary Q f (abs a) (abs b) = f (rep (abs a)) (rep (abs b)) : rfl
|
2014-09-05 01:41:06 +00:00
|
|
|
... = f a b : {(H _ _ _ _ H2 H3)⁻¹}
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem comp_binary_refl {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) (Hrefl : reflexive R) {C : Type} {f : A → A → C}
|
|
|
|
(H : forall (a a' b b' : A) (Ha : R a a') (Hb : R b b'), f a b = f a' b')
|
|
|
|
(a b : A) : rec_binary Q f (abs a) (abs b) = f a b :=
|
|
|
|
comp_binary Q H (Hrefl a) (Hrefl b)
|
|
|
|
|
|
|
|
definition quotient_map {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) (f : A → A) (b : B) : B :=
|
|
|
|
abs (f (rep b))
|
|
|
|
|
|
|
|
theorem comp_quotient_map {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {f : A → A}
|
|
|
|
(H : forall (a a' : A) (Ha : R a a'), R (f a) (f a'))
|
|
|
|
{a : A} (Ha : R a a) : quotient_map Q f (abs a) = abs (f a) :=
|
|
|
|
have H2 : R a (rep (abs a)), from R_rep_abs Q Ha,
|
|
|
|
have H3 : R (f a) (f (rep (abs a))), from H _ _ H2,
|
|
|
|
have H4 : abs (f a) = abs (f (rep (abs a))), from eq_abs Q H3,
|
2014-09-05 01:41:06 +00:00
|
|
|
H4⁻¹
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
definition quotient_map_binary {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) (f : A → A → A) (b c : B) : B :=
|
|
|
|
abs (f (rep b) (rep c))
|
|
|
|
|
|
|
|
theorem comp_quotient_map_binary {A B : Type} {R : A → A → Prop} {abs : A → B} {rep : B → A}
|
|
|
|
(Q : is_quotient R abs rep) {f : A → A → A}
|
|
|
|
(H : forall (a a' b b' : A) (Ha : R a a') (Hb : R b b'), R (f a b) (f a' b'))
|
|
|
|
{a b : A} (Ha : R a a) (Hb : R b b) : quotient_map_binary Q f (abs a) (abs b) = abs (f a b) :=
|
|
|
|
have Ha2 : R a (rep (abs a)), from R_rep_abs Q Ha,
|
|
|
|
have Hb2 : R b (rep (abs b)), from R_rep_abs Q Hb,
|
|
|
|
have H2 : R (f a b) (f (rep (abs a)) (rep (abs b))), from H _ _ _ _ Ha2 Hb2,
|
2014-09-05 01:41:06 +00:00
|
|
|
(eq_abs Q H2)⁻¹
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem comp_quotient_map_binary_refl {A B : Type} {R : A → A → Prop} (Hrefl : reflexive R)
|
|
|
|
{abs : A → B} {rep : B → A} (Q : is_quotient R abs rep) {f : A → A → A}
|
|
|
|
(H : forall (a a' b b' : A) (Ha : R a a') (Hb : R b b'), R (f a b) (f a' b'))
|
|
|
|
(a b : A) : quotient_map_binary Q f (abs a) (abs b) = abs (f a b) :=
|
|
|
|
comp_quotient_map_binary Q H (Hrefl a) (Hrefl b)
|
|
|
|
|
2015-05-23 04:21:16 +00:00
|
|
|
/- image -/
|
|
|
|
|
2014-09-17 21:39:05 +00:00
|
|
|
definition image {A B : Type} (f : A → B) := subtype (fun b, ∃a, f a = b)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem image_inhabited {A B : Type} (f : A → B) (H : inhabited A) : inhabited (image f) :=
|
2014-12-16 03:05:03 +00:00
|
|
|
inhabited.mk (tag (f (default A)) (exists.intro (default A) rfl))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem image_inhabited2 {A B : Type} (f : A → B) (a : A) : inhabited (image f) :=
|
2014-09-04 23:36:06 +00:00
|
|
|
image_inhabited f (inhabited.mk a)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
definition fun_image {A B : Type} (f : A → B) (a : A) : image f :=
|
2014-12-16 03:05:03 +00:00
|
|
|
tag (f a) (exists.intro a rfl)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
2014-08-22 01:24:22 +00:00
|
|
|
theorem fun_image_def {A B : Type} (f : A → B) (a : A) :
|
2014-12-16 03:05:03 +00:00
|
|
|
fun_image f a = tag (f a) (exists.intro a rfl) := rfl
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem elt_of_fun_image {A B : Type} (f : A → B) (a : A) : elt_of (fun_image f a) = f a :=
|
2014-11-16 22:19:35 +00:00
|
|
|
elt_of.tag _ _
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem image_elt_of {A B : Type} {f : A → B} (u : image f) : ∃a, f a = elt_of u :=
|
|
|
|
has_property u
|
|
|
|
|
|
|
|
theorem fun_image_surj {A B : Type} {f : A → B} (u : image f) : ∃a, fun_image f a = u :=
|
2014-09-04 22:03:59 +00:00
|
|
|
subtype.destruct u
|
2014-08-17 21:41:23 +00:00
|
|
|
(take (b : B) (H : ∃a, f a = b),
|
|
|
|
obtain a (H': f a = b), from H,
|
2014-12-16 03:05:03 +00:00
|
|
|
(exists.intro a (tag_eq H')))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem image_tag {A B : Type} {f : A → B} (u : image f) : ∃a H, tag (f a) H = u :=
|
|
|
|
obtain a (H : fun_image f a = u), from fun_image_surj u,
|
2014-12-16 03:05:03 +00:00
|
|
|
exists.intro a (exists.intro (exists.intro a rfl) H)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
2014-10-02 00:51:17 +00:00
|
|
|
open eq.ops
|
2014-09-05 01:41:06 +00:00
|
|
|
|
2014-08-17 21:41:23 +00:00
|
|
|
theorem fun_image_eq {A B : Type} (f : A → B) (a a' : A)
|
|
|
|
: (f a = f a') ↔ (fun_image f a = fun_image f a') :=
|
2014-09-05 04:25:21 +00:00
|
|
|
iff.intro
|
2014-08-17 21:41:23 +00:00
|
|
|
(assume H : f a = f a', tag_eq H)
|
|
|
|
(assume H : fun_image f a = fun_image f a',
|
2014-09-05 01:41:06 +00:00
|
|
|
(congr_arg elt_of H ▸ elt_of_fun_image f a) ▸ elt_of_fun_image f a')
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem idempotent_image_elt_of {A : Type} {f : A → A} (H : ∀a, f (f a) = f a) (u : image f)
|
|
|
|
: fun_image f (elt_of u) = u :=
|
|
|
|
obtain (a : A) (Ha : fun_image f a = u), from fun_image_surj u,
|
|
|
|
calc
|
2014-09-05 01:41:06 +00:00
|
|
|
fun_image f (elt_of u) = fun_image f (elt_of (fun_image f a)) : {Ha⁻¹}
|
2014-08-17 21:41:23 +00:00
|
|
|
... = fun_image f (f a) : {elt_of_fun_image f a}
|
2014-09-05 04:25:21 +00:00
|
|
|
... = fun_image f a : {iff.elim_left (fun_image_eq f (f a) a) (H a)}
|
2014-08-17 21:41:23 +00:00
|
|
|
... = u : Ha
|
|
|
|
|
|
|
|
theorem idempotent_image_fix {A : Type} {f : A → A} (H : ∀a, f (f a) = f a) (u : image f)
|
|
|
|
: f (elt_of u) = elt_of u :=
|
|
|
|
obtain (a : A) (Ha : f a = elt_of u), from image_elt_of u,
|
|
|
|
calc
|
2014-09-05 01:41:06 +00:00
|
|
|
f (elt_of u) = f (f a) : {Ha⁻¹}
|
2014-08-17 21:41:23 +00:00
|
|
|
... = f a : H a
|
|
|
|
... = elt_of u : Ha
|
|
|
|
|
2015-05-23 04:21:16 +00:00
|
|
|
/- construct quotient from representative map -/
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem representative_map_idempotent {A : Type} {R : A → A → Prop} {f : A → A}
|
2014-08-20 22:49:44 +00:00
|
|
|
(H1 : ∀a, R a (f a)) (H2 : ∀a b, R a b ↔ R a a ∧ R b b ∧ f a = f b) (a : A) :
|
|
|
|
f (f a) = f a :=
|
2014-09-05 04:25:21 +00:00
|
|
|
(and.elim_right (and.elim_right (iff.elim_left (H2 a (f a)) (H1 a))))⁻¹
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem representative_map_idempotent_equiv {A : Type} {R : A → A → Prop} {f : A → A}
|
2014-08-20 22:49:44 +00:00
|
|
|
(H1 : ∀a, R a (f a)) (H2 : ∀a b, R a b → f a = f b) (a : A) :
|
|
|
|
f (f a) = f a :=
|
2014-09-05 01:41:06 +00:00
|
|
|
(H2 a (f a) (H1 a))⁻¹
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem representative_map_refl_rep {A : Type} {R : A → A → Prop} {f : A → A}
|
2014-08-20 22:49:44 +00:00
|
|
|
(H1 : ∀a, R a (f a)) (H2 : ∀a b, R a b ↔ R a a ∧ R b b ∧ f a = f b) (a : A) :
|
|
|
|
R (f a) (f a) :=
|
2014-09-05 01:41:06 +00:00
|
|
|
representative_map_idempotent H1 H2 a ▸ H1 (f a)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem representative_map_image_fix {A : Type} {R : A → A → Prop} {f : A → A}
|
2014-08-20 22:49:44 +00:00
|
|
|
(H1 : ∀a, R a (f a)) (H2 : ∀a a', R a a' ↔ R a a ∧ R a' a' ∧ f a = f a') (b : image f) :
|
|
|
|
f (elt_of b) = elt_of b :=
|
2014-08-17 21:41:23 +00:00
|
|
|
idempotent_image_fix (representative_map_idempotent H1 H2) b
|
|
|
|
|
|
|
|
theorem representative_map_to_quotient {A : Type} {R : A → A → Prop} {f : A → A}
|
2014-08-20 22:49:44 +00:00
|
|
|
(H1 : ∀a, R a (f a)) (H2 : ∀a a', R a a' ↔ R a a ∧ R a' a' ∧ f a = f a') :
|
2014-08-26 16:01:17 +00:00
|
|
|
is_quotient R (fun_image f) elt_of :=
|
2014-08-22 01:24:22 +00:00
|
|
|
let abs := fun_image f in
|
2014-08-17 21:41:23 +00:00
|
|
|
intro
|
|
|
|
(take u : image f,
|
|
|
|
obtain (a : A) (Ha : f a = elt_of u), from image_elt_of u,
|
|
|
|
have H : elt_of (abs (elt_of u)) = elt_of u, from
|
|
|
|
calc
|
|
|
|
elt_of (abs (elt_of u)) = f (elt_of u) : elt_of_fun_image _ _
|
2014-09-05 01:41:06 +00:00
|
|
|
... = f (f a) : {Ha⁻¹}
|
2014-08-17 21:41:23 +00:00
|
|
|
... = f a : representative_map_idempotent H1 H2 a
|
|
|
|
... = elt_of u : Ha,
|
2014-09-05 05:31:52 +00:00
|
|
|
show abs (elt_of u) = u, from subtype.equal H)
|
2014-08-17 21:41:23 +00:00
|
|
|
(take u : image f,
|
|
|
|
show R (elt_of u) (elt_of u), from
|
|
|
|
obtain (a : A) (Ha : f a = elt_of u), from image_elt_of u,
|
2014-09-05 01:41:06 +00:00
|
|
|
Ha ▸ (@representative_map_refl_rep A R f H1 H2 a))
|
2014-08-22 01:24:22 +00:00
|
|
|
(take a a',
|
2014-08-20 22:49:44 +00:00
|
|
|
subst (fun_image_eq f a a') (H2 a a'))
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem representative_map_equiv_inj {A : Type} {R : A → A → Prop}
|
2014-08-22 01:24:22 +00:00
|
|
|
(equiv : is_equivalence R) {f : A → A}
|
|
|
|
(H1 : ∀a, R a (f a)) (H2 : ∀a b, R a b → f a = f b) {a b : A} (H3 : f a = f b) :
|
2014-08-20 22:49:44 +00:00
|
|
|
R a b :=
|
2014-11-19 01:32:22 +00:00
|
|
|
have symmR : relation.symmetric R, from rel_symm R,
|
|
|
|
have transR : relation.transitive R, from rel_trans R,
|
2014-08-17 21:41:23 +00:00
|
|
|
show R a b, from
|
2014-09-05 01:41:06 +00:00
|
|
|
have H2 : R a (f b), from H3 ▸ (H1 a),
|
2014-08-20 02:32:44 +00:00
|
|
|
have H3 : R (f b) b, from symmR (H1 b),
|
|
|
|
transR H2 H3
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
theorem representative_map_to_quotient_equiv {A : Type} {R : A → A → Prop}
|
2014-08-20 22:49:44 +00:00
|
|
|
(equiv : is_equivalence R) {f : A → A} (H1 : ∀a, R a (f a)) (H2 : ∀a b, R a b → f a = f b) :
|
|
|
|
@is_quotient A (image f) R (fun_image f) elt_of :=
|
2014-08-17 21:41:23 +00:00
|
|
|
representative_map_to_quotient
|
|
|
|
H1
|
|
|
|
(take a b,
|
2014-08-20 22:49:44 +00:00
|
|
|
have reflR : reflexive R, from rel_refl R,
|
2014-08-17 21:41:23 +00:00
|
|
|
have H3 : f a = f b → R a b, from representative_map_equiv_inj equiv H1 H2,
|
2014-09-05 04:25:21 +00:00
|
|
|
have H4 : R a b ↔ f a = f b, from iff.intro (H2 a b) H3,
|
2014-08-17 21:41:23 +00:00
|
|
|
have H5 : R a b ↔ R b b ∧ f a = f b,
|
2014-08-20 22:49:44 +00:00
|
|
|
from subst (symm (and_absorb_left _ (reflR b))) H4,
|
|
|
|
subst (symm (and_absorb_left _ (reflR a))) H5)
|
2014-08-17 21:41:23 +00:00
|
|
|
|
|
|
|
end quotient
|