]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda/pointer_sequence.ma
fa153ccd4a1bb46477509a128d977f8f4c095724
[helm.git] / matita / matita / contribs / lambda / pointer_sequence.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 "pointer_order.ma".
16
17 (* POINTER SEQUENCE *********************************************************)
18
19 (* Policy: pointer sequence metavariables: r, s *)
20 definition pseq: Type[0] ≝ list ptr.
21
22 (* Note: a "head" computation contracts just redexes in the head *)
23 definition is_head: predicate pseq ≝ All … in_head.
24
25 lemma is_head_dx: ∀s. is_head s → is_head (dx:::s).
26 #s elim s -s //
27 #p #s #IHs * /3 width=1/ 
28 qed.
29
30 lemma is_head_append: ∀r. is_head r → ∀s. is_head s → is_head (r@s).
31 #r elim r -r //
32 #q #r #IHr * /3 width=1/
33 qed.
34
35 (* Note: to us, a "normal" computation contracts redexes in non-decreasing positions *)
36 definition is_le: predicate pseq ≝ Allr … ple.
37
38 lemma is_le_compatible: ∀c,s. is_le s → is_le (c:::s).
39 #c #s elim s -s // #p * //
40 #q #s #IHs * /3 width=1/
41 qed.
42
43 lemma is_le_cons: ∀p,s. is_le s → is_le ((dx::p)::sn:::s).
44 #p #s elim s -s // #q1 * /2 width=1/
45 #q2 #s #IHs * /4 width=1/
46 qed.
47
48 lemma is_le_append: ∀r. is_le r → ∀s. is_le s → is_le ((dx:::r)@sn:::s).
49 #r elim r -r /3 width=1/ #p * /2 width=1/
50 #q #r #IHr * /3 width=1/
51 qed.
52
53 theorem is_head_is_le: ∀s. is_head s → is_le s.
54 #s elim s -s // #p * //
55 #q #s #IHs * /3 width=1/
56 qed.
57
58 lemma is_le_in_head: ∀p. in_head p → ∀s. is_le s → is_le (p::s).
59 #p #Hp * // /3 width=1/
60 qed.
61
62 theorem is_head_is_le_trans: ∀r. is_head r → ∀s. is_le s → is_le (r@s).
63 #r elim r -r // #p *
64 [ #_ * /2 width=1/
65 | #q #r #IHr * /3 width=1/
66 ]
67 qed.
68
69 definition ho_compatible_rc: predicate (pseq→relation term) ≝ λR.
70                              ∀s,A1,A2. R s A1 A2 → R (sn:::s) (𝛌.A1) (𝛌.A2).
71
72 definition ho_compatible_sn: predicate (pseq→relation term) ≝ λR.
73                              ∀s,B1,B2,A. R s B1 B2 → R (sn:::s) (@B1.A) (@B2.A).
74
75 definition ho_compatible_dx: predicate (pseq→relation term) ≝ λR.
76                              ∀s,B,A1,A2. R s A1 A2 → R (dx:::s) (@B.A1) (@B.A2).
77
78 lemma lstar_compatible_rc: ∀R. compatible_rc R → ho_compatible_rc (lstar … R).
79 #R #HR #s #A1 #A2 #H @(lstar_ind_l ????????? H) -s -A1 // /3 width=3/
80 qed.
81
82 lemma lstar_compatible_sn: ∀R. compatible_sn R → ho_compatible_sn (lstar … R).
83 #R #HR #s #B1 #B2 #A #H @(lstar_ind_l ????????? H) -s -B1 // /3 width=3/
84 qed.
85
86 lemma lstar_compatible_dx: ∀R. compatible_dx R → ho_compatible_dx (lstar … R).
87 #R #HR #s #B #A1 #A2 #H @(lstar_ind_l ????????? H) -s -A1 // /3 width=3/
88 qed.