feat(hit): add elimination rule to propositions

This commit is contained in:
Floris van Doorn 2015-11-20 17:47:11 -05:00 committed by Leonardo de Moura
parent 5b8486a34f
commit 5328486d49
6 changed files with 63 additions and 16 deletions

View file

@ -41,7 +41,7 @@ namespace algebra
local postfix ⁻¹ := trunc_inv local postfix ⁻¹ := trunc_inv
local infix * := trunc_mul local infix * := trunc_mul
definition trunc_mul_assoc [unfold 9 10 11] (g₁ g₂ g₃ : G) : g₁ * g₂ * g₃ = g₁ * (g₂ * g₃) := theorem trunc_mul_assoc (g₁ g₂ g₃ : G) : g₁ * g₂ * g₃ = g₁ * (g₂ * g₃) :=
begin begin
apply trunc.rec_on g₁, intro p₁, apply trunc.rec_on g₁, intro p₁,
apply trunc.rec_on g₂, intro p₂, apply trunc.rec_on g₂, intro p₂,
@ -49,25 +49,25 @@ namespace algebra
exact ap tr !mul_assoc, exact ap tr !mul_assoc,
end end
definition trunc_one_mul [unfold 9] (g : G) : 1 * g = g := theorem trunc_one_mul (g : G) : 1 * g = g :=
begin begin
apply trunc.rec_on g, intro p, apply trunc.rec_on g, intro p,
exact ap tr !one_mul exact ap tr !one_mul
end end
definition trunc_mul_one [unfold 9] (g : G) : g * 1 = g := theorem trunc_mul_one (g : G) : g * 1 = g :=
begin begin
apply trunc.rec_on g, intro p, apply trunc.rec_on g, intro p,
exact ap tr !mul_one exact ap tr !mul_one
end end
definition trunc_mul_left_inv [unfold 9] (g : G) : g⁻¹ * g = 1 := theorem trunc_mul_left_inv (g : G) : g⁻¹ * g = 1 :=
begin begin
apply trunc.rec_on g, intro p, apply trunc.rec_on g, intro p,
exact ap tr !mul_left_inv exact ap tr !mul_left_inv
end end
definition trunc_mul_comm [unfold 10 11] (mul_comm : ∀a b, mul a b = mul b a) (g h : G) theorem trunc_mul_comm (mul_comm : ∀a b, mul a b = mul b a) (g h : G)
: g * h = h * g := : g * h = h * g :=
begin begin
apply trunc.rec_on g, intro p, apply trunc.rec_on g, intro p,

View file

@ -8,7 +8,7 @@ Declaration of the coequalizer
import .quotient import .quotient
open quotient eq equiv equiv.ops open quotient eq equiv equiv.ops is_trunc
namespace coeq namespace coeq
section section
@ -74,6 +74,13 @@ parameters {A B : Type.{u}} (f g : A → B)
(x : A) : transport (elim_type P_i Pcp) (cp x) = Pcp x := (x : A) : transport (elim_type P_i Pcp) (cp x) = Pcp x :=
by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_cp];apply cast_ua_fn by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_cp];apply cast_ua_fn
protected definition rec_hprop {P : coeq → Type} [H : Πx, is_hprop (P x)]
(P_i : Π(x : B), P (coeq_i x)) (y : coeq) : P y :=
rec P_i (λa, !is_hprop.elimo) y
protected definition elim_hprop {P : Type} [H : is_hprop P] (P_i : B → P) (y : coeq) : P :=
elim P_i (λa, !is_hprop.elim) y
end end
end coeq end coeq

View file

