]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/delayed_updating/syntax/path_head.ma
9cdfe620ff67088da01fa37b512b41f1fa3e9e65
[helm.git] / matita / matita / contribs / lambdadelta / delayed_updating / syntax / path_head.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 "delayed_updating/syntax/path_labels.ma".
16 include "delayed_updating/notation/functions/downarrowright_2.ma".
17 include "ground/arith/nat_plus.ma".
18 include "ground/arith/nat_pred_succ.ma".
19
20 (* HEAD FOR PATH ************************************************************)
21
22 rec definition path_head (m) (p) on p: path ≝
23 match m with
24 [ nzero  ⇒ 𝐞
25 | ninj o ⇒ 
26   match p with
27   [ list_empty     ⇒ 𝗟∗∗m
28   | list_lcons l q ⇒
29     match l with
30     [ label_d n ⇒ l◗(path_head (m+n) q)
31     | label_m   ⇒ l◗(path_head m q)
32     | label_L   ⇒ l◗(path_head (↓o) q)
33     | label_A   ⇒ l◗(path_head m q)
34     | label_S   ⇒ l◗(path_head m q)
35     ]
36   ]
37 ].
38
39 interpretation
40   "head (reversed path)"
41   'DownArrowRight n p = (path_head n p).
42
43 (* basic constructions ****************************************************)
44
45 lemma path_head_zero (p):
46       (𝐞) = ↳[𝟎]p.
47 * // qed.
48
49 lemma path_head_empty (n):
50       (𝗟∗∗n) = ↳[n]𝐞.
51 * // qed.
52
53 lemma path_head_d_sn (p) (n) (m:pnat):
54       (𝗱m◗↳[↑n+m]p) = ↳[↑n](𝗱m◗p).
55 // qed.
56
57 lemma path_head_m_sn (p) (n):
58       (𝗺◗↳[↑n]p) = ↳[↑n](𝗺◗p).
59 // qed.
60
61 lemma path_head_L_sn (p) (n):
62       (𝗟◗↳[n]p) = ↳[↑n](𝗟◗p).
63 #p #n
64 whd in ⊢ (???%); //
65 qed.
66
67 lemma path_head_A_sn (p) (n):
68       (𝗔◗↳[↑n]p) = ↳[↑n](𝗔◗p).
69 // qed.
70
71 lemma path_head_S_sn (p) (n):
72       (𝗦◗↳[↑n]p) = ↳[↑n](𝗦◗p).
73 // qed.
74
75 (* Basic inversions *********************************************************)
76
77 lemma eq_inv_path_empty_head (p) (n):
78       (𝐞) = ↳[n]p → 𝟎 = n.
79 *
80 [ #m <path_head_empty #H0
81   <(eq_inv_empty_labels … H0) -m //
82 | * [ #n ] #p #n @(nat_ind_succ … n) -n // #m #_
83   [ <path_head_d_sn
84   | <path_head_m_sn
85   | <path_head_L_sn
86   | <path_head_A_sn
87   | <path_head_S_sn
88   ] #H0 destruct
89 ]
90 qed-.