]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/substitution/llor.ma
- theory of llor now includes (long awaited) non-recursive alternative definition
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / substitution / llor.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 "basic_2/notation/relations/lazyor_4.ma".
16 include "basic_2/relocation/lpx_sn.ma".
17 include "basic_2/substitution/cofrees.ma".
18
19 (* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
20
21 inductive clor (T) (L2) (K1) (V1): predicate term ≝
22 | clor_sn: |K1| < |L2| → K1 ⊢ |L2|-|K1|-1 ~ϵ 𝐅*[yinj 0]⦃T⦄ → clor T L2 K1 V1 V1
23 | clor_dx: ∀I,K2,V2. |K1| < |L2| → (K1 ⊢ |L2|-|K1|-1 ~ϵ 𝐅*[yinj 0]⦃T⦄ → ⊥) →
24            ⇩[|L2|-|K1|-1] L2 ≡ K2.ⓑ{I}V2 → clor T L2 K1 V1 V2
25 .
26
27 definition llor: relation4 term lenv lenv lenv ≝
28                  λT,L2. lpx_sn (clor T L2).
29
30 interpretation
31    "lazy union (local environment)"
32    'LazyOr L1 T L2 L = (llor T L2 L1 L).
33
34 (* Basic properties *********************************************************)
35
36 lemma llor_pair_sn: ∀I,L1,L2,L,V,T. L1 ⩖[T] L2 ≡ L →
37                     |L1| < |L2| → L1 ⊢ |L2|-|L1|-1 ~ϵ 𝐅*[yinj 0]⦃T⦄ →
38                     L1.ⓑ{I}V ⩖[T] L2 ≡ L.ⓑ{I}V.
39 /3 width=2 by clor_sn, lpx_sn_pair/ qed.
40
41 lemma llor_pair_dx: ∀I,J,L1,L2,L,K2,V1,V2,T. L1 ⩖[T] L2 ≡ L →
42                     |L1| < |L2| → (L1 ⊢ |L2|-|L1|-1 ~ϵ 𝐅*[yinj 0]⦃T⦄ → ⊥) →
43                     ⇩[|L2|-|L1|-1] L2 ≡ K2.ⓑ{J}V2 →
44                     L1.ⓑ{I}V1 ⩖[T] L2 ≡ L.ⓑ{I}V2.
45 /4 width=3 by clor_dx, lpx_sn_pair/ qed.
46
47 lemma llor_total: ∀T,L2,L1. |L1| ≤ |L2| → ∃L. L1 ⩖[T] L2 ≡ L.
48 #T #L2 #L1 elim L1 -L1 /2 width=2 by ex_intro/
49 #L1 #I1 #V1 #IHL1 normalize
50 #H elim IHL1 -IHL1 /2 width=3 by transitive_le/
51 #L #HT elim (cofrees_dec L1 T 0 (|L2|-|L1|-1))
52 [ /3 width=2 by llor_pair_sn, ex_intro/
53 | elim (ldrop_O1_lt (Ⓕ) L2 (|L2|-|L1|-1))
54   /5 width=4 by llor_pair_dx, monotonic_lt_minus_l, ex_intro/
55 ]
56 qed-.