2015-04-04 04:20:19 +00:00
|
|
|
/-
|
|
|
|
Copyright (c) 2015 Floris van Doorn. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
Authors: Floris van Doorn
|
|
|
|
|
|
|
|
Declaration of the primitive hits in Lean
|
|
|
|
-/
|
|
|
|
|
|
|
|
prelude
|
|
|
|
|
2015-05-22 08:35:38 +00:00
|
|
|
import .trunc .pathover
|
2015-04-04 04:20:19 +00:00
|
|
|
|
|
|
|
open is_trunc eq
|
|
|
|
|
2015-04-07 01:01:08 +00:00
|
|
|
/-
|
2015-04-10 01:45:18 +00:00
|
|
|
We take two higher inductive types (hits) as primitive notions in Lean. We define all other hits
|
|
|
|
in terms of these two hits. The hits which are primitive are
|
2015-04-07 01:01:08 +00:00
|
|
|
- n-truncation
|
2015-06-17 19:58:58 +00:00
|
|
|
- quotients (not truncated)
|
2015-04-07 01:01:08 +00:00
|
|
|
For each of the hits we add the following constants:
|
|
|
|
- the type formation
|
|
|
|
- the term and path constructors
|
|
|
|
- the dependent recursor
|
2015-04-19 21:56:24 +00:00
|
|
|
We add the computation rule for point constructors judgmentally to the kernel of Lean.
|
|
|
|
The computation rules for the path constructors are added (propositionally) as axioms
|
2015-04-07 01:01:08 +00:00
|
|
|
|
|
|
|
In this file we only define the dependent recursor. For the nondependent recursor and all other
|
2015-04-19 21:56:24 +00:00
|
|
|
uses of these hits, see the folder ../hit/
|
2015-04-07 01:01:08 +00:00
|
|
|
-/
|
|
|
|
|
2015-04-04 04:20:19 +00:00
|
|
|
constant trunc.{u} (n : trunc_index) (A : Type.{u}) : Type.{u}
|
|
|
|
|
|
|
|
namespace trunc
|
|
|
|
constant tr {n : trunc_index} {A : Type} (a : A) : trunc n A
|
|
|
|
constant is_trunc_trunc (n : trunc_index) (A : Type) : is_trunc n (trunc n A)
|
|
|
|
|
|
|
|
attribute is_trunc_trunc [instance]
|
|
|
|
|
2015-04-23 22:27:56 +00:00
|
|
|
protected constant rec {n : trunc_index} {A : Type} {P : trunc n A → Type}
|
2015-04-04 04:20:19 +00:00
|
|
|
[Pt : Πaa, is_trunc n (P aa)] (H : Πa, P (tr a)) : Πaa, P aa
|
|
|
|
|
2015-05-21 03:37:43 +00:00
|
|
|
protected definition rec_on [reducible] {n : trunc_index} {A : Type}
|
|
|
|
{P : trunc n A → Type} (aa : trunc n A) [Pt : Πaa, is_trunc n (P aa)] (H : Πa, P (tr a))
|
|
|
|
: P aa :=
|
2015-04-04 04:20:19 +00:00
|
|
|
trunc.rec H aa
|
|
|
|
end trunc
|
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
constant quotient.{u v} {A : Type.{u}} (R : A → A → Type.{v}) : Type.{max u v}
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
namespace quotient
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
constant class_of {A : Type} (R : A → A → Type) (a : A) : quotient R
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-23 16:47:52 +00:00
|
|
|
constant eq_of_rel {A : Type} (R : A → A → Type) ⦃a a' : A⦄ (H : R a a')
|
2015-04-11 00:33:33 +00:00
|
|
|
: class_of R a = class_of R a'
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
protected constant rec {A : Type} {R : A → A → Type} {P : quotient R → Type}
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pc : Π(a : A), P (class_of R a)) (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel R H] Pc a')
|
2015-06-04 19:57:00 +00:00
|
|
|
(x : quotient R) : P x
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
protected definition rec_on [reducible] {A : Type} {R : A → A → Type} {P : quotient R → Type}
|
|
|
|
(x : quotient R) (Pc : Π(a : A), P (class_of R a))
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel R H] Pc a') : P x :=
|
2015-06-04 19:57:00 +00:00
|
|
|
quotient.rec Pc Pp x
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
end quotient
|
2015-04-23 22:27:56 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
init_hits -- Initialize builtin computational rules for trunc and quotient
|
2015-04-23 22:27:56 +00:00
|
|
|
|
|
|
|
namespace trunc
|
|
|
|
definition rec_tr [reducible] {n : trunc_index} {A : Type} {P : trunc n A → Type}
|
|
|
|
[Pt : Πaa, is_trunc n (P aa)] (H : Πa, P (tr a)) (a : A) : trunc.rec H (tr a) = H a :=
|
|
|
|
idp
|
|
|
|
end trunc
|
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
namespace quotient
|
|
|
|
definition rec_class_of {A : Type} {R : A → A → Type} {P : quotient R → Type}
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pc : Π(a : A), P (class_of R a)) (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel R H] Pc a')
|
2015-06-04 19:57:00 +00:00
|
|
|
(a : A) : quotient.rec Pc Pp (class_of R a) = Pc a :=
|
2015-04-23 22:27:56 +00:00
|
|
|
idp
|
2015-04-04 04:20:19 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
constant rec_eq_of_rel {A : Type} {R : A → A → Type} {P : quotient R → Type}
|
2015-05-22 08:35:38 +00:00
|
|
|
(Pc : Π(a : A), P (class_of R a)) (Pp : Π⦃a a' : A⦄ (H : R a a'), Pc a =[eq_of_rel R H] Pc a')
|
2015-06-04 19:57:00 +00:00
|
|
|
{a a' : A} (H : R a a') : apdo (quotient.rec Pc Pp) (eq_of_rel R H) = Pp H
|
|
|
|
end quotient
|
2015-05-07 20:35:14 +00:00
|
|
|
|
2015-06-04 19:57:00 +00:00
|
|
|
attribute quotient.class_of trunc.tr [constructor]
|
|
|
|
attribute quotient.rec trunc.rec [unfold-c 6]
|
|
|
|
attribute quotient.rec_on trunc.rec_on [unfold-c 4]
|