]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/etc/relocation/trace_isid.etc
ground_2 released and permanently renamed as ground
[helm.git] / matita / matita / contribs / lambdadelta / ground / etc / relocation / trace_isid.etc
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/isidentity_1.ma".
16 include "ground_2/relocation/trace_after.ma".
17 include "ground_2/relocation/trace_sle.ma".
18
19 (* RELOCATION TRACE *********************************************************)
20
21 definition isid: predicate trace ≝ λcs. ∥cs∥ = |cs|.
22
23 interpretation "test for identity (trace)"
24    'IsIdentity cs = (isid cs).
25
26 definition t_reflexive: ∀S:Type[0]. predicate (trace → relation S) ≝
27                         λS,R. ∀a. ∃∃t. 𝐈⦃t⦄ & R t a a.
28
29 (* Basic properties *********************************************************)
30
31 lemma isid_empty: 𝐈⦃◊⦄.
32 // qed.
33
34 lemma isid_true: ∀cs. 𝐈⦃cs⦄ → 𝐈⦃Ⓣ @ cs⦄.
35 // qed.
36
37 (* Basic inversion lemmas ***************************************************)
38
39 lemma isid_inv_true: ∀cs. 𝐈⦃Ⓣ @ cs⦄ → 𝐈⦃cs⦄.
40 /2 width=1 by injective_S/ qed-.
41
42 lemma isid_inv_false: ∀cs. 𝐈⦃Ⓕ @ cs⦄ → ⊥.
43 /3 width=4 by colength_le, lt_le_false/ qed-.
44
45 lemma isid_inv_cons: ∀cs,b.  𝐈⦃b @ cs⦄ → 𝐈⦃cs⦄ ∧ b = Ⓣ.
46 #cs * #H /3 width=1 by isid_inv_true, conj/
47 elim (isid_inv_false … H)
48 qed-.
49
50 (* Properties on application ************************************************)
51
52 lemma isid_at: ∀cs. (∀i1,i2. @⦃i1, cs⦄ ≡ i2 → i1 = i2) → 𝐈⦃cs⦄.
53 #cs elim cs -cs // * /2 width=1 by/
54 qed.
55
56 (* Inversion lemmas on application ******************************************)
57
58 lemma isid_inv_at: ∀cs,i1,i2. @⦃i1, cs⦄ ≡ i2 → 𝐈⦃cs⦄ → i1 = i2.
59 #cs #i1 #i2 #H elim H -cs -i1 -i2 /4 width=1 by isid_inv_true, eq_f/
60 #cs #i1 #i2 #_ #IH #H elim (isid_inv_false … H)
61 qed-.
62
63 (* Properties on composition ************************************************)
64
65 lemma isid_after_sn: ∀cs2. ∃∃cs1. 𝐈⦃cs1⦄ & cs1 ⊚ cs2 ≡ cs2.
66 #cs2 elim cs2 -cs2 /2 width=3 by after_empty, ex2_intro/
67 #b #cs2 * /3 width=3 by isid_true, after_true, ex2_intro/
68 qed-.
69
70 lemma isid_after_dx: ∀cs1. ∃∃cs2. 𝐈⦃cs2⦄ & cs1 ⊚ cs2 ≡ cs1.
71 #cs1 elim cs1 -cs1 /2 width=3 by after_empty, ex2_intro/
72 * #cs1 * /3 width=3 by isid_true, after_true, after_false, ex2_intro/
73 qed-.
74
75 lemma after_isid_sn: ∀cs1,cs2. cs1 ⊚ cs2 ≡ cs2 → 𝐈⦃cs1⦄ .
76 #cs1 #cs2 #H elim (after_inv_length … H) -H //
77 qed.
78
79 lemma after_isid_dx: ∀cs1,cs2. cs1 ⊚ cs2 ≡ cs1 → 𝐈⦃cs2⦄ .
80 #cs1 #cs2 #H elim (after_inv_length … H) -H //
81 qed.
82
83 (* Inversion lemmas on composition ******************************************)
84
85 lemma after_isid_inv_sn: ∀cs1,cs2,cs. cs1 ⊚ cs2 ≡ cs → 𝐈⦃cs1⦄ → cs = cs2.
86 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs //
87 #cs1 #cs2 #cs #_ [ #b ] #IH #H
88 [ >IH -IH // | elim (isid_inv_false … H) ]
89 qed-.
90
91 lemma after_isid_inv_dx: ∀cs1,cs2,cs. cs1 ⊚ cs2 ≡ cs → 𝐈⦃cs2⦄ → cs = cs1.
92 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs //
93 #cs1 #cs2 #cs #_ [ #b ] #IH #H
94 [ elim (isid_inv_cons … H) -H #H >IH -IH // | >IH -IH // ]
95 qed-.
96
97 lemma after_inv_isid3: ∀t1,t2,t. t1 ⊚ t2 ≡ t → 𝐈⦃t⦄ → 𝐈⦃t1⦄ ∧ 𝐈⦃t2⦄.
98 #t1 #t2 #t #H elim H -t1 -t2 -t
99 [ /2 width=1 by conj/
100 | #t1 #t2 #t #_ #b #IHt #H elim (isid_inv_cons … H) -H
101   #Ht #H elim (IHt Ht) -t /2 width=1 by isid_true, conj/
102 | #t1 #t2 #t #_ #_ #H elim (isid_inv_false … H)
103 ]
104 qed-.
105
106 (* Forward on inclusion *****************************************************)
107
108 lemma sle_isid1_fwd: ∀t1,t2. t1 ⊆ t2 → 𝐈⦃t1⦄ → t1 = t2.
109 #t1 #t2 #H elim H -t1 -t2 //
110 [ #t1 #t2 #_ #IH #H lapply (isid_inv_true … H) -H
111   #HT1 @eq_f2 // @IH @HT1 (**) (* full auto fails *)
112 | #t1 #t2 #b #_ #_ #H elim (isid_inv_false … H)
113 ]
114 qed-.