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 "ground_2/ynat/ynat_succ.ma".
16 include "basic_2/notation/relations/iso_4.ma".
17 include "basic_2/grammar/lenv_length.ma".
19 (* EQUIVALENCE FOR LOCAL ENVIRONMENTS ***************************************)
21 inductive leq: ynat → ynat → relation lenv ≝
22 | leq_atom: ∀d,e. leq d e (⋆) (⋆)
23 | leq_zero: ∀I,L1,L2,V. leq 0 0 L1 L2 → leq 0 0 (L1.ⓑ{I}V) (L2.ⓑ{I}V)
24 | leq_pair: ∀I1,I2,L1,L2,V1,V2,e.
25 leq 0 e L1 L2 → leq 0 (⫯e) (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
26 | leq_succ: ∀I,L1,L2,V,d,e. leq d e L1 L2 → leq (⫯d) e (L1.ⓑ{I}V) (L2.ⓑ{I}V)
30 "equivalence (local environment)"
31 'Iso d e L1 L2 = (leq d e L1 L2).
33 (* Basic properties *********************************************************)
35 lemma leq_refl: ∀L,d,e. L ≃[d, e] L.
36 #L elim L -L /2 width=1 by/
37 #L #I #V #IHL #d #e elim (ynat_cases … d) [ | * /2 width=1 by leq_succ/ ]
38 elim (ynat_cases … e) [ | * ]
39 /2 width=1 by leq_zero, leq_pair/
42 lemma leq_sym: ∀L1,L2,d,e. L1 ≃[d, e] L2 → L2 ≃[d, e] L1.
43 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e
44 /2 width=1 by leq_atom, leq_zero, leq_pair, leq_succ/
47 lemma leq_O_Y: ∀L1,L2. |L1| = |L2| → L1 ≃[0, ∞] L2.
49 [ #X #H lapply (length_inv_zero_sn … H) -H //
50 | #L1 #I1 #V1 #IHL1 #X #H elim (length_inv_pos_sn … H) -H
51 #L2 #I2 #V2 #HL12 #H destruct
52 @(leq_pair … (∞)) /2 width=1 by/ (**) (* explicit constructor *)
56 (* Basic forward lemmas *****************************************************)
58 lemma leq_fwd_length: ∀L1,L2,d,e. L1 ≃[d, e] L2 → |L1| = |L2|.
59 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e normalize //
62 (* Basic inversion lemmas ***************************************************)
64 fact leq_inv_O2_aux: ∀L1,L2,d,e. L1 ≃[d, e] L2 → e = 0 → L1 = L2.
65 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e /3 width=1 by eq_f3/
66 #I1 #I2 #L1 #L2 #V1 #V2 #e #_ #_ #H elim (ysucc_inv_O_dx … H)
69 lemma leq_inv_O2: ∀L1,L2,d. L1 ≃[d, 0] L2 → L1 = L2.
70 /2 width=4 by leq_inv_O2_aux/ qed-.
72 fact leq_inv_Y1_aux: ∀L1,L2,d,e. L1 ≃[d, e] L2 → d = ∞ → L1 = L2.
73 #L1 #L2 #d #e #H elim H -L1 -L2 -d -e /3 width=1 by eq_f3/
74 [ #I1 #I2 #L1 #L2 #V1 #V2 #e #_ #_ #H destruct
75 | #I #L1 #L2 #V #d #e #_ #IHL12 #H lapply (ysucc_inv_Y_dx … H) -H
80 lemma leq_inv_Y1: ∀L1,L2,e. L1 ≃[∞, e] L2 → L1 = L2.
81 /2 width=4 by leq_inv_Y1_aux/ qed-.