]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/relocation/gr_pat_tls.ma
update in ground
[helm.git] / matita / matita / contribs / lambdadelta / ground / relocation / gr_pat_tls.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 "ground/arith/pnat_plus.ma".
16 include "ground/relocation/gr_tls.ma".
17 include "ground/relocation/gr_pat_eq.ma".
18
19 (* POSITIVE APPLICATION FOR GENERIC RELOCATION MAPS *************************)
20
21 (* Constructions with gr_tls ************************************************)
22
23 (* Note: this requires ↑ on first n *)
24 (*** at_pxx_tls *)
25 lemma gr_pat_unit_succ_tls (n) (f):
26       @❪𝟏,f❫ ≘ ↑n → @❪𝟏,⫱*[n]f❫ ≘ 𝟏.
27 #n @(nat_ind_succ … n) -n //
28 #n #IH #f #Hf
29 elim (gr_pat_inv_unit_succ … Hf) -Hf [|*: // ] #g #Hg #H0 destruct
30 <gr_tls_swap /2 width=1 by/
31 qed.
32
33 (* Note: this requires ↑ on third n2 *)
34 (*** at_tls *)
35 lemma gr_pat_tls (n2) (f): ⫯⫱*[↑n2]f ≡ ⫱*[n2]f → ∃i1. @❪i1,f❫ ≘ ↑n2.
36 #n2 @(nat_ind_succ … n2) -n2
37 [ /4 width=4 by gr_pat_eq_repl_back, gr_pat_refl, ex_intro/
38 | #n2 #IH #f <gr_tls_swap <gr_tls_swap in ⊢ (??%→?); #H
39   elim (IH … H) -IH -H #i1 #Hf
40   elim (gr_map_split_tl f) #Hg destruct
41   /3 width=8 by gr_pat_push, gr_pat_next, ex_intro/
42 ]
43 qed-.
44
45 (* Inversions with gr_tls ***************************************************)
46
47 (* Note: this does not require ↑ on second and third p *)
48 (*** at_inv_nxx *)
49 lemma gr_pat_inv_succ_sn (p) (g) (i1) (j2):
50       @❪↑i1,g❫ ≘ j2 → @❪𝟏,g❫ ≘ p →
51       ∃∃i2. @❪i1,⫱*[p]g❫ ≘ i2 & p+i2 = j2.
52 #p elim p -p
53 [ #g #i1 #j2 #Hg #H
54   elim (gr_pat_inv_unit_bi … H) -H [|*: // ] #f #H0
55   elim (gr_pat_inv_succ_push … Hg … H0) -Hg [|*: // ] #x2 #Hf #H2 destruct
56   /2 width=3 by ex2_intro/
57 | #p #IH #g #i1 #j2 #Hg #H
58   elim (gr_pat_inv_unit_succ … H) -H [|*: // ] #f #Hf2 #H0
59   elim (gr_pat_inv_next … Hg … H0) -Hg #x2 #Hf1 #H2 destruct
60   elim (IH … Hf1 Hf2) -IH -Hf1 -Hf2 #i2 #Hf #H2 destruct
61   /2 width=3 by ex2_intro/
62 ]
63 qed-.
64
65 (* Note: this requires ↑ on first n2 *)
66 (*** at_inv_tls *)
67 lemma gr_pat_inv_succ_dx_tls (n2) (i1) (f):
68       @❪i1,f❫ ≘ ↑n2 → ⫯⫱*[↑n2]f ≡ ⫱*[n2]f.
69 #n2 @(nat_ind_succ … n2) -n2
70 [ #i1 #f #Hf elim (gr_pat_inv_unit_dx … Hf) -Hf // #g #H1 #H destruct
71   /2 width=1 by gr_eq_refl/
72 | #n2 #IH #i1 #f #Hf
73   elim (gr_pat_inv_succ_dx … Hf) -Hf [1,3: * |*: // ]
74   [ #g #j1 #Hg #H1 #H2 | #g #Hg #Ho ] destruct
75   <gr_tls_swap /2 width=2 by/
76 ]
77 qed-.