]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/apps_2/examples/ex_cpr_omega.ma
update in delayed-updating
[helm.git] / matita / matita / contribs / lambdadelta / apps_2 / examples / ex_cpr_omega.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "basic_2/rt_transition/cpr.ma".
16
17 (* EXAMPLES *****************************************************************)
18
19 (* A reduction cycle in exactly three steps: the term Omega *****************)
20
21 definition Delta (s): term ≝ +ⓛ⋆s.ⓐ#0.#0.
22
23 definition Omega1 (s): term ≝ ⓐ(Delta s).(Delta s).
24
25 definition Omega2 (s): term ≝ +ⓓⓝ⋆s.(Delta s).ⓐ#0.#0.
26
27 definition Omega3 (s): term ≝ +ⓓⓝ⋆s.(Delta s).(Omega1 s).
28
29 (* Basic properties *********************************************************)
30
31 lemma Delta_lifts (f) (s): ⇧*[f] (Delta s) ≘ (Delta s).
32 /4 width=1 by lifts_lref, lifts_bind, lifts_flat/ qed.
33
34 (* Basic inversion properties ***********************************************)
35
36 lemma cpr_inv_Delta1_body_sn (h) (G) (L) (s):
37                              ∀X. ❨G,L.ⓛ⋆s❩ ⊢ ⓐ#O.#O ➡[h,0] X → ⓐ#O.#O = X.
38 #h #G #L #s #X #H
39 lapply (cpm_inv_appl1 … H) -H * *
40 [ #W2 #T2 #HW2 #HT2 #H destruct
41   elim (cpr_inv_zero1 … HW2) -HW2
42   elim (cpr_inv_zero1 … HT2) -HT2
43   [ #H1 #H2 destruct //
44   | * #Y #X1 #X2 #_ #_ #H #_ destruct
45   | #_ * #Y #X1 #X2 #_ #_ #H destruct
46   | #_ * #Y #X1 #X2 #_ #_ #H destruct
47   ]
48 | #p #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #H #_ destruct
49 | #p #V2 #V #W1 #W2 #T1 #T2 #_ #_ #_ #_ #H #_ destruct
50 ]
51 qed-.
52
53 lemma cpr_inv_Delta_sn (h) (G) (L) (s):
54                        ∀X. ❨G,L❩ ⊢ Delta s ➡[h,0] X → Delta s = X.
55 #h #G #L #s #X #H
56 elim (cpm_inv_abst1 … H) -H #X1 #X2 #H1 #H2 #H destruct
57 lapply (cpr_inv_sort1 … H1) -H1 #H destruct
58 <(cpr_inv_Delta1_body_sn … H2) -X2 //
59 qed-.
60
61 (* Main properties **********************************************************)
62
63 theorem cpr_Omega_12 (h) (G) (L) (s): ❨G,L❩ ⊢ Omega1 s ➡[h,0] Omega2 s.
64 /2 width=1 by cpm_beta/ qed.
65
66 theorem cpr_Omega_23 (h) (G) (L) (s): ❨G,L❩ ⊢ Omega2 s ➡[h,0] Omega3 s.
67 /5 width=3 by cpm_eps, cpm_appl, cpm_bind, cpm_delta, Delta_lifts/ qed.
68
69 theorem cpr_Omega_31 (h) (G) (L) (s): ❨G,L❩ ⊢ Omega3 s ➡[h,0] Omega1 s.
70 /4 width=3 by cpm_zeta, Delta_lifts, lifts_flat/ qed.
71
72 (* Main inversion properties ************************************************)
73
74 theorem cpr_inv_Omega1_sn (h) (G) (L) (s):
75                           ∀X. ❨G,L❩ ⊢ Omega1 s ➡[h,0] X →
76                           ∨∨ Omega1 s = X | Omega2 s = X.
77 #h #G #L #s #X #H elim (cpm_inv_appl1 … H) -H *
78 [ #W2 #T2 #HW2 #HT2 #H destruct
79   <(cpr_inv_Delta_sn … HW2) -W2
80   <(cpr_inv_Delta_sn … HT2) -T2
81   /3 width=1 by refl, or_introl/
82 | #p #V2 #W1 #W2 #T1 #T2 #HV #HW #HT whd in ⊢ (??%?→?); #H1 #H2 destruct
83   <(cpr_inv_Delta_sn … HV) -V2
84   >(cpr_inv_sort1 … HW) -W2
85   <(cpr_inv_Delta1_body_sn … HT) -T2 //
86 | #p #V2 #V #W1 #W2 #T1 #T2 #_ #_ #_ #_ whd in ⊢ (??%?→?); #H #_ destruct
87 ]
88 qed-.
89
90 theorem cpr_Omega_21_false (h) (G) (L) (s): ❨G,L❩ ⊢ Omega2 s ➡[h,0] Omega1 s → ⊥.
91 #h #G #L #s #H elim (cpm_inv_bind1 … H) -H *
92 [ #W #T #_ #_ whd in ⊢ (??%?→?); #H destruct
93 | #X #H #_ #_ #_
94   elim (lifts_inv_flat2 … H) -H #X1 #X2 #H1 #_ #_
95   @(lifts_inv_lref2_uni_lt … H1) -H1 //
96 ]
97 qed-.