]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/syntax/bind.ma
- more background for the exclusion binder
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / syntax / bind.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/syntax/term.ma".
16
17 (* BINDERS FOR LOCAL ENVIRONMENTS ******************************************)
18
19 inductive bind: Type[0] ≝
20 | BUnit: bind1 → bind
21 | BPair: bind2 → term → bind
22 .
23
24 inductive ext2 (R:relation term): relation bind ≝
25 | ext2_unit: ∀I. ext2 R (BUnit I) (BUnit I)
26 | ext2_pair: ∀I,V1,V2. R V1 V2 → ext2 R (BPair I V1) (BPair I V2)
27 .
28
29 (* Basic_inversion lemmas **************************************************)
30
31 fact ext2_inv_unit_sn_aux: ∀R,Z1,Z2. ext2 R Z1 Z2 →
32                            ∀I. Z1 = BUnit I → Z2 = BUnit I.
33 #R #Z1 #Z2 * -Z1 -Z2 #I [2: #V1 #V2 #_ ]
34 #J #H destruct //
35 qed-.
36
37 lemma ext2_inv_unit_sn: ∀R,I,Z2. ext2 R (BUnit I) Z2 → Z2 = BUnit I.
38 /2 width=4 by ext2_inv_unit_sn_aux/ qed-.
39
40 fact ext2_inv_pair_sn_aux: ∀R,Z1,Z2. ext2 R Z1 Z2 →
41                            ∀I,V1. Z1 = BPair I V1 →
42                            ∃∃V2. R V1 V2 & Z2 = BPair I V2.
43 #R #Z1 #Z2 * -Z1 -Z2 #I [2: #V1 #V2 #HV12 ]
44 #J #W1 #H destruct /2 width=3 by ex2_intro/
45 qed-.
46
47 lemma ext2_inv_pair_sn: ∀R,Z2,I,V1. ext2 R (BPair I V1) Z2 →
48                         ∃∃V2. R V1 V2 & Z2 = BPair I V2.
49 /2 width=3 by ext2_inv_pair_sn_aux/ qed-.
50
51 fact ext2_inv_unit_dx_aux: ∀R,Z1,Z2. ext2 R Z1 Z2 →
52                            ∀I. Z2 = BUnit I → Z1 = BUnit I.
53 #R #Z1 #Z2 * -Z1 -Z2 #I [2: #V1 #V2 #_ ]
54 #J #H destruct //
55 qed-.
56
57 lemma ext2_inv_unit_dx: ∀R,I,Z1. ext2 R Z1 (BUnit I) → Z1 = BUnit I.
58 /2 width=4 by ext2_inv_unit_dx_aux/ qed-.
59
60 fact ext2_inv_pair_dx_aux: ∀R,Z1,Z2. ext2 R Z1 Z2 →
61                            ∀I,V2. Z2 = BPair I V2 →
62                            ∃∃V1. R V1 V2 & Z1 = BPair I V1.
63 #R #Z1 #Z2 * -Z1 -Z2 #I [2: #V1 #V2 #HV12 ]
64 #J #W2 #H destruct /2 width=3 by ex2_intro/
65 qed-.
66
67 lemma ext2_inv_pair_dx: ∀R,Z1,I,V2. ext2 R Z1 (BPair I V2) →
68                         ∃∃V1. R V1 V2 & Z1 = BPair I V1.
69 /2 width=3 by ext2_inv_pair_dx_aux/ qed-.
70
71 (* Basic properties ********************************************************)
72
73 lemma eq_bind_dec: ∀I1,I2:bind. Decidable (I1 = I2).
74 * #I1 [2: #V1 ] * #I2 [2,4: #V2 ]
75 [1: elim (eq_bind2_dec I1 I2) #HI
76     [ elim (eq_term_dec V1 V2) #HV ]
77 |4: elim (eq_bind1_dec I1 I2) #HI
78 ]
79 /2 width=1 by or_introl/
80 @or_intror #H destruct /2 width=1 by/
81 qed-.
82
83 lemma ext2_refl: ∀R. reflexive … R → reflexive … (ext2 R).
84 #R #HR * /2 width=1 by ext2_pair/
85 qed.
86
87 lemma ext2_sym: ∀R. symmetric … R → symmetric … (ext2 R).
88 #R #HR #T1 #T2 * /3 width=1 by ext2_unit, ext2_pair/
89 qed-.