-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhoaspack.v
573 lines (448 loc) · 17.3 KB
/
hoaspack.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
(*******************************************************)
(* *)
(* Contexts Theory. *)
(* *)
(*******************************************************)
(* *)
(* File : hoaspack.v *)
(* Author : Ivan Scagnetto (scagnett@dimi.uniud.it), *)
(* Dipartimento di Matematica e Informatica, *)
(* University of Udine *)
(* Date : July 1998 *)
(* *)
(*******************************************************)
(* *)
(* This file is part of "Pi-calculus in (Co)Inductive *)
(* Type Theory", a joint work with Furio Honsell and *)
(* Marino Miculan (accepted for publication on TCS). *)
(* If you are interested you can find more information *)
(* (and a gzipped PostScript version of the article) *)
(* at the following URL: *)
(* http://www.dimi.uniud.it/~scagnett/pi-calculus.html *)
(* *)
(*******************************************************)
Require Export picalcth.
Section monotonicity.
(*******************************************************)
(* The next axiom states that if a name does not occur *)
(* in an applied context, then it cannot occur in the *)
(* context itself. *)
(*******************************************************)
Axiom
proc_mono :
forall (p : name -> proc) (x y : name), notin x (p y) -> notin x (nu p).
(*********************************************)
(* Same as above, for free and bound labels. *)
(*********************************************)
Axiom
f_act_mono :
forall (a : name -> f_act) (x y : name),
f_act_notin x (a y) -> f_act_notin_ho x a.
Axiom
b_act_mono :
forall (a : name -> b_act) (x y : name),
b_act_notin x (a y) -> b_act_notin_ho x a.
End monotonicity.
Section expansions.
(*****************************************************)
(* Expansion of processes contexts into higher order *)
(* process contexts applied to names. *)
(*****************************************************)
Axiom
ho_proc_exp :
forall (p : name -> proc) (x : name),
exists q : name -> name -> proc,
notin x (nu (fun y : name => nu (q y))) /\ p = q x.
Axiom
ho2_proc_exp :
forall (p : name -> name -> proc) (x : name),
exists q : name -> name -> name -> proc,
notin x (nu (fun y : name => nu (fun z : name => nu (q y z)))) /\
p = q x.
(*******************************)
(* Same as above, for process. *)
(*******************************)
Lemma proc_exp :
forall (p : proc) (x : name),
exists q : name -> proc, notin x (nu q) /\ p = q x.
Proof.
simple induction p; intros.
exists (fun _ : name => nil); split;
[ apply notin_nu; intros; apply notin_nil | try trivial ].
elim (H x); intros.
exists (fun n : name => bang (x0 n)); split.
apply notin_nu; intros.
apply notin_bang; inversion H0.
inversion H2; auto.
inversion H0.
rewrite <- H2; trivial.
elim (H x); intros.
exists (fun n : name => tau_pref (x0 n)); split.
apply notin_nu; intros.
apply notin_tau; inversion H0.
inversion H2; auto.
inversion H0.
rewrite <- H2; trivial.
elim (H x); elim (H0 x); intros.
inversion_clear H1; inversion_clear H2.
exists (fun n : name => par (x1 n) (x0 n)); split.
apply notin_nu; intros.
apply notin_par; [ inversion H1; auto | inversion H3; auto ].
rewrite <- H4; rewrite <- H5; trivial.
elim (H x); elim (H0 x); intros.
inversion_clear H1; inversion_clear H2.
exists (fun n : name => sum (x1 n) (x0 n)); split.
apply notin_nu; intros.
apply notin_sum; [ inversion H1; auto | inversion H3; auto ].
rewrite <- H4; rewrite <- H5; trivial.
elim (ho_proc_exp p0 x); intros.
inversion_clear H0; exists (fun n : name => nu (x0 n)); split;
[ assumption | rewrite H2; trivial ].
elim (H x); intros.
inversion_clear H0.
elim (LEM_name x n); elim (LEM_name x n0); intros.
rewrite <- H0; rewrite <- H3; exists (fun n : name => match_ n n (x0 n));
split.
apply notin_nu; intros; inversion H1; apply notin_match; auto.
rewrite H2; trivial.
rewrite <- H3; exists (fun n : name => match_ n n0 (x0 n)); split.
apply notin_nu; intros; inversion H1; apply notin_match; auto.
rewrite H2; trivial.
rewrite <- H0; exists (fun n1 : name => match_ n n1 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_match; auto.
rewrite H2; trivial.
exists (fun n1 : name => match_ n n0 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_match; auto.
rewrite H2; trivial.
elim (H x); intros.
inversion_clear H0.
elim (LEM_name x n); elim (LEM_name x n0); intros.
rewrite <- H0; rewrite <- H3;
exists (fun n1 : name => mismatch n1 n1 (x0 n1));
split.
apply notin_nu; intros; inversion H1; apply notin_mismatch; auto.
rewrite H2; trivial.
rewrite <- H3; exists (fun n1 : name => mismatch n1 n0 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_mismatch; auto.
rewrite H2; trivial.
rewrite <- H0; exists (fun n1 : name => mismatch n n1 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_mismatch; auto.
rewrite H2; trivial.
exists (fun n1 : name => mismatch n n0 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_mismatch; auto.
rewrite H2; trivial.
elim (ho_proc_exp p0 x); intros.
inversion_clear H0; elim (LEM_name x n); intros.
rewrite <- H0; exists (fun n0 : name => in_pref n0 (x0 n0)); split;
[ apply notin_nu; intros; apply notin_in; intros;
[ assumption
| inversion H1; cut (notin x (nu (x0 z))); [ intro | auto ];
inversion_clear H7; auto ]
| rewrite H2; trivial ].
exists (fun n0 : name => in_pref n (x0 n0)); split;
[ apply notin_nu; intros; apply notin_in; intros;
[ auto
| inversion H1; cut (notin x (nu (x0 z))); [ intro | auto ];
inversion_clear H7; auto ]
| rewrite H2; trivial ].
elim (H x); intros.
inversion_clear H0.
elim (LEM_name x n); elim (LEM_name x n0); intros.
rewrite <- H0; rewrite <- H3;
exists (fun n1 : name => out_pref n1 n1 (x0 n1));
split.
apply notin_nu; intros; inversion H1; apply notin_out; auto.
rewrite H2; trivial.
rewrite <- H3; exists (fun n1 : name => out_pref n1 n0 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_out; auto.
rewrite H2; trivial.
rewrite <- H0; exists (fun n1 : name => out_pref n n1 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_out; auto.
rewrite H2; trivial.
exists (fun n1 : name => out_pref n n0 (x0 n1)); split.
apply notin_nu; intros; inversion H1; apply notin_out; auto.
rewrite H2; trivial.
Qed.
(*************************************************)
(* Expansion of free labels into label contexts. *)
(*************************************************)
Lemma f_act_exp :
forall (a : f_act) (x : name),
exists b : name -> f_act, f_act_notin_ho x b /\ a = b x.
Proof.
unfold f_act_notin_ho in |- *; simple induction a; intros.
exists (fun x : name => tau); split; [ intros | trivial ].
apply f_act_notin_tau.
elim (LEM_name n x); elim (LEM_name n0 x); intros.
exists (fun x : name => Out x x); split.
intros; apply f_act_notin_Out; auto.
rewrite H; rewrite H0; try trivial.
exists (fun x : name => Out x n0); split.
intros; apply f_act_notin_Out; auto.
rewrite H0; try trivial.
exists (fun x : name => Out n x); split.
intros; apply f_act_notin_Out; auto.
rewrite H; try trivial.
exists (fun x : name => Out n n0); split;
[ intros; apply f_act_notin_Out; auto | trivial ].
Qed.
(**************************************************)
(* Expansion of bound labels into label contexts. *)
(**************************************************)
Lemma b_act_exp :
forall (a : b_act) (x : name),
exists b : name -> b_act, b_act_notin_ho x b /\ a = b x.
Proof.
unfold b_act_notin_ho in |- *; simple induction a; intros.
elim (LEM_name n x); intros.
exists (fun x : name => In x); split.
intros; apply b_act_notin_In; auto.
rewrite H; try trivial.
exists (fun x : name => In n); split.
intros; apply b_act_notin_In; auto.
trivial.
elim (LEM_name n x); intros.
exists (fun x : name => bOut x); split.
intros; apply b_act_notin_bOut; auto.
rewrite H; try trivial.
exists (fun x : name => bOut n); split.
intros; apply b_act_notin_bOut; auto.
trivial.
Qed.
End expansions.
(**********************************************************************)
(* Leibniz equality is a congruence w.r.t. replacement of free names. *)
(**********************************************************************)
Section eq_congr.
Variable x y : name.
Axiom
ho_proc_ext :
forall (p q : name -> name -> proc) (x : name),
notin x (nu (fun y : name => nu (p y))) ->
notin x (nu (fun y : name => nu (q y))) -> p x = q x -> p = q.
Axiom
proc_ext :
forall (p q : name -> proc) (x : name),
notin x (nu p) -> notin x (nu q) -> p x = q x -> p = q.
Lemma proc_spec :
forall p q : name -> proc, p = q -> forall x : name, p x = q x.
Proof.
intros; rewrite H; trivial.
Qed.
Lemma proc_sub_congr :
forall p q : name -> proc,
notin x (nu p) -> notin x (nu q) -> p x = q x -> p y = q y.
Proof.
intros; apply proc_spec; apply proc_ext with x; auto.
Qed.
Lemma ho_proc_sub_congr :
forall p q : name -> name -> proc,
notin x (nu (fun z : name => nu (p z))) ->
notin x (nu (fun z : name => nu (q z))) -> p x = q x -> p y = q y.
Proof.
intros;
elim
(unsat
(par (nu (fun z : name => nu (p z))) (nu (fun z : name => nu (q z))))
(cons x (cons y empty))); intros.
inversion_clear H; inversion_clear H0; inversion_clear H2; inversion_clear H0;
inversion_clear H4; inversion_clear H2; inversion_clear H5;
inversion_clear H6; clear H7.
apply proc_ext with x0; auto.
change ((fun n : name => p n x0) y = (fun n : name => q n x0) y) in |- *;
apply proc_sub_congr; try apply notin_nu; intros;
[ cut (notin x (nu (p z))) | cut (notin x (nu (q z))) | apply proc_spec ];
auto; intro; inversion_clear H7; auto.
Qed.
Axiom
f_act_ext :
forall (a b : name -> f_act) (x : name),
f_act_notin_ho x a -> f_act_notin_ho x b -> a x = b x -> a = b.
Lemma f_act_spec :
forall a b : name -> f_act, a = b -> forall x : name, a x = b x.
Proof.
intros; rewrite H; trivial.
Qed.
Lemma f_act_sub_congr :
forall a b : name -> f_act,
f_act_notin_ho x a -> f_act_notin_ho x b -> a x = b x -> a y = b y.
Proof.
intros; apply f_act_spec; apply f_act_ext with x; auto.
Qed.
Axiom
b_act_ext :
forall (a b : name -> b_act) (x : name),
b_act_notin_ho x a -> b_act_notin_ho x b -> a x = b x -> a = b.
Lemma b_act_spec :
forall a b : name -> b_act, a = b -> forall x : name, a x = b x.
Proof.
intros; rewrite H; trivial.
Qed.
Lemma b_act_sub_congr :
forall a b : name -> b_act,
b_act_notin_ho x a -> b_act_notin_ho x b -> a x = b x -> a y = b y.
Proof.
intros; apply b_act_spec; apply b_act_ext with x; auto.
Qed.
End eq_congr.
Section eta.
(*******************************)
(* Eta-equivalence of contexts *)
(*******************************)
Lemma PRE_ETA_EQ :
forall (q : proc) (x : name) (p : name -> proc),
notin x (nu p) -> q = p x -> nu p = nu (fun x : name => p x).
Proof.
intro; case q; intros.
cut (p = (fun _ : name => nil)); [ intro | apply proc_ext with x; auto ].
rewrite H1; trivial.
apply notin_nu; intros; apply notin_nil.
elim (proc_exp p x); intros.
inversion_clear H1.
rewrite H3 in H0; cut (p0 = (fun n : name => bang (x0 n)));
[ intro | apply proc_ext with x; auto ].
rewrite H1; trivial.
apply notin_nu; intros; apply notin_bang; inversion_clear H2; auto.
elim (proc_exp p x); intros.
inversion_clear H1.
rewrite H3 in H0; cut (p0 = (fun n : name => tau_pref (x0 n)));
[ intro | apply proc_ext with x; auto ].
rewrite H1; trivial.
apply notin_nu; intros; apply notin_tau; inversion_clear H2; auto.
elim (proc_exp p x); elim (proc_exp p0 x); intros.
inversion_clear H1; inversion_clear H2.
rewrite H4 in H0; rewrite H5 in H0;
cut (p1 = (fun n : name => par (x1 n) (x0 n)));
[ intro | apply proc_ext with x; auto ].
rewrite H2; trivial.
apply notin_nu; intros; apply notin_par;
[ inversion_clear H1 | inversion_clear H3 ]; auto.
elim (proc_exp p x); elim (proc_exp p0 x); intros.
inversion_clear H1; inversion_clear H2.
rewrite H4 in H0; rewrite H5 in H0;
cut (p1 = (fun n : name => sum (x1 n) (x0 n)));
[ intro | apply proc_ext with x; auto ].
rewrite H2; trivial.
apply notin_nu; intros; apply notin_sum;
[ inversion_clear H1 | inversion_clear H3 ]; auto.
elim (ho_proc_exp p x); intros.
inversion_clear H1.
rewrite H3 in H0; cut (p0 = (fun n : name => nu (x0 n)));
[ intro | apply proc_ext with x; auto ].
rewrite H1; trivial.
elim (LEM_name x n); elim (LEM_name x n0); intros.
rewrite <- H1 in H0; rewrite <- H2 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => match_ n1 n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_match; auto.
rewrite <- H2 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => match_ n1 n0 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_match; auto.
rewrite <- H1 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => match_ n n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_match; auto.
elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => match_ n n0 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_match; auto.
elim (LEM_name x n); elim (LEM_name x n0); intros.
rewrite <- H1 in H0; rewrite <- H2 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => mismatch n1 n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_mismatch; auto.
rewrite <- H2 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => mismatch n1 n0 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_mismatch; auto.
rewrite <- H1 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => mismatch n n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_mismatch; auto.
elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => mismatch n n0 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_mismatch; auto.
elim (LEM_name x n); intro.
rewrite <- H1 in H0; elim (ho_proc_exp p x); intros.
inversion_clear H2.
rewrite H4 in H0; cut (p0 = (fun n1 : name => in_pref n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H2; trivial.
apply notin_nu; intros; apply notin_in; intros; inversion_clear H3; auto.
cut (notin x (nu (x0 z))); [ intro | auto ].
inversion_clear H3; auto.
elim (ho_proc_exp p x); intros.
inversion_clear H2.
rewrite H4 in H0; cut (p0 = (fun n1 : name => in_pref n (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H2; trivial.
apply notin_nu; intros; apply notin_in; intros; inversion_clear H3; auto.
cut (notin x (nu (x0 z))); [ intro | auto ].
inversion_clear H3; auto.
elim (LEM_name x n); elim (LEM_name x n0); intros.
rewrite <- H1 in H0; rewrite <- H2 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => out_pref n1 n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_out; auto.
rewrite <- H2 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => out_pref n1 n0 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_out; auto.
rewrite <- H1 in H0; elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => out_pref n n1 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_out; auto.
elim (proc_exp p x); intros.
inversion_clear H3.
rewrite H5 in H0; cut (p0 = (fun n1 : name => out_pref n n0 (x0 n1)));
[ intro | apply proc_ext with x; auto ].
rewrite H3; trivial.
apply notin_nu; intros; inversion_clear H4; apply notin_out; auto.
Qed.
Lemma ETA_EQ : forall p : name -> proc, nu p = nu (fun x : name => p x).
Proof.
intro; elim (unsat (nu p) empty); intros.
inversion_clear H; clear H1.
apply PRE_ETA_EQ with (p x) x; auto.
Qed.
(********************************************)
(* Same as above, for higher-order contexts *)
(********************************************)
Lemma ETA_EQ2 :
forall p : name -> name -> proc,
nu (fun x : name => nu (p x)) =
nu (fun x : name => nu (fun y : name => p x y)).
Proof.
intro;
cut
((fun x : name => nu (p x)) = (fun x : name => nu (fun y : name => p x y)));
[ intro; rewrite H; trivial | idtac ].
elim (unsat (nu (fun x : name => nu (p x))) empty); intros; inversion_clear H;
clear H1.
apply proc_ext with x; auto.
Qed.
End eta.