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/steps/rtc_shift.ma".
17 (* RT-TRANSITION COUNTER ****************************************************)
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〉
25 interpretation "plus (rtc)"
26 'plus c1 c2 = (plus c1 c2).
28 (* Basic properties *********************************************************)
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 *)
35 lemma plus_O_dx: ∀c. c = c + 𝟘𝟘.
36 * #ri #rs #ti #ts <plus_rew //
39 (* Basic inversion properties ***********************************************)
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/
49 (* Main Properties **********************************************************)
51 theorem plus_assoc: associative … plus.
52 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2 * #ri3 #rs3 #ti3 #ts3
56 (* Properties with test for constrained rt-transition counter ***************)
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/
63 lemma isrt_plus_O1: ∀n,c1,c2. 𝐑𝐓⦃0, c1⦄ → 𝐑𝐓⦃n, c2⦄ → 𝐑𝐓⦃n, c1+c2⦄.
64 /2 width=1 by isrt_plus/ qed.
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/
70 lemma isrt_succ: ∀n,c. 𝐑𝐓⦃n, c⦄ → 𝐑𝐓⦃⫯n, c+𝟘𝟙⦄.
71 /2 width=1 by isrt_plus/ qed.
73 (* Inversion properties with test for constrained rt-transition counter *****)
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/
82 lemma isrt_inv_plus_O_dx: ∀n,c1,c2. 𝐑𝐓⦃n, c1 + c2⦄ → 𝐑𝐓⦃0, c2⦄ → 𝐑𝐓⦃n, c1⦄.
84 elim (isrt_inv_plus … H) -H #n1 #n2 #Hn1 #Hn2 #H destruct
85 lapply (isrt_mono … Hn2 H2) -c2 #H destruct //
88 lemma isrt_inv_plus_SO_dx: ∀n,c1,c2. 𝐑𝐓⦃n, c1 + c2⦄ → 𝐑𝐓⦃1, c2⦄ →
89 ∃∃m. 𝐑𝐓⦃m, c1⦄ & n = ⫯m.
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/
96 (* Properties with shift ****************************************************)
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 //