1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/arith/pnat_plus.ma".
16 include "ground/relocation/pr_tls.ma".
17 include "ground/relocation/pr_pat_eq.ma".
19 (* POSITIVE APPLICATION FOR PARTIAL RELOCATION MAPS *************************)
21 (* Constructions with pr_tls ************************************************)
23 (* Note: this requires ↑ on first n *)
25 lemma pr_pat_unit_succ_tls (n) (f):
26 @❨𝟏,f❩ ≘ ↑n → @❨𝟏,⫰*[n]f❩ ≘ 𝟏.
27 #n @(nat_ind_succ … n) -n //
29 elim (pr_pat_inv_unit_succ … Hf) -Hf [|*: // ] #g #Hg #H0 destruct
30 <pr_tls_swap /2 width=1 by/
33 (* Note: this requires ↑ on third n2 *)
35 lemma pr_pat_tls (n2) (f): ⫯⫰*[↑n2]f ≡ ⫰*[n2]f → ∃i1. @❨i1,f❩ ≘ ↑n2.
36 #n2 @(nat_ind_succ … n2) -n2
37 [ /4 width=4 by pr_pat_eq_repl_back, pr_pat_refl, ex_intro/
38 | #n2 #IH #f <pr_tls_swap <pr_tls_swap in ⊢ (??%→?); #H
39 elim (IH … H) -IH -H #i1 #Hf
40 elim (pr_map_split_tl f) #Hg destruct
41 /3 width=8 by pr_pat_push, pr_pat_next, ex_intro/
45 (* Inversions with pr_tls ***************************************************)
47 (* Note: this does not require ↑ on second and third p *)
49 lemma pr_pat_inv_succ_sn (p) (g) (i1) (j2):
50 @❨↑i1,g❩ ≘ j2 → @❨𝟏,g❩ ≘ p →
51 ∃∃i2. @❨i1,⫰*[p]g❩ ≘ i2 & p+i2 = j2.
54 elim (pr_pat_inv_unit_bi … H) -H [|*: // ] #f #H0
55 elim (pr_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 (pr_pat_inv_unit_succ … H) -H [|*: // ] #f #Hf2 #H0
59 elim (pr_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/
65 (* Note: this requires ↑ on first n2 *)
67 lemma pr_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 (pr_pat_inv_unit_dx … Hf) -Hf // #g #H1 #H destruct
71 /2 width=1 by pr_eq_refl/
73 elim (pr_pat_inv_succ_dx … Hf) -Hf [1,3: * |*: // ]
74 [ #g #j1 #Hg #H1 #H2 | #g #Hg #Ho ] destruct
75 <pr_tls_swap /2 width=2 by/