PreSheaf.PreSheaf
PreSheaf.Terminal
PreSheaf.PullBack
PreSheaf.Morphisms
.
Local Axiom ConstructiveIndefiniteDescription_Type :
forall T : Type, ConstructiveIndefiniteDescription_on T.
Require Coq.Logic.ClassicalFacts.
Local Axiom PropExt : ClassicalFacts.prop_extensionality.
Section Sieve.
Context {C : Category} (c : C).
Local Open Scope morphism_scope.
(** A sive on c (an object of C) is a set of morphisms h : x –≻ c that is closed under pre-composition. In other words, if h : x –≻ c is in the sieve and h' : y –≻ x is another morphism, we have (h ∘ h') is also in the sieve. *)
Definition Sieve :=
{S : ∀ (x : C) (h : x –≻ c), Prop |
∀ (x : C) (h : x –≻ c), S x h → ∀ (y : C) (h' : y –≻ x), S y (h ∘ h')
}.
(** The total sieve is the sieve that contains all morphism ending in c. *)
Definition TotalSieve : Sieve :=
exist
(fun S : ∀ x : C, (x –≻ c) → Prop =>
∀ (x : C) (h : x –≻ c), S x h → ∀ (y : C) (h' : y –≻ x), S y (h ∘ h'))
(fun _ _ => True)
(fun _ _ _ _ _ => I)
.
End Sieve.
(** The presheaf that maps each object to the set of its sieves. *)
Section Sieve_PreSheaf.
Context (C : Category).
Local Open Scope morphism_scope.
Program Definition Sieve_PreSheaf : PreSheaf C :=
{|
FO := fun c => @Sieve C c;
FA :=
fun c c' h S =>
exist _ (fun y (h' : y –≻ c') => (proj1_sig S) _ (h ∘ h')) _
|}
.
Local Obligation Tactic := idtac.
Next Obligation.
Next Obligation.
Next Obligation.
(** The true presheaf morphism. The presheaf morphism that maps each object to its total sieve. *)
Program Definition True_PreSheaf_morphism :
((PSh_Term_PreSheaf C) –≻ Sieve_PreSheaf)%nattrans
:=
{|
Trans := fun c _ => @TotalSieve C c
|}.
Local Hint Extern 1 => progress cbn.
Next Obligation.
Next Obligation.
End Sieve_PreSheaf.
Section PShCat_char_morph.
Context
{C : Category}
{F G : PreSheaf C}
(N : @Monic (PShCat C) F G)
.
Local Obligation Tactic := idtac.
(** The characteristic morphism of a presheaf morphism. *)
Program Definition PShCat_char_morph : (G –≻ (Sieve_PreSheaf C))%nattrans :=
{|
Trans :=
fun c x =>
exist
_
(fun y h => ∃ u, Trans (mono_morphism N) y u = (G _a h)%morphism x)
_
|}
.
Next Obligation.
Next Obligation.
Next Obligation.
Section PShCat_char_morph_forms_pullback_morph_ex.
Context
(p : PreSheaf C)
(pm1 : (p –≻ G)%nattrans)
(pm2 : (p –≻ PSh_Term_PreSheaf C)%nattrans)
(H : (PShCat_char_morph ∘ pm1)%nattrans =
(True_PreSheaf_morphism C ∘ pm2)%nattrans)
.
(** The map underlying PShCat_char_morph_forms_pullback_morph_ex. *)
Definition PShCat_char_morph_forms_pullback_morph_ex_Trans
(c : C)
(x : (p _o c)%object)
:
(F _o c)%object
:=
proj1_sig
(
ConstructiveIndefiniteDescription_Type
_
_
(
match
eq_sym
(
f_equal
(
fun w : (p –≻ Sieve_PreSheaf C)%nattrans =>
proj1_sig (Trans w c x) c id
) H
)
in _ = W return W
with
eq_refl => I
end
)
)
.
(** The presheaf morphism from a presheaf that is a candidate pullback of the characteristic presheaf morphism of N and the true presheaf morphism to F (the domain of the monomorphism N). *)
Program Definition PShCat_char_morph_forms_pullback_morph_ex :
(p –≻ F)%nattrans
:=
{|
Trans := PShCat_char_morph_forms_pullback_morph_ex_Trans
|}.
Next Obligation.
Next Obligation.
End PShCat_char_morph_forms_pullback_morph_ex.
Local Hint Extern 1 => match goal with
[|- context [(?F _a id)%morphism]] => rewrite (F_id F)
end.
Local Hint Extern 1 => apply PropExt; intuition.
Local Hint Extern 1 =>
match goal with
[ f : (?d –≻ ?c)%morphism,
x : (?F _o)%object ?c |- ∃ _ : (?F _o)%object ?d, _] =>
exists (F _a f x)%morphism
end.
Local Hint Extern 1 =>
match goal with
[|- context [Trans ?f _ ((?F _a)%morphism ?h _)]] =>
cbn_rewrite (equal_f (Trans_com f h))
end.
Local Hint Extern 1 => apply sig_proof_irrelevance.
Local Hint Extern 1 => progress cbn in *.
Local Hint Extern 1 =>
match goal with
[|- context [proj1_sig ?A]] =>
let x := fresh "x" in
let H := fresh "H" in
destruct A as [x H]; cbn;
try rewrite H
end
.
Local Hint Extern 1 => unfold PShCat_char_morph_forms_pullback_morph_ex_Trans.
Local Hint Extern 1 => match goal with
[|- ?A = ?B :> unit] => try destruct A;
try destruct B; trivial; fail
end.
Local Obligation Tactic := basic_simpl; auto 7.
Program Definition PShCat_char_morph_forms_pullback :
is_PullBack
(mono_morphism N) (t_morph (PSh_Terminal C) F)
PShCat_char_morph (True_PreSheaf_morphism C)
:=
{|
is_pullback_morph_ex := PShCat_char_morph_forms_pullback_morph_ex
|}
.
Local Obligation Tactic := idtac.
Next Obligation.
End PShCat_char_morph.
(** Sieves as defined above  form the sub-object classifier for presheaves. With ⊤ mapping the the total sieve. *)
Section PShCat_char_morph_unique.
Context
{C : Category}
{F G : PreSheaf C}
(N : @Monic (PShCat C) F G)
(M : (G –≻ (Sieve_PreSheaf C))%nattrans)
(hpb : is_PullBack
(mono_morphism N) (t_morph (PSh_Terminal C) F)
M (True_PreSheaf_morphism C)
).

(* Specifications: *)
Theorem PShCat_char_morph_unique : M = (PShCat_char_morph N).
End PShCat_char_morph_unique.