@@ -43,7 +43,7 @@ Unset Automatic Introduction.
43
43
44
44
45
45
(** afterwards we prove that an initial object exists in the category of representations
46
- associated to a signature [Sig ]. this result is actually the same (via an adjunction)
46
+ associated to a signature [S ]. this result is actually the same (via an adjunction)
47
47
as the one proved in ../STS (even for simply--typed syntax *)
48
48
(** only in the next file ./prop_arities.v will we talk about propositional arities.
49
49
we still need initiality for the empty set of prop. arities, since the order
@@ -54,13 +54,13 @@ Section initial_type.
54
54
55
55
Ltac fin := simpl in *; intros; autorewrite with fin; auto with fin.
56
56
57
- Variable Sig : Signature.
57
+ Variable S : Signature.
58
58
Notation "V '" := (option V).
59
59
Notation "V ** l" := (pow l V) (at level 10).
60
60
Notation "f ^^ l" := (pow_map (l:=l) f) (at level 10).
61
61
Notation "^ f" := (lift (M:= option_monad) f) (at level 5).
62
62
Notation "[ T ]" := (list T) (at level 5).
63
-
63
+ Notation "a -:- b" := (CONSTR a b) (at level 60).
64
64
65
65
(** UTS will be the (carrier of the) initial monad, UTS_list represents the arguments of
66
66
a constructor *)
@@ -73,16 +73,18 @@ Notation "[ T ]" := (list T) (at level 5).
73
73
- the diagonal, yielding the initial representation without any inequations
74
74
- the preorder induced by a set of inequations A (cf. file ./prop_arities.v) *)
75
75
76
+ Reserved Notation "a -::- b" (at level 65).
76
77
77
78
Inductive UTS (V : TYPE) : TYPE :=
78
79
| Var : V -> UTS V
79
- | Build : forall (i : sig_index Sig ),
80
+ | Build : forall (i : sig_index S ),
80
81
UTS_list V (sig i) -> UTS V
81
82
with
82
83
UTS_list (V : TYPE) : [nat] -> Type :=
83
84
| TT : UTS_list V nil
84
85
| constr : forall b bs,
85
86
UTS (V ** b) -> UTS_list V bs -> UTS_list V (b::bs).
87
+ Notation "a -::- b" := (constr a b).
86
88
87
89
(** at first the diagonal preorder *)
88
90
@@ -99,9 +101,9 @@ Scheme UTSrect := Induction for UTS Sort Type with
99
101
UTSlistrect := Induction for UTS_list Sort Type.
100
102
101
103
Lemma constr_eq : forall (V : TYPE) (b : nat)
102
- (bs : [nat]) (x y : UTS _ )
104
+ (bs : [nat]) (x y : UTS (V**b) )
103
105
(v w : UTS_list V bs),
104
- x = y -> v = w -> constr (b:=b) x v = constr y w.
106
+ x = y -> v = w -> x -::- v = y -::- w.
105
107
Proof .
106
108
intros; subst; auto.
107
109
Qed .
@@ -119,6 +121,22 @@ Reserved Notation "x //-- f" (at level 42, left associativity).
119
121
120
122
(** renaming is a mutually recursive function *)
121
123
124
+ Fixpoint rename (V W: TYPE ) (f : V ---> W) (v : UTS V):=
125
+ match v in UTS _ return UTS W with
126
+ | Var v => Var (f v)
127
+ | Build i l => Build (*i:=i *) (l //-- f)
128
+ end
129
+ with
130
+ list_rename V t (l : UTS_list V t) W (f : V ---> W) : UTS_list W t :=
131
+ match l in UTS_list _ t return UTS_list W t with
132
+ | TT => TT W
133
+ | constr b bs elem elems =>
134
+ elem //- f ^^ b -::- elems //-- f
135
+ end
136
+ where "x //- f" := (rename f x)
137
+ and "x //-- f" := (list_rename x f).
138
+
139
+ (*
122
140
Fixpoint rename (V W: TYPE ) (f : V ---> W) (v : UTS V):=
123
141
match v in UTS _ return UTS W with
124
142
| Var v => Var (f v)
@@ -134,11 +152,12 @@ with
134
152
end
135
153
where "x //- f" := (rename f x)
136
154
and "x //-- f" := (list_rename x f).
155
+ *)
137
156
138
157
Definition rename_sm V W (f : V ---> W) :
139
158
UTS_sm V ---> UTS_sm W := #Delta (rename f).
140
159
141
- (** functoriality of renaming for STS *)
160
+ (** functoriality of renaming for UTS *)
142
161
143
162
Hint Extern 1 (_ = _) => apply f_equal.
144
163
@@ -231,13 +250,13 @@ Definition _shift (V W : TYPE ) (f : V ---> UTS W) :
231
250
end .
232
251
233
252
Notation "x >- f" := (_shift f x) (at level 40).
234
-
253
+ Locate S.
235
254
(** same for lshift, being given a list of object language types *)
236
255
Fixpoint _lshift (l : nat) (V W : TYPE) (f : V ---> UTS W) :
237
256
V ** l ---> UTS (W ** l) :=
238
257
match l return V ** l ---> UTS (W**l) with
239
258
| 0 => f
240
- | S n' => @_lshift n' _ _ (_shift f)
259
+ | Datatypes. S n' => @_lshift n' _ _ (_shift f)
241
260
end .
242
261
243
262
(*Implicit Arguments shift_l [V W t]. *)
@@ -260,15 +279,17 @@ with
260
279
list_subst V W t (l : UTS_list V t) (f : V ---> UTS W) : UTS_list W t :=
261
280
match l in UTS_list _ t return UTS_list W t with
262
281
| TT => TT W
263
- | constr b bs elem elems =>
264
- constr ( elem >== ( _lshift f)) ( elems >>== f)
282
+ | (* constr b bs *) elem -::- elems =>
283
+ elem >== _lshift f -::- elems >>== f
265
284
end
266
285
where "x >== f" := (subst f x)
267
286
and "x >>== f" := (list_subst x f).
268
287
288
+ (*
269
289
Definition subst_sm (V W : TYPE) (f : Delta V ---> UTS_sm W) :
270
290
UTS_sm V ---> UTS_sm W := #Delta (subst f).
271
-
291
+ *)
292
+
272
293
(** substitution of one variable only *)
273
294
274
295
Definition substar (V : TYPE) (M : UTS V ) :
@@ -565,7 +586,7 @@ Obligation Tactic := unfold Proper, respectful; fin.
565
586
566
587
Program Instance UTS_sm_rmonad : RMonad_struct Delta UTS_sm := {
567
588
rweta c := #Delta (@Var c);
568
- rkleisli := subst_sm
589
+ rkleisli a b f := #Delta (subst f)
569
590
}.
570
591
571
592
Canonical Structure UTSM := Build_RMonad UTS_sm_rmonad.
@@ -579,15 +600,15 @@ Fixpoint UTSl_f_pm l V (x : prod_mod_c (fun V => UTS V) V l)
579
600
: UTS_list V l :=
580
601
match x in prod_mod_c _ _ l return UTS_list V l with
581
602
| TTT => TT V
582
- | CONSTR b bs e el => constr e ( UTSl_f_pm el)
603
+ | (* CONSTR b bs *) e -:- el => e -::- UTSl_f_pm el
583
604
end .
584
605
585
606
Fixpoint pm_f_UTSl l V (v : UTS_list V l) :
586
607
prod_mod_c (fun V => UTS V) V l :=
587
608
match v in UTS_list _ l return prod_mod_c _ V l with
588
609
| TT => TTT _ _
589
- | constr b bs elem elems =>
590
- CONSTR elem ( pm_f_UTSl elems)
610
+ | elem -::- elems =>
611
+ elem -:- pm_f_UTSl elems
591
612
end .
592
613
593
614
Lemma one_way l V (v : UTS_list V l) :
@@ -626,7 +647,7 @@ we establish some equalities *)
626
647
627
648
Hint Rewrite subst_eq_rename : fin.
628
649
629
- (** shift = opt_inj STS *)
650
+ (** shift = opt_inj UTS *)
630
651
631
652
Notation "x >>- f" := (shift_not f x) (at level 50).
632
653
Notation "x >-- f" := (lshift _ f x) (at level 50).
@@ -655,7 +676,7 @@ Proof.
655
676
fin.
656
677
Qed .
657
678
658
- (** STSl_f_pm ;; list_subst = mkleisli ;; STSl_f_pm *)
679
+ (** UTSl_f_pm ;; list_subst = mkleisli ;; UTSl_f_pm *)
659
680
660
681
Hint Resolve _lshift_lshift_eq : fin.
661
682
@@ -714,36 +735,37 @@ Qed.
714
735
Obligation Tactic := unfold Proper, respectful; intros; simpl;
715
736
repeat (match goal with [H:_|-_]=>rewrite (diag_preorder_prod_imp_eq H) end); constructor.
716
737
717
- Program Instance UTS_arity_rep_po (i : sig_index Sig ) V : PO_mor_struct
738
+ Program Instance UTS_arity_rep_po (i : sig_index S ) V : PO_mor_struct
718
739
(a:= prod_mod UTSM (sig i) V)
719
740
(b:= UTSM V)
720
741
(fun (X : prod_mod_c _ V (sig i)) => Build (i:=i) (UTSl_f_pm (V:=V) X)).
721
742
722
743
Obligation Tactic := t5.
723
744
724
- Program Instance UTS_arity_rep (i : sig_index Sig ) :
745
+ Program Instance UTS_arity_rep (i : sig_index S ) :
725
746
RModule_Hom_struct
726
747
(M := prod_mod UTSM (sig i))
727
748
(N := UTSM)
728
749
(fun V => Build_PO_mor (UTS_arity_rep_po i V)).
729
750
730
751
731
- (** STS has a structure as a representation of Sig *)
752
+ (** UTS has a structure as a representation of S *)
732
753
733
- Canonical Structure UTSrepr : Repr Sig UTSM :=
754
+ Canonical Structure UTSrepr : Repr S UTSM :=
734
755
fun i => Build_RModule_Hom (UTS_arity_rep i).
735
756
736
- Canonical Structure UTSRepr : REP Sig :=
757
+ Canonical Structure UTSRepr : REP S :=
737
758
Build_Representation (@UTSrepr).
738
759
739
760
(** ** INITIALITY
740
761
the representation [UTSRepr] we've just defined is initial: *)
741
762
742
763
Section initiality.
743
764
744
- Variable R : REP Sig.
765
+ Variable R : REP S.
766
+
767
+ (** the initial morphism UTS -> R *)
745
768
746
- (** the initial morphism STS -> R *)
747
769
748
770
Fixpoint init V (v : UTS V) : R V :=
749
771
match v in UTS _ return R V with
754
776
init_list l (V : TYPE) (s : UTS_list V l) : prod_mod R l V :=
755
777
match s in UTS_list _ l return prod_mod R l V with
756
778
| TT => TTT _ _
757
- | constr b bs elem elems =>
758
- CONSTR (init elem) (init_list elems)
779
+ | elem -::- elems => init elem -:- init_list elems
759
780
end .
760
781
761
782
(** *** [init] commutes with renaming, substitution
@@ -885,7 +906,7 @@ init is not only (the carrier of) a monad morphism, but even (of) a morphism of
885
906
(** prod_ind_mod_mor INIT = init_list (up to bijection) *)
886
907
887
908
888
- Lemma prod_mor_eq_init_list (i : sig_index Sig ) V
909
+ Lemma prod_mor_eq_init_list (i : sig_index S ) V
889
910
(x : prod_mod_c UTS_sm V (sig i)) :
890
911
Prod_mor_c init_mon x = init_list (UTSl_f_pm x).
891
912
Proof .
@@ -899,7 +920,7 @@ Program Instance init_representic : Representation_Hom_struct
899
920
900
921
Definition init_rep := Build_Representation_Hom init_representic.
901
922
902
- (** ** INITIALITY of STSRepr with init *)
923
+ (** ** INITIALITY of UTSRepr with init *)
903
924
904
925
Section init.
905
926
@@ -958,7 +979,7 @@ Obligation Tactic := fin.
958
979
959
980
(** ** Initiality *)
960
981
961
- Program Instance UTS_initial : Initial (REP Sig ) := {
982
+ Program Instance UTS_initial : Initial (REP S ) := {
962
983
Init := UTSRepr ;
963
984
InitMor R := init_rep R }.
964
985
0 commit comments