2014-08-20 02:32:44 +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-10-05 17:50:13 +00:00
|
|
|
import algebra.relation logic.nonempty data.subtype
|
2014-08-20 02:32:44 +00:00
|
|
|
import logic.axioms.classical logic.axioms.hilbert logic.axioms.funext
|
2014-10-05 17:50:13 +00:00
|
|
|
import .basic
|
2014-08-20 02:32:44 +00:00
|
|
|
|
|
|
|
namespace quotient
|
|
|
|
|
2014-09-03 23:00:38 +00:00
|
|
|
open relation nonempty subtype
|
2014-08-20 02:32:44 +00:00
|
|
|
|
|
|
|
-- abstract quotient
|
|
|
|
-- -----------------
|
|
|
|
|
|
|
|
definition prelim_map {A : Type} (R : A → A → Prop) (a : A) :=
|
|
|
|
-- TODO: it is interesting how the elaborator fails here
|
|
|
|
-- epsilon (fun b, R a b)
|
2014-09-04 23:36:06 +00:00
|
|
|
@epsilon _ (nonempty.intro a) (fun b, R a b)
|
2014-08-20 02:32:44 +00:00
|
|
|
|
|
|
|
-- TODO: only needed R reflexive (or weaker: R a a)
|
|
|
|
theorem prelim_map_rel {A : Type} {R : A → A → Prop} (H : is_equivalence R) (a : A)
|
|
|
|
: R a (prelim_map R a) :=
|
2014-11-28 15:20:52 +00:00
|
|
|
have reflR : reflexive R, from is_equivalence.refl R,
|
2014-08-20 02:32:44 +00:00
|
|
|
epsilon_spec (exists_intro a (reflR a))
|
|
|
|
|
|
|
|
-- TODO: only needed: R PER
|
|
|
|
theorem prelim_map_congr {A : Type} {R : A → A → Prop} (H1 : is_equivalence R) {a b : A}
|
|
|
|
(H2 : R a b) : prelim_map R a = prelim_map R b :=
|
2014-11-28 15:20:52 +00:00
|
|
|
have symmR : relation.symmetric R, from is_equivalence.symm R,
|
|
|
|
have transR : relation.transitive R, from is_equivalence.trans R,
|
2014-08-20 02:32:44 +00:00
|
|
|
have H3 : ∀c, R a c ↔ R b c, from
|
|
|
|
take c,
|
2014-09-05 04:25:21 +00:00
|
|
|
iff.intro
|
2014-08-20 02:32:44 +00:00
|
|
|
(assume H4 : R a c, transR (symmR H2) H4)
|
|
|
|
(assume H4 : R b c, transR H2 H4),
|
2014-10-28 23:08:39 +00:00
|
|
|
have H4 : (fun c, R a c) = (fun c, R b c), from
|
|
|
|
funext (take c, iff_to_eq (H3 c)),
|
|
|
|
have H5 [visible] : nonempty A, from
|
|
|
|
nonempty.intro a,
|
|
|
|
show epsilon (λc, R a c) = epsilon (λc, R b c), from
|
|
|
|
congr_arg _ H4
|
2014-08-20 02:32:44 +00:00
|
|
|
|
|
|
|
definition quotient {A : Type} (R : A → A → Prop) : Type := image (prelim_map R)
|
|
|
|
|
|
|
|
definition quotient_abs {A : Type} (R : A → A → Prop) : A → quotient R :=
|
|
|
|
fun_image (prelim_map R)
|
|
|
|
|
|
|
|
definition quotient_elt_of {A : Type} (R : A → A → Prop) : quotient R → A := elt_of
|
|
|
|
|
|
|
|
-- TODO: I had to make is_quotient transparent -- change this?
|
|
|
|
theorem quotient_is_quotient {A : Type} (R : A → A → Prop) (H : is_equivalence R)
|
|
|
|
: is_quotient R (quotient_abs R) (quotient_elt_of R) :=
|
|
|
|
representative_map_to_quotient_equiv
|
|
|
|
H
|
|
|
|
(prelim_map_rel H)
|
|
|
|
(@prelim_map_congr _ _ H)
|
|
|
|
|
|
|
|
end quotient
|