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_2/notation/relations/isid_1.ma".
16 include "ground_2/relocation/trace_after.ma".
18 (* RELOCATION TRACE *********************************************************)
20 definition isid: predicate trace ≝ λcs. ∥cs∥ = |cs|.
22 interpretation "test for identity (trace)"
25 (* Basic properties *********************************************************)
27 lemma isid_empty: 𝐈⦃◊⦄.
30 lemma isid_true: ∀cs. 𝐈⦃cs⦄ → 𝐈⦃Ⓣ @ cs⦄.
33 (* Basic inversion lemmas ***************************************************)
35 lemma isid_inv_true: ∀cs. 𝐈⦃Ⓣ @ cs⦄ → 𝐈⦃cs⦄.
36 /2 width=1 by injective_S/ qed-.
38 lemma isid_inv_false: ∀cs. 𝐈⦃Ⓕ @ cs⦄ → ⊥.
39 /3 width=4 by colength_le, lt_le_false/ qed-.
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)
46 (* Properties on application ************************************************)
48 lemma isid_at: ∀cs. (∀i1,i2. @⦃i1, cs⦄ ≡ i2 → i1 = i2) → 𝐈⦃cs⦄.
49 #cs elim cs -cs // * /2 width=1 by/
52 (* Inversion lemmas on application ******************************************)
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)
59 (* Properties on composition ************************************************)
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/
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/
71 lemma after_isid_sn: ∀cs1,cs2. cs1 ⊚ cs2 ≡ cs2 → 𝐈⦃cs1⦄ .
72 #cs1 #cs2 #H elim (after_inv_length … H) -H //
75 lemma after_isid_dx: ∀cs1,cs2. cs1 ⊚ cs2 ≡ cs1 → 𝐈⦃cs2⦄ .
76 #cs1 #cs2 #H elim (after_inv_length … H) -H //
79 (* Inversion lemmas on composition ******************************************)
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) ]
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 // ]
93 lemma after_inv_isid3: ∀t1,t2,t. t1 ⊚ t2 ≡ t → 𝐈⦃t⦄ → 𝐈⦃t1⦄ ∧ 𝐈⦃t2⦄.
94 #t1 #t2 #t #H elim H -t1 -t2 -t
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)