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