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