Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set Implicit Arguments.
- Ltac hypothesis := match goal with [ H : _ |- _ ] => apply H end.
- Inductive False : Type :=.
- Definition Not (P : Type) := P -> False.
- Inductive True : Type :=
- | I : True.
- Inductive Identity (T : Type) (t : T) : T -> Type :=
- | identical : Identity t t.
- Inductive And (P Q : Type) : Type :=
- | both : P -> Q -> And P Q.
- Inductive Or (P Q : Type) : Type :=
- | inleft : P -> Or P Q
- | inright : Q -> Or P Q.
- Definition Decidible (P : Type) := Or P (Not P).
- Definition And_idem (P : Type) : P -> And P P.
- intro p; apply (both p p).
- Defined.
- Inductive Sigma (T : Type) (P : T -> Type) : Type :=
- | witness : forall t : T, P t -> Sigma P.
- Definition Relation (T : Type) := T -> T -> Type.
- Record Equivalence {T : Type} (R : Relation T)
- := { equivalence_reflexivity : forall x, R x x
- ; equivalence_symmetry : forall x y, R x y -> R y x
- ; equivalence_transitivity : forall x y z, R x y -> R y z -> R x z
- }.
- Theorem Equivalence_Identity {T : Type} : Equivalence (@Identity T).
- apply Build_Equivalence.
- intros; constructor.
- intros; elim H; constructor.
- intros; elim H0; elim H; constructor.
- Defined.
- Record Category (Ob : Type) (Hom : Ob -> Ob -> Type)
- (Hom_eq : forall X Y, Relation (Hom X Y))
- := { identity : forall X, Hom X X
- ; compose : forall X Y Z, Hom X Y -> Hom Y Z -> Hom X Z
- ; compose_respectful_left : forall X Y Z (f f' : Hom X Y) (g : Hom Y Z),
- Hom_eq _ _ f f' -> Hom_eq _ _ (compose f g) (compose f' g)
- ; compose_respectful_right : forall X Y Z (f : Hom X Y) (g g' : Hom Y Z),
- Hom_eq _ _ g g' -> Hom_eq _ _ (compose f g) (compose f g')
- ; hom_equivalence : forall X Y, Equivalence (Hom_eq X Y)
- ; category_left_identity : forall X Y (f : Hom X Y),
- Hom_eq _ _ (compose (identity _) f) f
- ; category_right_identity : forall X Y (f : Hom X Y),
- Hom_eq _ _ (compose f (identity _)) f
- ; category_associativity : forall X Y Z W (f : Hom X Y) (g : Hom Y Z) (h : Hom Z W),
- Hom_eq _ _ (compose f (compose g h))
- (compose (compose f g) h)
- }.
- Notation "f '[' C ']' g" := (compose C _ _ _ f g) (at level 20).
- Notation "'1_' C" := (identity C _) (at level 20).
- Ltac refl :=
- eapply equivalence_reflexivity;
- [apply hom_equivalence;assumption].
- Ltac symm :=
- eapply equivalence_symmetry;
- [apply hom_equivalence;assumption|idtac].
- Ltac trans :=
- eapply equivalence_transitivity;
- [apply hom_equivalence;assumption|idtac|idtac].
- Section Isomorphism.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Definition Isomorphism (X Y : C_Ob) :=
- @Sigma (And (C_Hom X Y) (C_Hom Y X))
- (fun fg =>
- match fg with
- | both f g =>
- And (C_Hom_eq (compose C _ _ _ g f) (identity C _))
- (C_Hom_eq (compose C _ _ _ f g) (identity C _))
- end).
- Definition isomorphism_to (X Y : C_Ob) (i : Isomorphism X Y) : C_Hom X Y.
- destruct i as [[to from] _]; apply to.
- Defined.
- Definition isomorphism_from (X Y : C_Ob) (i : Isomorphism X Y) : C_Hom Y X.
- destruct i as [[to from] _]; apply from.
- Defined.
- Theorem Isomorphism_Equivalence : Equivalence Isomorphism.
- apply Build_Equivalence.
- Lemma Isomorphism_Identity : forall x : C_Ob, Isomorphism x x.
- intro x; apply (witness _ (both (identity C x) (identity C x))).
- apply And_idem.
- apply category_left_identity.
- Defined.
- apply Isomorphism_Identity.
- intros x y [[I J] [i j]].
- apply (witness _ (both J I)).
- apply (both j i).
- Lemma Isomorphism_Compose : forall x y z : C_Ob, Isomorphism x y -> Isomorphism y z -> Isomorphism x z.
- intros x y z [[I J] [i j]] [[I' J'] [i' j']].
- apply (witness _ (both (compose C _ _ _ I I') (compose C _ _ _ J' J))).
- apply both.
- trans.
- apply (category_associativity C).
- trans.
- apply (compose_respectful_left C).
- trans.
- symm.
- apply (category_associativity C).
- apply (compose_respectful_right C).
- apply i.
- assert (C_Hom_eq (compose C z y y J' (identity C y))
- J').
- apply category_right_identity.
- trans.
- apply (compose_respectful_left C).
- apply X.
- assumption.
- trans.
- apply (category_associativity C).
- trans.
- apply (compose_respectful_left C).
- trans.
- symm.
- apply (category_associativity C).
- apply (compose_respectful_right C).
- apply j'.
- assert (C_Hom_eq (compose C x y y I (identity C y))
- I).
- apply category_right_identity.
- trans.
- apply (compose_respectful_left C).
- apply X.
- assumption.
- Defined.
- apply Isomorphism_Compose.
- Defined.
- End Isomorphism.
- Section Functor.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Context {D_Ob D_Hom D_Hom_eq} (D : @Category D_Ob D_Hom D_Hom_eq).
- Record Functor
- := { Map_Ob : C_Ob -> D_Ob
- ; Map_Hom : forall X Y, C_Hom X Y -> D_Hom (Map_Ob X) (Map_Ob Y)
- ; functor_identity : forall X, D_Hom_eq (Map_Hom (identity C X)) (identity D (Map_Ob X))
- ; functor_compose : forall X Y Z (f : C_Hom X Y) (g : C_Hom Y Z),
- D_Hom_eq (Map_Hom (compose C _ _ _ f g)) (compose D _ _ _ (Map_Hom f) (Map_Hom g))
- ; Map_Hom_respectful : forall X Y (f f' : C_Hom X Y),
- C_Hom_eq f f' -> D_Hom_eq (Map_Hom f) (Map_Hom f')
- }.
- Notation "F '@' x" := (Map_Ob F x) (at level 20).
- Notation "F '$' f" := (Map_Hom F f) (at level 20).
- Definition Functor_equality (F G : Functor) :=
- @Sigma (forall X : C_Ob,
- Isomorphism D (Map_Ob F X) (Map_Ob G X))
- (fun Ob_iso =>
- forall X Y (f : C_Hom X Y),
- D_Hom_eq (Map_Hom F f)
- (compose D _ _ _
- (isomorphism_to (Ob_iso _))
- (compose D _ _ _
- (Map_Hom G f)
- (isomorphism_from (Ob_iso _))))).
- Theorem Functor_equivalence : Equivalence Functor_equality.
- apply Build_Equivalence.
- intro x.
- unfold Functor_equality.
- apply witness with (t := (fun X => @Isomorphism_Identity _ _ _ D (Map_Ob x X))).
- intros X Y f.
- simpl.
- trans.
- symm.
- apply category_left_identity.
- apply compose_respectful_right.
- trans.
- symm.
- apply category_right_identity.
- apply compose_respectful_right.
- refl.
- intros F G.
- intros [F' F''].
- pose (Isomorphism_Equivalence D).
- pose (match e with
- | Build_Equivalence _ Isymm _ => Isymm
- end) as Isymm.
- unfold Functor_equality.
- apply (witness _ (fun X => Isymm _ _ (F' X))).
- intros X Y f.
- unfold Isymm in *; unfold e in *; simpl.
- generalize (F'' _ _ f).
- destruct (F' X); simpl.
- destruct t; simpl.
- destruct y; simpl.
- destruct (F' Y); simpl.
- destruct t; simpl.
- destruct y; simpl.
- intro.
- assert (
- D_Hom_eq (compose D _ _ _ d0 (compose D _ _ _ (Map_Hom F f) d3))
- (compose D _ _ _ d0 (compose D _ _ _
- (compose D (Map_Ob F X) (Map_Ob G X) (Map_Ob F Y) d
- (compose D (Map_Ob G X) (Map_Ob G Y) (Map_Ob F Y)
- (Map_Hom G f) d4)) d3))
- ).
- apply compose_respectful_right.
- apply compose_respectful_left.
- assumption.
- trans.
- Focus 2.
- symm.
- apply X1.
- (* Gf = (d0 ((d (Gf d4)) d3)) *)
- Lemma YUK
- (F : Functor)
- (G : Functor)
- (X : C_Ob)
- (Y : C_Ob)
- (f : C_Hom X Y)
- (d : D_Hom (F @ X) (G @ X))
- (d0 : D_Hom (G @ X) (F @ X))
- (d1 : D_Hom_eq (d0 [D] d) (identity D _))
- (d2 : D_Hom_eq (d [D] d0) (identity D _))
- (d3 : D_Hom (F @ Y) (G @ Y))
- (d4 : D_Hom (G @ Y) (F @ Y))
- (d5 : D_Hom_eq (d4 [D] d3) (identity D _))
- (d6 : D_Hom_eq (d3 [D] d4) (identity D _))
- (X0 : D_Hom_eq (F $ f) (d [D] ((G $ f) [D] d4)))
- (X1 : D_Hom_eq (d0 [D] ((F $ f) [D] d3))
- (d0 [D] ((d [D] ((G $ f) [D] d4)) [D] d3))) :
- D_Hom_eq (G $ f) (d0 [D] ((d [D] ((G $ f) [D] d4)) [D] d3)).
- cut (D_Hom_eq (G $ f) ((G $ f) [D] (identity D _))).
- cut (D_Hom_eq ((G $ f) [D] (identity D _)) ((G $ f) [D] (d4 [D] d3))).
- cut (D_Hom_eq ((G $ f) [D] (d4 [D] d3)) ((identity D _) [D] ((G $ f) [D] (d4 [D] d3)))).
- cut (D_Hom_eq ((identity D _) [D] ((G $ f) [D] (d4 [D] d3))) ((d0 [D] d) [D] ((G $ f) [D] (d4 [D] d3)))).
- cut (D_Hom_eq ((d0 [D] d) [D] ((G $ f) [D] (d4 [D] d3))) (d0 [D] (d [D] ((G $ f) [D] (d4 [D] d3))))).
- cut (D_Hom_eq (d0 [D] (d [D] ((G $ f) [D] (d4 [D] d3)))) (d0 [D] (d [D] (((G $ f) [D] d4) [D] d3)))).
- cut (D_Hom_eq (d0 [D] (d [D] (((G $ f) [D] d4) [D] d3))) (d0 [D] ((d [D] ((G $ f) [D] d4)) [D] d3))).
- intros.
- do 7 (trans;[hypothesis|]); refl.
- apply compose_respectful_right.
- apply (category_associativity D _ _ _ _ d ((G $ f) [D] d4) d3).
- do 2 apply compose_respectful_right.
- apply category_associativity.
- symm; apply category_associativity.
- apply compose_respectful_left.
- symm; assumption.
- symm; apply category_left_identity.
- apply compose_respectful_right.
- symm; assumption.
- symm; apply category_right_identity.
- Defined.
- apply YUK; assumption.
- intros x y z F G; unfold Functor_equality.
- destruct F.
- destruct G.
- pose (Isomorphism_Equivalence D).
- pose (match e with
- | Build_Equivalence _ _ Itrans => Itrans
- end) as Itrans.
- unfold Functor_equality.
- apply (witness _ (fun X => Itrans _ _ _ (t X) (t0 X))).
- intros; simpl.
- generalize (d X Y f).
- generalize (d0 X Y f).
- destruct (t X); simpl.
- destruct t1; destruct y0; simpl.
- destruct (t0 X); simpl.
- destruct t1; destruct y0; simpl.
- simpl.
- destruct (t Y); simpl.
- destruct t1; destruct y0; simpl.
- destruct (t0 Y); simpl.
- destruct t1; destruct y0; simpl.
- simpl.
- (* Xf = ((d1 d5)(Zf (d14 d10))) *)
- Lemma BLECH
- (F : Functor)
- (G : Functor)
- (H : Functor)
- (X : C_Ob)
- (Y : C_Ob)
- (f : C_Hom X Y)
- (d1 : D_Hom (F @ X) (G @ X))
- (d2 : D_Hom (G @ X) (F @ X))
- (d3 : D_Hom_eq (d2 [D] d1) (identity D _))
- (d4 : D_Hom_eq (d1 [D] d2) (identity D _))
- (d5 : D_Hom (G @ X) (H @ X))
- (d6 : D_Hom (H @ X) (G @ X))
- (d7 : D_Hom_eq (d6 [D] d5) (identity D _))
- (d8 : D_Hom_eq (d5 [D] d6) (identity D _))
- (d9 : D_Hom (F @ Y) (G @ Y))
- (d10 : D_Hom (G @ Y) (F @ Y))
- (d11 : D_Hom_eq (d10 [D] d9) (identity D _))
- (d12 : D_Hom_eq (d9 [D] d10) (identity D _))
- (d13 : D_Hom (G @ Y) (H @ Y))
- (d14 : D_Hom (H @ Y) (G @ Y))
- (d15 : D_Hom_eq (d14 [D] d13) (identity D _))
- (d16 : D_Hom_eq (d13 [D] d14) (identity D _))
- (WW : D_Hom_eq (F $ f) (d1 [D] ((G $ f) [D] d10)))
- (MM : D_Hom_eq (G $ f) (d5 [D] ((H $ f) [D] d14))) :
- D_Hom_eq (F $ f) ((d1 [D] d5) [D] ((H $ f) [D] (d14 [D] d10))).
- symm.
- cut (D_Hom_eq
- (G $ f)
- (d5 [D] ((H $ f) [D] d14))).
- cut (D_Hom_eq
- (F $ f)
- (d1 [D] ((G $ f) [D] d10))).
- intros.
- Ltac step K :=
- match goal with |- D_Hom_eq ?X ?Y =>
- cut (D_Hom_eq X K);[intro;trans;hypothesis|]
- end.
- step (((d1 [D] d5) [D] (((H $ f) [D] d14) [D] d10))).
- step ((d1 [D] (d5 [D] (((H $ f) [D] d14) [D] d10)))).
- match goal with |- D_Hom_eq ?X ?y =>
- cut (D_Hom_eq X ((d1 [D] ((d5 [D] ((H $ f) [D] d14)) [D] d10))))
- end.
- intro.
- trans.
- apply X4.
- match goal with |- D_Hom_eq ?X ?y =>
- cut (D_Hom_eq X (d1 [D] ((G $ f) [D] d10)))
- end.
- intro; trans.
- apply X5.
- apply compose_respectful_right.
- trans.
- apply compose_respectful_left.
- apply X1.
- symm.
- apply (category_associativity D _ _ _ _ d5 ((H $ f) [D] d14) d10).
- apply compose_respectful_right.
- apply compose_respectful_left.
- symm; hypothesis.
- step ((d1 [D] (d5 [D] (((H $ f) [D] d14) [D] d10)))).
- apply (category_associativity D _ _ _ _).
- symm; apply (category_associativity D _ _ _ _).
- trans; [apply X0|].
- apply compose_respectful_right.
- symm.
- step (((d5 [D] ((H $ f) [D] d14)) [D] d10)).
- symm; assumption.
- apply (category_associativity D _ _ _ _ d5).
- apply compose_respectful_right.
- apply (category_associativity D _ _ _ _).
- assumption.
- assumption.
- Defined.
- intros.
- eapply BLECH; hypothesis.
- Defined.
- End Functor.
- Section Functors.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Context {D_Ob D_Hom D_Hom_eq} (D : @Category D_Ob D_Hom D_Hom_eq).
- Context {E_Ob E_Hom E_Hom_eq} (E : @Category E_Ob E_Hom E_Hom_eq).
- Theorem Functor_Equal (F : Functor C D) {X Y} (f f' : C_Hom X Y) : C_Hom_eq f f' -> D_Hom_eq (Map_Hom F _ _ f) (Map_Hom F _ _ f').
- intros; apply Map_Hom_respectful.
- assumption.
- Defined.
- Definition Identity_Functor : Functor C C.
- Print Build_Functor.
- apply (Build_Functor C C
- (fun X => X)
- (fun X Y f => f)).
- intros; refl.
- intros; refl.
- intros; assumption.
- Defined.
- Definition Compose_Functor (F : Functor C D) (G : Functor D E) : Functor C E.
- Print Build_Functor.
- apply (Build_Functor C E
- (fun X => Map_Ob G (Map_Ob F X))
- (fun X Y f => Map_Hom G _ _ (Map_Hom F _ _ f))).
- intros.
- trans.
- apply Map_Hom_respectful.
- apply (functor_identity F X).
- apply (functor_identity G _).
- intros.
- trans.
- apply Map_Hom_respectful.
- apply (functor_compose F).
- apply (functor_compose G).
- intros.
- apply Map_Hom_respectful.
- apply Map_Hom_respectful.
- assumption.
- Defined.
- End Functors.
- Section NaturalTransformation.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Context {D_Ob D_Hom D_Hom_eq} (D : @Category D_Ob D_Hom D_Hom_eq).
- Context (F G : Functor C D).
- Record NaturalTransformation
- := { Component : forall X : C_Ob, D_Hom (Map_Ob F X) (Map_Ob G X)
- ; naturality : forall X Y (f : C_Hom X Y),
- D_Hom_eq (compose D _ _ _ (Map_Hom F _ _ f) (Component Y))
- (compose D _ _ _ (Component X) (Map_Hom G _ _ f))
- }.
- End NaturalTransformation.
- Section NaturalTransformations.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Context {D_Ob D_Hom D_Hom_eq} (D : @Category D_Ob D_Hom D_Hom_eq).
- Context (F G H : Functor C D).
- Print Component.
- Definition NaturalTransformation_Equivalence : Equivalence (fun (eta nu : NaturalTransformation F G) => forall X : C_Ob, D_Hom_eq (Component eta X) (Component nu X)).
- apply Build_Equivalence.
- intros; refl.
- intros; symm; hypothesis.
- intros; trans; hypothesis.
- Defined.
- Definition Identity_NaturalTransformation : NaturalTransformation F F.
- apply (Build_NaturalTransformation F F
- (fun X => identity D (Map_Ob F X))).
- intros; trans.
- apply category_right_identity.
- symm; apply category_left_identity.
- Defined.
- Definition Compose_NaturalTransformation (eta : NaturalTransformation F G) (nu : NaturalTransformation G H) : NaturalTransformation F H.
- apply (Build_NaturalTransformation F H
- (fun X => compose D _ _ _ (Component eta X) (Component nu X))).
- intros.
- trans.
- apply (category_associativity D).
- trans.
- apply (compose_respectful_left D).
- apply (naturality eta).
- trans.
- symm; apply (category_associativity D).
- symm.
- trans.
- symm.
- apply (category_associativity D).
- apply (compose_respectful_right D).
- symm.
- apply (naturality nu).
- Defined.
- End NaturalTransformations.
- Section FunctorCategory.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Context {D_Ob D_Hom D_Hom_eq} (D : @Category D_Ob D_Hom D_Hom_eq).
- Definition FunctorCategory : @Category
- (Functor C D) (fun F G => NaturalTransformation F G)
- (fun F G =>
- fun (eta nu : NaturalTransformation F G) =>
- forall X : C_Ob,
- D_Hom_eq (Component eta X) (Component nu X)).
- Print Build_Category.
- Print Identity_NaturalTransformation.
- apply (@Build_Category
- (Functor C D)
- (fun F G => NaturalTransformation F G)
- (fun F G =>
- fun (eta nu : NaturalTransformation F G) =>
- forall X : C_Ob,
- D_Hom_eq (Component eta X) (Component nu X))
- (fun F => Identity_NaturalTransformation F)
- (fun _ _ _ eta nu => Compose_NaturalTransformation eta nu));
- simpl; intros.
- apply compose_respectful_left.
- hypothesis.
- apply compose_respectful_right.
- hypothesis.
- apply NaturalTransformation_Equivalence.
- apply category_left_identity.
- apply category_right_identity.
- apply category_associativity.
- Defined.
- End FunctorCategory.
- Section OppositeCategory.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Definition OppositeCategory : @Category C_Ob (fun Y X => C_Hom X Y) (fun Y X f => C_Hom_eq f).
- apply (Build_Category
- (fun Y X => C_Hom X Y) (fun Y X f => C_Hom_eq f)
- (fun X => identity C X)
- (fun X Y Z f g => compose C Z Y X g f)).
- intros; apply compose_respectful_right; hypothesis.
- intros; apply compose_respectful_left; hypothesis.
- intros;
- apply Build_Equivalence; destruct (hom_equivalence C X Y);
- hypothesis.
- intros; apply category_right_identity.
- intros; apply category_left_identity.
- intros; symm; apply category_associativity.
- Defined.
- End OppositeCategory.
- Section UniqueExistence.
- Context {C_Ob : Type}
- {C_Hom : C_Ob -> C_Ob -> Type}
- {C_Hom_eq : forall X Y, Relation (C_Hom X Y)}.
- Definition ExistsUnique {X Y} (C : @Category C_Ob C_Hom C_Hom_eq) (P : C_Hom X Y -> Type) :=
- Sigma (fun f =>
- And (P f) (forall f' : C_Hom X Y, P f' -> C_Hom_eq f f')).
- End UniqueExistence.
- Section TerminalObject.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Definition Terminal (T : C_Ob) :=
- forall X, ExistsUnique C (fun (f : C_Hom X T) => True).
- (** TODO: unique up to unique isomorphism,
- needs predicative definition of isomorphism **)
- Theorem Terminal_unique (T T' : C_Ob) :
- Terminal T -> Terminal T' -> Isomorphism C T T'.
- unfold Terminal; unfold Isomorphism; intros.
- pose (X T); pose (X T').
- pose (X0 T); pose (X0 T').
- destruct e; destruct e0; destruct e1; destruct e2.
- apply (witness _ (both t1 t0)).
- destruct a; destruct a2.
- pose (c (t1 [C] t0) I).
- pose (c0 (t0 [C] t1) I).
- pose (c (identity C _) I).
- pose (c0 (identity C _) I).
- constructor.
- trans; [symm|]; hypothesis.
- trans; [symm|]; hypothesis.
- Defined.
- End TerminalObject.
- Section ConstantFunctor.
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Context {D_Ob D_Hom D_Hom_eq} (D : @Category D_Ob D_Hom D_Hom_eq).
- Definition Delta (U : D_Ob) : Functor C D.
- apply (Build_Functor C D
- (fun _ => U)
- (fun _ _ _ => identity D U)).
- intro; refl.
- intros; symm; apply category_left_identity.
- intros; refl.
- Defined.
- End ConstantFunctor.
- Section Cone.
- Context {II_Ob II_Hom II_Hom_eq} (II : @Category II_Ob II_Hom II_Hom_eq).
- Context {C_Ob C_Hom C_Hom_eq} (C : @Category C_Ob C_Hom C_Hom_eq).
- Definition Cone (U : C_Ob) (D : Functor II C) := NaturalTransformation (Delta II C U) D.
- End Cone.
- Section SYMBOLIC.
- Inductive SYMBOLIC_Objects := a'' | b'' | c'' | d'' | e''.
- Inductive SYMBOLIC_Morphisms : SYMBOLIC_Objects -> SYMBOLIC_Objects -> Type :=
- | f'' : SYMBOLIC_Morphisms a'' b''
- | g'' : SYMBOLIC_Morphisms b'' c''
- | h'' : SYMBOLIC_Morphisms c'' d''
- | k'' : SYMBOLIC_Morphisms d'' e''.
- Inductive SYMBOLIC_Closure : SYMBOLIC_Objects -> SYMBOLIC_Objects -> Type :=
- | SYMBOLIC_Identity : forall x, SYMBOLIC_Closure x x
- | SYMBOLIC_Cons : forall x y z, SYMBOLIC_Morphisms x y -> SYMBOLIC_Closure y z -> SYMBOLIC_Closure x z.
- Fixpoint SYMBOLIC_append x y z (f : SYMBOLIC_Closure x y) : SYMBOLIC_Closure y z -> SYMBOLIC_Closure x z :=
- match f in SYMBOLIC_Closure A' B' return SYMBOLIC_Closure B' z -> SYMBOLIC_Closure A' z with
- | SYMBOLIC_Identity _ => fun y => y
- | SYMBOLIC_Cons _ _ _ k x => fun y => SYMBOLIC_Cons k (SYMBOLIC_append x y)
- end.
- Theorem SYMBOLIC_append_nil :
- forall (X Y : SYMBOLIC_Objects) (f : SYMBOLIC_Closure X Y),
- Identity (SYMBOLIC_append f (SYMBOLIC_Identity Y)) f.
- induction f.
- constructor.
- simpl.
- cut (Identity f (SYMBOLIC_append f (SYMBOLIC_Identity z))).
- intro X; elim X.
- constructor.
- apply (equivalence_symmetry (Equivalence_Identity)).
- assumption.
- Defined.
- Theorem SYMBOLIC_append_associative :
- forall (X Y Z W : SYMBOLIC_Objects) (f : SYMBOLIC_Closure X Y)
- (g : SYMBOLIC_Closure Y Z) (h : SYMBOLIC_Closure Z W),
- Identity (SYMBOLIC_append f (SYMBOLIC_append g h))
- (SYMBOLIC_append (SYMBOLIC_append f g) h).
- induction f.
- constructor.
- intros.
- simpl.
- cut (
- Identity (SYMBOLIC_append f (SYMBOLIC_append g h))
- (SYMBOLIC_append (SYMBOLIC_append f g) h)
- ).
- intro X; elim X.
- constructor.
- apply IHf.
- Defined.
- Definition SYMBOLIC_Cat : Category SYMBOLIC_Closure (fun X Y => @Identity _).
- apply (@Build_Category _ SYMBOLIC_Closure (fun X Y => @Identity _)
- (fun x => SYMBOLIC_Identity x)
- (fun x y z F G => SYMBOLIC_append F G)); simpl.
- intros; elim H; constructor.
- intros; elim H; constructor.
- intros; apply Equivalence_Identity.
- intros; constructor.
- apply SYMBOLIC_append_nil.
- apply SYMBOLIC_append_associative.
- Defined.
- Definition X := SYMBOLIC_Cat.
- Notation "'<' e '>'" := (@SYMBOLIC_Cons _ _ _ e (SYMBOLIC_Identity _)).
- Theorem NASTY_THEOREM :
- Identity ((< f'' > [X] < g'' >) [X] (< h'' > [X] < k'' >))
- ((< f'' > [X] (< g'' > [X] < h'' >)) [X] < k'' >).
- constructor.
- Defined.
- Axiom Ob : Type.
- Axiom a b c d e : Ob.
- Axiom ARR : Ob -> Ob -> Type.
- Axiom f : ARR a b.
- Axiom g : ARR b c.
- Axiom h : ARR c d.
- Axiom k : ARR d e.
- Axiom REL : forall X Y, Relation (ARR X Y).
- Axiom ARR_category : @Category Ob ARR REL.
- Definition interpret_symbolic_object := (fun X =>
- match X with
- | a'' => a
- | b'' => b
- | c'' => c
- | d'' => d
- | e'' => e
- end).
- Definition interpret_symbolic_map (X Y : SYMBOLIC_Objects) (f : SYMBOLIC_Morphisms X Y) : ARR (interpret_symbolic_object X) (interpret_symbolic_object Y).
- destruct f; simpl.
- apply f.
- apply g.
- apply h.
- apply k.
- Defined.
- Definition interpret_symbolic_closure (X Y : SYMBOLIC_Objects) (f : SYMBOLIC_Closure X Y) : ARR (interpret_symbolic_object X) (interpret_symbolic_object Y).
- induction f.
- apply (identity ARR_category).
- eapply (compose ARR_category).
- apply (interpret_symbolic_map s).
- apply IHf.
- Defined.
- Definition SYMBOLIC_ARR_Functor : Functor SYMBOLIC_Cat ARR_category.
- Print Functor.
- apply (Build_Functor SYMBOLIC_Cat ARR_category
- interpret_symbolic_object
- interpret_symbolic_closure);
- simpl; intros.
- apply (hom_equivalence ARR_category).
- induction f0.
- simpl.
- apply (equivalence_symmetry (hom_equivalence ARR_category _ _)).
- apply (category_left_identity ARR_category).
- simpl in *.
- apply (equivalence_symmetry (hom_equivalence ARR_category _ _)).
- eapply (equivalence_transitivity (hom_equivalence ARR_category _ _)).
- apply (equivalence_symmetry (hom_equivalence ARR_category _ _)).
- apply (category_associativity ARR_category).
- apply (compose_respectful_right ARR_category).
- apply (equivalence_symmetry (hom_equivalence ARR_category _ _)).
- apply IHf0.
- elim H.
- apply (equivalence_reflexivity (hom_equivalence ARR_category _ _)).
- Defined.
- Definition Y := ARR_category.
- Theorem NASTY_THEOREM_easy_proof :
- REL ((f [Y] g) [Y] (h [Y] k))
- ((f [Y] (g [Y] h)) [Y] k).
- pose NASTY_THEOREM.
- pose (Functor_Equal SYMBOLIC_ARR_Functor i) as GIFT.
- simpl in GIFT.
- (* FAIL *)
- End SYMBOLIC.
- (*
- *** Local Variables: ***
- *** coq-prog-args: ("-emacs-U" "-nois") ***
- *** End: ***
- *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement