]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/steps/rtc_max.ma
update in ground_2, static_2, basic_2
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / steps / rtc_max.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_shift.ma".
18
19 (* RT-TRANSITION COUNTER ****************************************************)
20
21 definition max (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 "maximum (rtc)"
28    'or c1 c2 = (max c1 c2).
29
30 (* Basic properties *********************************************************)
31
32 lemma max_rew: ∀ri1,ri2,rs1,rs2,ti1,ti2,ts1,ts2.
33                  〈ri1∨ri2,rs1∨rs2,ti1∨ti2,ts1∨ts2〉 =
34                  (〈ri1,rs1,ti1,ts1〉 ∨ 〈ri2,rs2,ti2,ts2〉).
35 // qed.
36
37 lemma max_O_dx: ∀c. c = (c ∨ 𝟘𝟘).
38 * #ri #rs #ti #ts <max_rew //
39 qed.
40
41 lemma max_idem: ∀c. c = (c ∨ c).
42 * #ri #rs #ti #ts <max_rew //
43 qed.
44
45 (* Basic inversion properties ***********************************************)
46
47 lemma max_inv_dx: ∀ri,rs,ti,ts,c1,c2. 〈ri,rs,ti,ts〉 = (c1 ∨ c2) →
48                   ∃∃ri1,rs1,ti1,ts1,ri2,rs2,ti2,ts2.
49                   (ri1∨ri2) = ri & (rs1∨rs2) = rs & (ti1∨ti2) = ti & (ts1∨ts2) = ts &
50                   〈ri1,rs1,ti1,ts1〉 = c1 & 〈ri2,rs2,ti2,ts2〉 = c2.
51 #ri #rs #ti #ts * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2
52 <max_rew #H destruct /2 width=14 by ex6_8_intro/
53 qed-.
54
55 (* Main Properties **********************************************************)
56
57 theorem max_assoc: associative … max.
58 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2 * #ri3 #rs3 #ti3 #ts3
59 <max_rew <max_rew //
60 qed.
61
62 (* Properties with test for constrained rt-transition counter ***************)
63
64 lemma isrt_max: ∀n1,n2,c1,c2. 𝐑𝐓⦃n1,c1⦄ → 𝐑𝐓⦃n2,c2⦄ → 𝐑𝐓⦃n1∨n2,c1∨c2⦄.
65 #n1 #n2 #c1 #c2 * #ri1 #rs1 #H1 * #ri2 #rs2 #H2 destruct
66 /2 width=3 by ex1_2_intro/
67 qed.
68
69 lemma isrt_max_O1: ∀n,c1,c2. 𝐑𝐓⦃0,c1⦄ → 𝐑𝐓⦃n,c2⦄ → 𝐑𝐓⦃n,c1∨c2⦄.
70 /2 width=1 by isrt_max/ qed.
71
72 lemma isrt_max_O2: ∀n,c1,c2. 𝐑𝐓⦃n,c1⦄ → 𝐑𝐓⦃0,c2⦄ → 𝐑𝐓⦃n,c1∨c2⦄.
73 #n #c1 #c2 #H1 #H2 >(max_O2 n) /2 width=1 by isrt_max/
74 qed.
75
76 lemma isrt_max_idem1: ∀n,c1,c2. 𝐑𝐓⦃n,c1⦄ → 𝐑𝐓⦃n,c2⦄ → 𝐑𝐓⦃n,c1∨c2⦄.
77 #n #c1 #c2 #H1 #H2 >(idempotent_max n) /2 width=1 by isrt_max/
78 qed.
79
80 (* Inversion properties with test for constrained rt-transition counter *****)
81
82 lemma isrt_inv_max: ∀n,c1,c2. 𝐑𝐓⦃n,c1 ∨ c2⦄ →
83                     ∃∃n1,n2. 𝐑𝐓⦃n1,c1⦄ & 𝐑𝐓⦃n2,c2⦄ & (n1 ∨ n2) = n.
84 #n #c1 #c2 * #ri #rs #H
85 elim (max_inv_dx … H) -H #ri1 #rs1 #ti1 #ts1 #ri2 #rs2 #ti2 #ts2 #_ #_ #H1 #H2 #H3 #H4
86 elim (max_inv_O3 … H1) -H1 /3 width=5 by ex3_2_intro, ex1_2_intro/
87 qed-.
88
89 lemma isrt_O_inv_max: ∀c1,c2. 𝐑𝐓⦃0,c1 ∨ c2⦄ → ∧∧ 𝐑𝐓⦃0,c1⦄ & 𝐑𝐓⦃0,c2⦄.
90 #c1 #c2 #H
91 elim (isrt_inv_max … H) -H #n1 #n2 #Hn1 #Hn2 #H
92 elim (max_inv_O3 … H) -H #H1 #H2 destruct
93 /2 width=1 by conj/
94 qed-.
95
96 lemma isrt_inv_max_O_dx: ∀n,c1,c2. 𝐑𝐓⦃n,c1 ∨ c2⦄ → 𝐑𝐓⦃0,c2⦄ → 𝐑𝐓⦃n,c1⦄.
97 #n #c1 #c2 #H #H2
98 elim (isrt_inv_max … H) -H #n1 #n2 #Hn1 #Hn2 #H destruct
99 lapply (isrt_inj … Hn2 H2) -c2 #H destruct //
100 qed-.
101
102 lemma isrt_inv_max_eq_t: ∀n,c1,c2. 𝐑𝐓⦃n,c1 ∨ c2⦄ → eq_t c1 c2 →
103                          ∧∧ 𝐑𝐓⦃n,c1⦄ & 𝐑𝐓⦃n,c2⦄.
104 #n #c1 #c2 #H #Hc12
105 elim (isrt_inv_max … H) -H #n1 #n2 #Hc1 #Hc2 #H destruct
106 lapply (isrt_eq_t_trans … Hc1 … Hc12) -Hc12 #H
107 <(isrt_inj … H … Hc2) -Hc2
108 <idempotent_max /2 width=1 by conj/
109 qed-.
110
111 (* Properties with shift ****************************************************)
112
113 lemma max_shift: ∀c1,c2. ((↕*c1) ∨ (↕*c2)) = ↕*(c1∨c2).
114 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2
115 <shift_rew <shift_rew <shift_rew <max_rew //
116 qed.
117
118 (* Inversion lemmaswith shift ***********************************************)
119
120 lemma isrt_inv_max_shift_sn: ∀n,c1,c2. 𝐑𝐓⦃n,↕*c1 ∨ c2⦄ →
121                              ∧∧ 𝐑𝐓⦃0,c1⦄ & 𝐑𝐓⦃n,c2⦄.
122 #n #c1 #c2 #H
123 elim (isrt_inv_max … H) -H #n1 #n2 #Hc1 #Hc2 #H destruct
124 elim (isrt_inv_shift … Hc1) -Hc1 #Hc1 * -n1
125 /2 width=1 by conj/
126 qed-.