@ -7,7 +7,7 @@ Definition of general colimits and sequential colimits.
-/ -/
/- definition of a general colimit -/ /- definition of a general colimit -/
open eq nat quotient sigma equiv equiv.ops open eq nat quotient sigma equiv equiv.ops is_trunc
namespace colimit namespace colimit
section section
@ -85,6 +85,14 @@ section
{j : J} (x : A (dom j)) : transport (elim_type Pincl Pglue) (cglue j x) = Pglue j x := {j : J} (x : A (dom j)) : transport (elim_type Pincl Pglue) (cglue j x) = Pglue j x :=
by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_cglue];apply cast_ua_fn by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_cglue];apply cast_ua_fn
protected definition rec_hprop {P : colimit → Type} [H : Πx, is_hprop (P x)]
(Pincl : Π⦃i : I⦄ (x : A i), P (ι x)) (y : colimit) : P y :=
rec Pincl (λa b, !is_hprop.elimo) y
protected definition elim_hprop {P : Type} [H : is_hprop P] (Pincl : Π⦃i : I⦄ (x : A i), P)
(y : colimit) : P :=
elim Pincl (λa b, !is_hprop.elim) y
end end
end colimit end colimit
@ -167,6 +175,15 @@ section
: transport (elim_type Pincl Pglue) (glue a) = Pglue a := : transport (elim_type Pincl Pglue) (glue a) = Pglue a :=
by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_glue];apply cast_ua_fn by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_glue];apply cast_ua_fn
protected definition rec_hprop {P : seq_colim → Type} [H : Πx, is_hprop (P x)]
(Pincl : Π⦃n : ℕ⦄ (a : A n), P (sι a)) (aa : seq_colim) : P aa :=
rec Pincl (λa b, !is_hprop.elimo) aa
protected definition elim_hprop {P : Type} [H : is_hprop P] (Pincl : Π⦃n : ℕ⦄ (a : A n), P)
: seq_colim → P :=
elim Pincl (λa b, !is_hprop.elim)
end end
end seq_colim end seq_colim

View file

@ -8,7 +8,7 @@ Declaration of the pushout
import .quotient cubical.square import .quotient cubical.square
open quotient eq sum equiv equiv.ops open quotient eq sum equiv equiv.ops is_trunc
namespace pushout namespace pushout
section section
@ -83,6 +83,14 @@ parameters {TL BL TR : Type} (f : TL → BL) (g : TL → TR)
: transport (elim_type Pinl Pinr Pglue) (glue x) = Pglue x := : transport (elim_type Pinl Pinr Pglue) (glue x) = Pglue x :=
by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_glue];apply cast_ua_fn by rewrite [tr_eq_cast_ap_fn,↑elim_type,elim_glue];apply cast_ua_fn
protected definition rec_hprop {P : pushout → Type} [H : Πx, is_hprop (P x)]
(Pinl : Π(x : BL), P (inl x)) (Pinr : Π(x : TR), P (inr x)) (y : pushout) :=
rec Pinl Pinr (λx, !is_hprop.elimo) y
protected definition elim_hprop {P : Type} [H : is_hprop P] (Pinl : BL → P) (Pinr : TR → P)
(y : pushout) : P :=
elim Pinl Pinr (λa, !is_hprop.elim) y
end end
end pushout end pushout

View file

