]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/steps/rtc_plus.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / steps / rtc_plus.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/xoa/ex_3_2.ma".
16 include "ground_2/xoa/ex_6_8.ma".
17 include "ground_2/steps/rtc_isrt.ma".
18
19 (* RT-TRANSITION COUNTER ****************************************************)
20
21 definition plus (c1:rtc) (c2:rtc): rtc ≝ match c1 with [
22    mk_rtc ri1 rs1 ti1 ts1 ⇒ match c2 with [
23       mk_rtc ri2 rs2 ti2 ts2 ⇒ 〈ri1+ri2,rs1+rs2,ti1+ti2,ts1+ts2〉
24    ]
25 ].
26
27 interpretation "plus (rtc)"
28    'plus c1 c2 = (plus c1 c2).
29
30 (* Basic properties *********************************************************)
31
32 (**) (* plus is not disambiguated parentheses *)
33 lemma plus_rew: ∀ri1,ri2,rs1,rs2,ti1,ti2,ts1,ts2.
34                  〈ri1+ri2,rs1+rs2,ti1+ti2,ts1+ts2〉 =
35                  (〈ri1,rs1,ti1,ts1〉) + (〈ri2,rs2,ti2,ts2〉).
36 // qed.
37
38 lemma plus_O_dx: ∀c. c = c + 𝟘𝟘.
39 * #ri #rs #ti #ts <plus_rew //
40 qed.
41
42 (* Basic inversion properties ***********************************************)
43
44 lemma plus_inv_dx: ∀ri,rs,ti,ts,c1,c2. 〈ri,rs,ti,ts〉 = c1 + c2 →
45                    ∃∃ri1,rs1,ti1,ts1,ri2,rs2,ti2,ts2.
46                    ri1+ri2 = ri & rs1+rs2 = rs & ti1+ti2 = ti & ts1+ts2 = ts &
47                    〈ri1,rs1,ti1,ts1〉 = c1 & 〈ri2,rs2,ti2,ts2〉 = c2.
48 #ri #rs #ti #ts * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2
49 <plus_rew #H destruct /2 width=14 by ex6_8_intro/
50 qed-.
51
52 (* Main Properties **********************************************************)
53
54 theorem plus_assoc: associative … plus.
55 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2 * #ri3 #rs3 #ti3 #ts3
56 <plus_rew //
57 qed.
58
59 (* Properties with test for constrained rt-transition counter ***************)
60
61 lemma isrt_plus: ∀n1,n2,c1,c2. 𝐑𝐓❪n1,c1❫ → 𝐑𝐓❪n2,c2❫ → 𝐑𝐓❪n1+n2,c1+c2❫.
62 #n1 #n2 #c1 #c2 * #ri1 #rs1 #H1 * #ri2 #rs2 #H2 destruct
63 /2 width=3 by ex1_2_intro/
64 qed.
65
66 lemma isrt_plus_O1: ∀n,c1,c2. 𝐑𝐓❪0,c1❫ → 𝐑𝐓❪n,c2❫ → 𝐑𝐓❪n,c1+c2❫.
67 /2 width=1 by isrt_plus/ qed.
68
69 lemma isrt_plus_O2: ∀n,c1,c2. 𝐑𝐓❪n,c1❫ → 𝐑𝐓❪0,c2❫ → 𝐑𝐓❪n,c1+c2❫.
70 #n #c1 #c2 #H1 #H2 >(plus_n_O n) /2 width=1 by isrt_plus/
71 qed.
72
73 lemma isrt_succ: ∀n,c. 𝐑𝐓❪n,c❫ → 𝐑𝐓❪↑n,c+𝟘𝟙❫.
74 /2 width=1 by isrt_plus/ qed.
75
76 (* Inversion properties with test for constrained rt-transition counter *****)
77
78 lemma isrt_inv_plus: ∀n,c1,c2. 𝐑𝐓❪n,c1 + c2❫ →
79                      ∃∃n1,n2. 𝐑𝐓❪n1,c1❫ & 𝐑𝐓❪n2,c2❫ & n1 + n2 = n.
80 #n #c1 #c2 * #ri #rs #H
81 elim (plus_inv_dx … H) -H #ri1 #rs1 #ti1 #ts1 #ri2 #rs2 #ti2 #ts2 #_ #_ #H1 #H2 #H3 #H4
82 elim (plus_inv_O3 … H1) -H1 /3 width=5 by ex3_2_intro, ex1_2_intro/
83 qed-.
84
85 lemma isrt_inv_plus_O_dx: ∀n,c1,c2. 𝐑𝐓❪n,c1 + c2❫ → 𝐑𝐓❪0,c2❫ → 𝐑𝐓❪n,c1❫.
86 #n #c1 #c2 #H #H2
87 elim (isrt_inv_plus … H) -H #n1 #n2 #Hn1 #Hn2 #H destruct
88 lapply (isrt_inj … Hn2 H2) -c2 #H destruct //
89 qed-.
90
91 lemma isrt_inv_plus_SO_dx: ∀n,c1,c2. 𝐑𝐓❪n,c1 + c2❫ → 𝐑𝐓❪1,c2❫ →
92                            ∃∃m. 𝐑𝐓❪m,c1❫ & n = ↑m.
93 #n #c1 #c2 #H #H2
94 elim (isrt_inv_plus … H) -H #n1 #n2 #Hn1 #Hn2 #H destruct
95 lapply (isrt_inj … Hn2 H2) -c2 #H destruct
96 /2 width=3 by ex2_intro/
97 qed-.