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 "lambda/terms/multiplicity.ma".
17 (* SEQUENTIAL REDUCTION (SINGLE STEP) ***************************************)
19 (* Note: the application "(A B)" is represented by "@B.A" following:
20 F. Kamareddine and R.P. Nederpelt: "A useful λ-notation".
21 Theoretical Computer Science 155(1), Elsevier (1996), pp. 85-109.
23 inductive sred: relation term ≝
24 | sred_beta : ∀B,A. sred (@B.𝛌.A) ([↙B]A)
25 | sred_abst : ∀A1,A2. sred A1 A2 → sred (𝛌.A1) (𝛌.A2)
26 | sred_appl_sn: ∀B1,B2,A. sred B1 B2 → sred (@B1.A) (@B2.A)
27 | sred_appl_dx: ∀B,A1,A2. sred A1 A2 → sred (@B.A1) (@B.A2)
30 interpretation "sequential reduction"
31 'SeqRed M N = (sred M N).
33 lemma sred_inv_vref: ∀M,N. M ↦ N → ∀i. #i = M → ⊥.
35 [ #B #A #i #H destruct
36 | #A1 #A2 #_ #i #H destruct
37 | #B1 #B2 #A #_ #i #H destruct
38 | #B #A1 #A2 #_ #i #H destruct
42 lemma sred_inv_abst: ∀M,N. M ↦ N → ∀C1. 𝛌.C1 = M →
43 ∃∃C2. C1 ↦ C2 & 𝛌.C2 = N.
45 [ #B #A #C1 #H destruct
46 | #A1 #A2 #HA12 #C1 #H destruct /2 width=3/
47 | #B1 #B2 #A #_ #C1 #H destruct
48 | #B #A1 #A2 #_ #C1 #H destruct
52 lemma sred_inv_appl: ∀M,N. M ↦ N → ∀D,C. @D.C = M →
53 ∨∨ (∃∃C0. 𝛌.C0 = C & [↙D] C0 = N)
54 | (∃∃D0. D ↦ D0 & @D0.C = N)
55 | (∃∃C0. C ↦ C0 & @D.C0 = N).
57 [ #B #A #D #C #H destruct /3 width=3/
58 | #A1 #A2 #_ #D #C #H destruct
59 | #B1 #B2 #A #HB12 #D #C #H destruct /3 width=3/
60 | #B #A1 #A2 #HA12 #D #C #H destruct /3 width=3/
64 lemma sred_fwd_mult: ∀M,N. M ↦ N → ♯{N} < ♯{M} * ♯{M}.
66 [ #B #A @(le_to_lt_to_lt … (♯{A}*♯{B})) //
67 normalize /3 width=1 by lt_minus_to_plus_r, lt_times/ (**) (* auto: too slow without trace *)
70 @(lt_to_le_to_lt … (♯{B}*♯{B}+♯{A})) [ /2 width=1/ ] -D
72 @(lt_to_le_to_lt … (♯{B}+♯{A}*♯{A})) [ /2 width=1/ ] -C
74 @(transitive_le … (♯{B}*♯{B}+♯{A}*♯{A})) [ /2 width=1/ ]
75 >distributive_times_plus normalize /2 width=1/
78 lemma sred_lift: liftable sred.
79 #h #M1 #M2 #H elim H -M1 -M2 normalize /2 width=1/
80 #B #A #d <dsubst_lift_le //
83 lemma sred_inv_lift: deliftable_sn sred.
84 #h #N1 #N2 #H elim H -N1 -N2
86 elim (lift_inv_appl … H) -H #B #M #H0 #HM #H destruct
87 elim (lift_inv_abst … HM) -HM #A #H0 #H destruct /3 width=3/
88 | #C1 #C2 #_ #IHC12 #d #M1 #H
89 elim (lift_inv_abst … H) -H #A1 #HAC1 #H
90 elim (IHC12 … HAC1) -C1 #A2 #HA12 #HAC2 destruct
91 @(ex2_intro … (𝛌.A2)) // /2 width=1/
92 | #D1 #D2 #C1 #_ #IHD12 #d #M1 #H
93 elim (lift_inv_appl … H) -H #B1 #A #HBD1 #H1 #H2
94 elim (IHD12 … HBD1) -D1 #B2 #HB12 #HBD2 destruct
95 @(ex2_intro … (@B2.A)) // /2 width=1/
96 | #D1 #C1 #C2 #_ #IHC12 #d #M1 #H
97 elim (lift_inv_appl … H) -H #B #A1 #H1 #HAC1 #H2
98 elim (IHC12 … HAC1) -C1 #A2 #HA12 #HAC2 destruct
99 @(ex2_intro … (@B.A2)) // /2 width=1/
103 lemma sred_dsubst: dsubstable_dx sred.
104 #D1 #M1 #M2 #H elim H -M1 -M2 normalize /2 width=1/
105 #D2 #A #d >dsubst_dsubst_ge //