]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/etc/llneq/llneq_alt.etc
milestone update in ground_2 and basic_2A
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / etc / llneq / llneq_alt.etc
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/lazynegatedeqalt_4.ma".
16 include "basic_2/substitution/lleq_lleq.ma".
17 include "basic_2/substitution/llneq.ma".
18
19 (* NEGATED LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **************************)
20
21 (* alternative definition of llneq *)
22 inductive llneqa: relation4 ynat term lenv lenv ≝
23 | llneqa_neq:     ∀I1,I2,L1,L2,K1,K2,V1,V2,d,i. d ≤ yinj i →
24                   ⇩[i]L1 ≡ K1.ⓑ{I1}V1 → ⇩[i]L2 ≡ K2.ⓑ{I2}V2 →
25                   |K1| = |K2| → (V1 = V2 → ⊥) → llneqa d (#i) L1 L2
26 | llneqa_eq :     ∀I1,I2,L1,L2,K1,K2,V,d,i. d ≤ yinj i →
27                   ⇩[i]L1 ≡ K1.ⓑ{I1}V → ⇩[i]L2 ≡ K2.ⓑ{I2}V →
28                   llneqa 0 (V) K1 K2 → llneqa d (#i) L1 L2
29 | llneqa_bind_sn: ∀a,I,L1,L2,V,T,d.
30                   llneqa d V L1 L2 → llneqa d (ⓑ{a,I}V.T) L1 L2
31 | llneqa_bind_dx: ∀a,I,L1,L2,V,T,d.
32                   llneqa (⫯d) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → llneqa d (ⓑ{a,I}V.T) L1 L2
33 | llneqa_flat_sn: ∀I,L1,L2,V,T,d.
34                   llneqa d V L1 L2 → llneqa d (ⓕ{I}V.T) L1 L2
35 | llneqa_flat_dx: ∀I,L1,L2,V,T,d.
36                   llneqa d T L1 L2 → llneqa d (ⓕ{I}V.T) L1 L2
37 .
38
39 interpretation
40    "negated lazy equivalence (local environment) alternative"
41    'LazyNegatedEqAlt T d L1 L2 = (llneqa d T L1 L2).
42
43 (* Main properties **********************************************************)
44
45 theorem llneq_llneqa: ∀T,L1,L2,d. L1 ⧣[T, d] L2 → L1 ⧣⧣[T, d] L2.
46 #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
47 #n #IH #L1 * *
48 [ #k #Hn #L2 #d * #HL12 #H elim H /2 width=1 by lleq_sort/
49 | #i #Hn #L2 #d * #HL12 #H elim (ylt_split i d) #Hdi
50   [ elim H /2 width=1 by lleq_skip/ ]
51   elim (lt_or_ge i (|L1|)) #HiL1
52   [2: elim H /3 width=3 by lleq_free, le_repl_sn_aux/ ]
53   elim (ldrop_O1_lt … HiL1) #I1 #K1 #V1 #HLK1
54   elim (ldrop_O1_lt L2 i) /2 width=1 by/ #I2 #K2 #V2 #HLK2
55   lapply (ldrop_fwd_length_eq1 … HLK1 HLK2 HL12) normalize
56   elim (eq_term_dec V1 V2) #HnV12 destruct
57   [2: #H @(llneqa_neq … HLK1 … HLK2) /2 width=1 by/ ] (**) (* explicit constructor *)
58   elim (lleq_dec V2 K1 K2 0) #HnV2 [ elim H /2 width=8 by lleq_lref/ ]
59   #H @(llneqa_eq … HLK1 … HLK2) /4 width=2 by ldrop_fwd_rfw, conj/ (**) (* explicit constructor *)
60 | #p #Hn #L2 #d * #HL12 #H elim H /2 width=1 by lleq_gref/
61 | #a #I #V #T #Hn #L2 #d * #HL12 #H destruct elim (nlleq_inv_bind … H) -H
62   [ /5 width=1 by llneqa_bind_sn, conj/
63   | #H @llneqa_bind_dx @IH // @conj normalize /2 width=1 by/
64   ]
65 | #I #V #T #Hn #L2 #d * #HL12 #H destruct elim (nlleq_inv_flat … H) -H
66   /5 width=1 by llneqa_flat_dx, llneqa_flat_sn, conj/
67 ]
68 qed.