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 max (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 "maximum (rtc)"
26 'or c1 c2 = (max c1 c2).
28 (* Basic properties *********************************************************)
30 lemma max_rew: ∀ri1,ri2,rs1,rs2,ti1,ti2,ts1,ts2.
31 〈ri1∨ri2, rs1∨rs2, ti1∨ti2, ts1∨ts2〉 =
32 (〈ri1,rs1,ti1,ts1〉 ∨ 〈ri2,rs2,ti2,ts2〉).
35 lemma max_O_dx: ∀c. c = (c ∨ 𝟘𝟘).
36 * #ri #rs #ti #ts <max_rew //
39 lemma max_idem: ∀c. c = (c ∨ c).
40 * #ri #rs #ti #ts <max_rew //
43 (* Basic inversion properties ***********************************************)
45 lemma max_inv_dx: ∀ri,rs,ti,ts,c1,c2. 〈ri,rs,ti,ts〉 = (c1 ∨ c2) →
46 ∃∃ri1,rs1,ti1,ts1,ri2,rs2,ti2,ts2.
47 (ri1∨ri2) = ri & (rs1∨rs2) = rs & (ti1∨ti2) = ti & (ts1∨ts2) = ts &
48 〈ri1,rs1,ti1,ts1〉 = c1 & 〈ri2,rs2,ti2,ts2〉 = c2.
49 #ri #rs #ti #ts * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2
50 <max_rew #H destruct /2 width=14 by ex6_8_intro/
53 (* Main Properties **********************************************************)
55 theorem max_assoc: associative … max.
56 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2 * #ri3 #rs3 #ti3 #ts3
60 (* Properties with test for constrained rt-transition counter ***************)
62 lemma isrt_max: ∀n1,n2,c1,c2. 𝐑𝐓⦃n1, c1⦄ → 𝐑𝐓⦃n2, c2⦄ → 𝐑𝐓⦃n1∨n2, c1∨c2⦄.
63 #n1 #n2 #c1 #c2 * #ri1 #rs1 #H1 * #ri2 #rs2 #H2 destruct
64 /2 width=3 by ex1_2_intro/
67 lemma isrt_max_O1: ∀n,c1,c2. 𝐑𝐓⦃0, c1⦄ → 𝐑𝐓⦃n, c2⦄ → 𝐑𝐓⦃n, c1∨c2⦄.
68 /2 width=1 by isrt_max/ qed.
70 lemma isrt_max_O2: ∀n,c1,c2. 𝐑𝐓⦃n, c1⦄ → 𝐑𝐓⦃0, c2⦄ → 𝐑𝐓⦃n, c1∨c2⦄.
71 #n #c1 #c2 #H1 #H2 >(max_O2 n) /2 width=1 by isrt_max/
74 lemma isrt_max_idem1: ∀n,c1,c2. 𝐑𝐓⦃n, c1⦄ → 𝐑𝐓⦃n, c2⦄ → 𝐑𝐓⦃n, c1∨c2⦄.
75 #n #c1 #c2 #H1 #H2 >(idempotent_max n) /2 width=1 by isrt_max/
78 (* Inversion properties with test for constrained rt-transition counter *****)
80 lemma isrt_inv_max: ∀n,c1,c2. 𝐑𝐓⦃n, c1 ∨ c2⦄ →
81 ∃∃n1,n2. 𝐑𝐓⦃n1, c1⦄ & 𝐑𝐓⦃n2, c2⦄ & (n1 ∨ n2) = n.
82 #n #c1 #c2 * #ri #rs #H
83 elim (max_inv_dx … H) -H #ri1 #rs1 #ti1 #ts1 #ri2 #rs2 #ti2 #ts2 #_ #_ #H1 #H2 #H3 #H4
84 elim (max_inv_O3 … H1) -H1 /3 width=5 by ex3_2_intro, ex1_2_intro/
87 lemma isrt_O_inv_max: ∀c1,c2. 𝐑𝐓⦃0, c1 ∨ c2⦄ → ∧∧ 𝐑𝐓⦃0, c1⦄ & 𝐑𝐓⦃0, c2⦄.
89 elim (isrt_inv_max … H) -H #n1 #n2 #Hn1 #Hn2 #H
90 elim (max_inv_O3 … H) -H #H1 #H2 destruct
94 lemma isrt_inv_max_O_dx: ∀n,c1,c2. 𝐑𝐓⦃n, c1 ∨ c2⦄ → 𝐑𝐓⦃0, c2⦄ → 𝐑𝐓⦃n, c1⦄.
96 elim (isrt_inv_max … H) -H #n1 #n2 #Hn1 #Hn2 #H destruct
97 lapply (isrt_inj … Hn2 H2) -c2 #H destruct //
100 lemma isrt_inv_max_eq_t: ∀n,c1,c2. 𝐑𝐓⦃n, c1 ∨ c2⦄ → eq_t c1 c2 →
101 ∧∧ 𝐑𝐓⦃n, c1⦄ & 𝐑𝐓⦃n, c2⦄.
103 elim (isrt_inv_max … H) -H #n1 #n2 #Hc1 #Hc2 #H destruct
104 lapply (isrt_eq_t_trans … Hc1 … Hc12) -Hc12 #H
105 <(isrt_inj … H … Hc2) -Hc2
106 <idempotent_max /2 width=1 by conj/
109 (* Properties with shift ****************************************************)
111 lemma max_shift: ∀c1,c2. ((↕*c1) ∨ (↕*c2)) = ↕*(c1∨c2).
112 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2
113 <shift_rew <shift_rew <shift_rew <max_rew //
116 (* Inversion lemmaswith shift ***********************************************)
118 lemma isrt_inv_max_shift_sn: ∀n,c1,c2. 𝐑𝐓⦃n, ↕*c1 ∨ c2⦄ →
119 ∧∧ 𝐑𝐓⦃0, c1⦄ & 𝐑𝐓⦃n, c2⦄.
121 elim (isrt_inv_max … H) -H #n1 #n2 #Hc1 #Hc2 #H destruct
122 elim (isrt_inv_shift … Hc1) -Hc1 #Hc1 * -n1