]> matita.cs.unibo.it Git - helm.git/blob - helm/coq-contribs/LAMBDA-TYPES/pc3_defs.v
contribution about \lambda-\delta
[helm.git] / helm / coq-contribs / LAMBDA-TYPES / pc3_defs.v
1 (*#* #stop file *)
2
3 Require Export pr2_defs.
4 Require Export pr3_defs.
5 Require Export pc1_defs.
6
7       Inductive pc2 [c:C; t1,t2:T] : Prop :=
8          | pc2_r : (pr2 c t1 t2) -> (pc2 c t1 t2)
9          | pc2_x : (pr2 c t2 t1) -> (pc2 c t1 t2).
10
11       Hint pc2 : ltlc := Constructors pc2.
12
13       Inductive pc3 [c:C] : T -> T -> Prop :=
14          | pc3_r : (t:?) (pc3 c t t)
15          | pc3_u : (t2,t1:?) (pc2 c t1 t2) ->
16                    (t3:?) (pc3 c t2 t3) -> (pc3 c t1 t3).
17
18       Hint pc3 : ltlc := Constructors pc3.
19
20    Section pc2_props. (******************************************************)
21
22       Theorem pc2_s : (c,t2,t1:?) (pc2 c t1 t2) -> (pc2 c t2 t1).
23       Intros.
24       Inversion H; XAuto.
25       Qed.
26
27       Theorem pc2_shift : (h:?; c,e:?) (drop h (0) c e) ->
28                           (t1,t2:?) (pc2 c t1 t2) ->
29                           (pc2 e (app c h t1) (app c h t2)).
30       Intros until 2; XElim H0; Intros.
31 (* case 1 : pc2_r *)
32       XAuto.
33 (* case 2 : pc2_x *)
34       XEAuto.
35       Qed.
36
37    End pc2_props.
38
39       Hints Resolve pc2_s pc2_shift : ltlc.
40
41    Section pc3_props. (******************************************************)
42
43       Theorem pc3_pr2_r : (c,t1,t2:?) (pr2 c t1 t2) -> (pc3 c t1 t2).
44       XEAuto.
45       Qed.
46
47       Theorem pc3_pr2_x : (c,t1,t2:?) (pr2 c t2 t1) -> (pc3 c t1 t2).
48       XEAuto.
49       Qed.
50
51       Theorem pc3_pc2 : (c,t1,t2:?) (pc2 c t1 t2) -> (pc3 c t1 t2).
52       XEAuto.
53       Qed.
54
55       Theorem pc3_t : (t2,c,t1:?) (pc3 c t1 t2) ->
56                       (t3:?) (pc3 c t2 t3) -> (pc3 c t1 t3).
57       Intros t2 c t1 H; XElim H; XEAuto.
58       Qed.
59
60       Hints Resolve pc3_t : ltlc.
61
62       Theorem pc3_s : (c,t2,t1:?) (pc3 c t1 t2) -> (pc3 c t2 t1).
63       Intros; XElim H; [ XAuto | XEAuto ].
64       Qed.
65
66       Hints Resolve pc3_s : ltlc.
67
68       Theorem pc3_pr3_r : (c:?; t1,t2) (pr3 c t1 t2) -> (pc3 c t1 t2).
69       Intros; XElim H; XEAuto.
70       Qed.
71
72       Theorem pc3_pr3_x : (c:?; t1,t2) (pr3 c t2 t1) -> (pc3 c t1 t2).
73       Intros; XElim H; XEAuto.
74       Qed.
75
76       Hints Resolve pc3_pr3_r pc3_pr3_x : ltlc.
77
78       Theorem pc3_pr3_t : (c:?; t1,t0:?) (pr3 c t1 t0) ->
79                           (t2:?) (pr3 c t2 t0) -> (pc3 c t1 t2).
80       Intros; Apply (pc3_t t0); XAuto.
81       Qed.
82
83       Theorem pc3_thin_dx : (c:? ;t1,t2:?) (pc3 c t1 t2) ->
84                             (u:?; f:?) (pc3 c (TTail (Flat f) u t1)
85                                               (TTail (Flat f) u t2)).
86       Intros; XElim H; [XAuto | Intros ].
87       EApply pc3_u; [ Inversion H | Apply H1 ]; XAuto.
88       Qed.
89
90       Theorem pc3_tail_1 : (c:?; u1,u2:?) (pc3 c u1 u2) ->
91                            (k:?; t:?) (pc3 c (TTail k u1 t) (TTail k u2 t)).
92       Intros until 1; XElim H; Intros.
93 (* case 1 : pc3_r *)
94       XAuto.
95 (* case 2 : pc3_u *)
96       EApply pc3_u; [ Inversion H | Apply H1 ]; XAuto.
97       Qed.
98
99       Theorem pc3_tail_2 : (c:?; u,t1,t2:?; k:?) (pc3 (CTail c k u) t1 t2) ->
100                            (pc3 c (TTail k u t1) (TTail k u t2)).
101       Intros.
102       XElim H; [ Idtac | Intros; Inversion H ]; XEAuto.
103       Qed.
104
105       Theorem pc3_tail_12 : (c:?; u1,u2:?) (pc3 c u1 u2) ->
106                             (k:?; t1,t2:?) (pc3 (CTail c k u2) t1 t2) ->
107                             (pc3 c (TTail k u1 t1) (TTail k u2 t2)).
108       Intros.
109       EApply pc3_t; [ Apply pc3_tail_1 | Apply pc3_tail_2 ]; XAuto.
110       Qed.
111
112       Theorem pc3_tail_21 : (c:?; u1,u2:?) (pc3 c u1 u2) ->
113                             (k:?; t1,t2:?) (pc3 (CTail c k u1) t1 t2) ->
114                             (pc3 c (TTail k u1 t1) (TTail k u2 t2)).
115       Intros.
116       EApply pc3_t; [ Apply pc3_tail_2 | Apply pc3_tail_1 ]; XAuto.
117       Qed.
118
119       Theorem pc3_pr3_u : (c:?; t2,t1:?) (pr2 c t1 t2) ->
120                           (t3:?) (pc3 c t2 t3) -> (pc3 c t1 t3).
121       XEAuto.
122       Qed.
123
124       Theorem pc3_pr3_u2 : (c:?; t0,t1:?) (pr2 c t0 t1) ->
125                            (t2:?) (pc3 c t0 t2) -> (pc3 c t1 t2).
126       Intros; Apply (pc3_t t0); XAuto.
127       Qed.
128
129       Theorem pc3_shift : (h:?; c,e:?) (drop h (0) c e) ->
130                           (t1,t2:?) (pc3 c t1 t2) ->
131                           (pc3 e (app c h t1) (app c h t2)).
132       Intros until 2; XElim H0; Clear t1 t2; Intros.
133 (* case 1 : pc3_r *)
134       XAuto.
135 (* case 2 : pc3_u *)
136       XEAuto.
137       Qed.
138
139       Theorem pc3_pc1: (t1,t2:?) (pc1 t1 t2) -> (c:?) (pc3 c t1 t2).
140       Intros; XElim H; Intros.
141 (* case 1: pc1_r *)
142       XAuto.
143 (* case 2 : pc1_u *)
144       XElim H; XEAuto.
145       Qed.
146
147    End pc3_props.
148
149       Hints Resolve pc3_pr2_r pc3_pr2_x pc3_pc2 pc3_pr3_r pc3_pr3_x
150                     pc3_t pc3_s pc3_pr3_t pc3_thin_dx pc3_tail_1 pc3_tail_2
151                     pc3_tail_12 pc3_tail_21 pc3_pr3_u pc3_shift pc3_pc1 : ltlc.
152
153       Tactic Definition Pc3T :=
154          Match Context With
155             | [ _: (pr3 ?1 ?2 (TTail ?3 ?4 ?5)); _: (pc3 ?1 ?6 ?4) |- ? ] ->
156                LApply (pc3_t (TTail ?3 ?4 ?5) ?1 ?2); [ Intros H_x | XAuto ];
157                LApply (H_x (TTail ?3 ?6 ?5)); [ Clear H_x; Intros | Apply pc3_s; XAuto ]
158             | [ _: (pc3 ?1 ?2 ?3); _: (pr3 ?1 ?3 ?4) |- ? ] ->
159                LApply (pc3_t ?3 ?1 ?2); [ Intros H_x | XAuto ];
160                LApply (H_x ?4); [ Clear H_x; Intros | XAuto ].