@ -16,7 +16,7 @@ See also .set_quotient
import arity cubical.squareover types.arrow cubical.pathover2 import arity cubical.squareover types.arrow cubical.pathover2
open eq equiv sigma sigma.ops equiv.ops pi open eq equiv sigma sigma.ops equiv.ops pi is_trunc
namespace quotient namespace quotient
@ -38,6 +38,13 @@ namespace quotient
rewrite [▸*,-apdo_eq_pathover_of_eq_ap,↑quotient.elim,rec_eq_of_rel], rewrite [▸*,-apdo_eq_pathover_of_eq_ap,↑quotient.elim,rec_eq_of_rel],
end end
protected definition rec_hprop {A : Type} {R : A → A → Type} {P : quotient R → Type}
[H : Πx, is_hprop (P x)] (Pc : Π(a : A), P (class_of R a)) (x : quotient R) : P x :=
quotient.rec Pc (λa a' H, !is_hprop.elimo) x
protected definition elim_hprop {P : Type} [H : is_hprop P] (Pc : A → P) (x : quotient R) : P :=
quotient.elim Pc (λa a' H, !is_hprop.elim) x
protected definition elim_type (Pc : A → Type) protected definition elim_type (Pc : A → Type)
(Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a ≃ Pc a') : quotient R → Type := (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a ≃ Pc a') : quotient R → Type :=
quotient.elim Pc (λa a' H, ua (Pp H)) quotient.elim Pc (λa a' H, ua (Pp H))

View file

@ -63,6 +63,14 @@ section
rewrite [▸*,-apdo_eq_pathover_of_eq_ap,↑elim,rec_eq_of_rel], rewrite [▸*,-apdo_eq_pathover_of_eq_ap,↑elim,rec_eq_of_rel],
end end
protected definition rec_hprop {P : set_quotient → Type} [Pt : Πaa, is_hprop (P aa)]
(Pc : Π(a : A), P (class_of a)) (x : set_quotient) : P x :=
rec Pc (λa a' H, !is_hprop.elimo) x
protected definition elim_hprop {P : Type} [Pt : is_hprop P] (Pc : A → P) (x : set_quotient)
: P :=
elim Pc (λa a' H, !is_hprop.elim) x
/- /-
there are no theorems to eliminate to the universe here, there are no theorems to eliminate to the universe here,
because the universe is generally not a set because the universe is generally not a set
@ -98,7 +106,8 @@ namespace set_quotient
intro a a' r, apply eq_pathover, apply hdeg_square, apply elim_eq_of_rel} intro a a' r, apply eq_pathover, apply hdeg_square, apply elim_eq_of_rel}
end end
definition code [unfold 4] (a : A) (x : set_quotient R) [H : is_equivalence R] : hprop := protected definition code [unfold 4] (a : A) (x : set_quotient R) [H : is_equivalence R]
: hprop :=
set_quotient.elim_on x (R a) set_quotient.elim_on x (R a)
begin begin
intros a' a'' H1, intros a' a'' H1,
@ -109,22 +118,22 @@ namespace set_quotient
{ intro H2, apply is_transitive.trans R H2, exact is_symmetric.symm R H1} { intro H2, apply is_transitive.trans R H2, exact is_symmetric.symm R H1}
end end
definition encode {a : A} {x : set_quotient R} (p : class_of a = x) protected definition encode {a : A} {x : set_quotient R} (p : class_of a = x)
[H : is_equivalence R] : code R a x := [H : is_equivalence R] : set_quotient.code R a x :=
begin begin
induction p, esimp, apply is_reflexive.refl R induction p, esimp, apply is_reflexive.refl R
end end
definition rel_of_eq {a a' : A} (p : class_of a = class_of a' :> set_quotient R) definition rel_of_eq {a a' : A} (p : class_of a = class_of a' :> set_quotient R)
[H : is_equivalence R] : R a a' := [H : is_equivalence R] : R a a' :=
encode R p set_quotient.encode R p
variables {R S T} variables {R S T}
definition quotient_unary_map (f : A → B) (H : Π{a a'} (r : R a a'), S (f a) (f a')) : definition quotient_unary_map [unfold 7] (f : A → B) (H : Π{a a'} (r : R a a'), S (f a) (f a')) :
set_quotient R → set_quotient S := set_quotient R → set_quotient S :=
set_quotient.elim (class_of ∘ f) (λa a' r, eq_of_rel (H r)) set_quotient.elim (class_of ∘ f) (λa a' r, eq_of_rel (H r))
definition quotient_binary_map (f : A → B → C) definition quotient_binary_map [unfold 10 11] (f : A → B → C)
(H : Π{a a'} (r : R a a') {b b'} (s : S b b'), T (f a b) (f a' b')) (H : Π{a a'} (r : R a a') {b b'} (s : S b b'), T (f a b) (f a' b'))
[HR : is_reflexive R] [HS : is_reflexive S] : [HR : is_reflexive R] [HS : is_reflexive S] :
set_quotient R → set_quotient S → set_quotient T := set_quotient R → set_quotient S → set_quotient T :=
@ -138,5 +147,4 @@ namespace set_quotient
{ intro b b' s, apply eq_pathover, esimp, apply is_hset.elims}} { intro b b' s, apply eq_pathover, esimp, apply is_hset.elims}}
end end
end set_quotient end set_quotient