]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/relocation/trace_isid.ma
theory of generic slicing almost completed ....
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / relocation / trace_isid.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_2/notation/relations/isid_1.ma".
16 include "ground_2/relocation/trace_after.ma".
17
18 (* RELOCATION TRACE *********************************************************)
19
20 definition isid: predicate trace ≝ λcs. ∥cs∥ = |cs|.
21
22 interpretation "test for identity (trace)"
23    'IsId cs = (isid cs).
24
25 (* Basic properties *********************************************************)
26
27 lemma isid_empty: 𝐈⦃◊⦄.
28 // qed.
29
30 lemma isid_true: ∀cs. 𝐈⦃cs⦄ → 𝐈⦃Ⓣ @ cs⦄.
31 // qed.
32
33 (* Basic inversion lemmas ***************************************************)
34
35 lemma isid_inv_true: ∀cs. 𝐈⦃Ⓣ @ cs⦄ → 𝐈⦃cs⦄.
36 /2 width=1 by injective_S/ qed-.
37
38 lemma isid_inv_false: ∀cs. 𝐈⦃Ⓕ @ cs⦄ → ⊥.
39 /3 width=4 by colength_le, lt_le_false/ qed-.
40
41 lemma isid_inv_cons: ∀cs,b.  𝐈⦃b @ cs⦄ → 𝐈⦃cs⦄ ∧ b = Ⓣ.
42 #cs * #H /3 width=1 by isid_inv_true, conj/
43 elim (isid_inv_false … H)
44 qed-.
45
46 (* Properties on application ************************************************)
47
48 lemma isid_at: ∀cs. (∀i1,i2. @⦃i1, cs⦄ ≡ i2 → i1 = i2) → 𝐈⦃cs⦄.
49 #cs elim cs -cs // * /2 width=1 by/
50 qed.
51
52 (* Inversion lemmas on application ******************************************)
53
54 lemma isid_inv_at: ∀cs,i1,i2. @⦃i1, cs⦄ ≡ i2 → 𝐈⦃cs⦄ → i1 = i2.
55 #cs #i1 #i2 #H elim H -cs -i1 -i2 /4 width=1 by isid_inv_true, eq_f/
56 #cs #i1 #i2 #_ #IH #H elim (isid_inv_false … H)
57 qed-.
58
59 (* Properties on composition ************************************************)
60
61 lemma isid_after_sn: ∀cs2. ∃∃cs1. 𝐈⦃cs1⦄ & cs1 ⊚ cs2 ≡ cs2.
62 #cs2 elim cs2 -cs2 /2 width=3 by after_empty, ex2_intro/
63 #b #cs2 * /3 width=3 by isid_true, after_true, ex2_intro/
64 qed-.
65
66 lemma isid_after_dx: ∀cs1. ∃∃cs2. 𝐈⦃cs2⦄ & cs1 ⊚ cs2 ≡ cs1.
67 #cs1 elim cs1 -cs1 /2 width=3 by after_empty, ex2_intro/
68 * #cs1 * /3 width=3 by isid_true, after_true, after_false, ex2_intro/
69 qed-.
70
71 lemma after_isid_sn: ∀cs1,cs2. cs1 ⊚ cs2 ≡ cs2 → 𝐈⦃cs1⦄ .
72 #cs1 #cs2 #H elim (after_inv_length … H) -H //
73 qed.
74
75 lemma after_isid_dx: ∀cs1,cs2. cs1 ⊚ cs2 ≡ cs1 → 𝐈⦃cs2⦄ .
76 #cs1 #cs2 #H elim (after_inv_length … H) -H //
77 qed.
78
79 (* Inversion lemmas on composition ******************************************)
80
81 lemma after_isid_inv_sn: ∀cs1,cs2,cs. cs1 ⊚ cs2 ≡ cs → 𝐈⦃cs1⦄ → cs = cs2.
82 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs //
83 #cs1 #cs2 #cs #_ [ #b ] #IH #H
84 [ >IH -IH // | elim (isid_inv_false … H) ]
85 qed-.
86
87 lemma after_isid_inv_dx: ∀cs1,cs2,cs. cs1 ⊚ cs2 ≡ cs → 𝐈⦃cs2⦄ → cs = cs1.
88 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs //
89 #cs1 #cs2 #cs #_ [ #b ] #IH #H
90 [ elim (isid_inv_cons … H) -H #H >IH -IH // | >IH -IH // ]
91 qed-.
92
93 lemma after_inv_isid3: ∀t1,t2,t. t1 ⊚ t2 ≡ t → 𝐈⦃t⦄ → 𝐈⦃t1⦄ ∧ 𝐈⦃t2⦄.
94 #t1 #t2 #t #H elim H -t1 -t2 -t
95 [ /2 width=1 by conj/
96 | #t1 #t2 #t #_ #b #IHt #H elim (isid_inv_cons … H) -H
97   #Ht #H elim (IHt Ht) -t /2 width=1 by isid_true, conj/
98 | #t1 #t2 #t #_ #_ #H elim (isid_inv_false … H)
99 ]
100 qed-.