]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/steps/rtc_max.ma
some restyling ...
[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/steps/rtc_shift.ma".
16
17 (* RT-TRANSITION COUNTER ****************************************************)
18
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〉
22    ]
23 ].
24
25 interpretation "maximum (rtc)"
26    'or c1 c2 = (max c1 c2).
27
28 (* Basic properties *********************************************************)
29
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〉).
33 // qed.
34
35 lemma max_O_dx: ∀c. c = (c ∨ 𝟘𝟘).
36 * #ri #rs #ti #ts <max_rew //
37 qed.
38
39 lemma max_idem: ∀c. c = (c ∨ c).
40 * #ri #rs #ti #ts <max_rew //
41 qed.
42
43 (* Basic inversion properties ***********************************************)
44
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/
51 qed-.
52
53 (* Main Properties **********************************************************)
54
55 theorem max_assoc: associative … max.
56 * #ri1 #rs1 #ti1 #ts1 * #ri2 #rs2 #ti2 #ts2 * #ri3 #rs3 #ti3 #ts3
57 <max_rew <max_rew //
58 qed.
59
60 (* Properties with test for constrained rt-transition counter ***************)
61
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/
65 qed.
66
67 lemma isrt_max_O1: ∀n,c1,c2. 𝐑𝐓⦃0,c1⦄ → 𝐑𝐓⦃n,c2⦄ → 𝐑𝐓⦃n,c1∨c2⦄.
68 /2 width=1 by isrt_max/ qed.
69
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/
72 qed.
73
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/
76 qed.
77
78 (* Inversion properties with test for constrained rt-transition counter *****)
79
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/
85 qed-.
86
87 lemma isrt_O_inv_max: ∀c1,c2. 𝐑𝐓⦃0,c1 ∨ c2⦄ → ∧∧ 𝐑𝐓⦃0,c1⦄ & 𝐑𝐓⦃0,c2⦄.
88 #c1 #c2 #H
89 elim (isrt_inv_max … H) -H #n1 #n2 #Hn1 #Hn2 #H
90 elim (max_inv_O3 … H) -H #H1 #H2 destruct
91 /2 width=1 by conj/
92 qed-.
93
94 lemma isrt_inv_max_O_dx: ∀n,c1,c2. 𝐑𝐓⦃n,c1 ∨ c2⦄ → 𝐑𝐓⦃0,c2⦄ → 𝐑𝐓⦃n,c1⦄.
95 #n #c1 #c2 #H #H2
96 elim (isrt_inv_max … H) -H #n1 #n2 #Hn1 #Hn2 #H destruct
97 lapply (isrt_inj … Hn2 H2) -c2 #H destruct //
98 qed-.
99
100 lemma isrt_inv_max_eq_t: ∀n,c1,c2. 𝐑𝐓⦃n,c1 ∨ c2⦄ → eq_t c1 c2 →
101                          ∧∧ 𝐑𝐓⦃n,c1⦄ & 𝐑𝐓⦃n,c2⦄.
102 #n #c1 #c2 #H #Hc12
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/
107 qed-.
108
109 (* Properties with shift ****************************************************)
110
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 //
114 qed.
115
116 (* Inversion lemmaswith shift ***********************************************)
117
118 lemma isrt_inv_max_shift_sn: ∀n,c1,c2. 𝐑𝐓⦃n,↕*c1 ∨ c2⦄ →
119                              ∧∧ 𝐑𝐓⦃0,c1⦄ & 𝐑𝐓⦃n,c2⦄.
120 #n #c1 #c2 #H
121 elim (isrt_inv_max … H) -H #n1 #n2 #Hc1 #Hc2 #H destruct
122 elim (isrt_inv_shift … Hc1) -Hc1 #Hc1 * -n1
123 /2 width=1 by conj/
124 qed-.