b: generic binder with one argument
d: abbreviation
f: generic flat with one argument
+i: generic binder for local environments
l: typed abstraction
n: native type annotation
u: generic binder with zero argument
(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
notation "hvbox( L . break ⓓ T1 )"
- left associative with precedence 49
+ left associative with precedence 50
for @{ 'DxAbbr $L $T1 }.
(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
notation "hvbox( L . break ⓛ T1 )"
- left associative with precedence 50
+ left associative with precedence 51
for @{ 'DxAbst $L $T1 }.
(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
notation "hvbox( L . break ⓤ { term 46 I } )"
- non associative with precedence 46
+ non associative with precedence 47
for @{ 'DxBind1 $L $I }.
(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-notation "hvbox( L . break ⓑ { term 46 I } break term 48 T1 )"
- non associative with precedence 47
+notation "hvbox( L . break ⓑ { term 46 I } break term 49 T1 )"
+ non associative with precedence 48
for @{ 'DxBind2 $L $I $T1 }.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( L . ⓘ { break term 46 I } )"
+ non associative with precedence 46
+ for @{'DxItem $L $I }.
(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
notation "hvbox( L . ⓧ )"
- non associative with precedence 48
+ non associative with precedence 49
for @{ 'DxVoid $L }.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⓘ { term 46 I } . break term 55 L )"
+ non associative with precedence 55
+ for @{ 'SnItem $I $L }.
(**************************************************************************)
include "ground_2/notation/functions/append_2.ma".
+include "basic_2/notation/functions/snbind1_2.ma".
include "basic_2/notation/functions/snbind2_3.ma".
+include "basic_2/notation/functions/snvoid_1.ma".
include "basic_2/notation/functions/snabbr_2.ma".
include "basic_2/notation/functions/snabst_2.ma".
include "basic_2/syntax/lenv.ma".
].
interpretation "append (local environment)" 'Append L1 L2 = (append L1 L2).
-
+(*
+interpretation "local environment tail binding construction (unary)"
+ 'SnBind1 I L = (append (LUnit LAtom I) L).
+*)
interpretation "local environment tail binding construction (binary)"
'SnBind2 I T L = (append (LPair LAtom I T) L).
-
+(*
+interpretation "tail exclusion (local environment)"
+ 'SnVoid L = (append (LUnit LAtom Void) L).
+*)
interpretation "tail abbreviation (local environment)"
'SnAbbr T L = (append (LPair LAtom Abbr T) L).
#K #I #V #IH #L1 #L2 >append_pair #H
elim (destruct_lpair_lpair_aux … H) -H /2 width=1 by/ (**) (* destruct lemma needed *)
qed-.
+
+(* Basic_1: uses: chead_ctail *)
+(* Basic_2A1: uses: lpair_ltail *)
+lemma lenv_case_tail: ∀L. L = ⋆ ∨ ∃∃K,I,V. L = ⓑ{I}V.K.
+#L elim L -L /2 width=1 by or_introl/
+#L #I #V * [2: * ] /3 width=4 by ex1_3_intro, or_intror/
+qed-.
#I #L #V >append_length //
qed.
-(* Basic_1: was just: chead_ctail *)
-lemma lpair_ltail: ∀L,I,V. ∃∃J,K,W. L.ⓑ{I}V = ⓑ{J}W.K & |L| = |K|.
-#L elim L -L /2 width=5 by ex2_3_intro/
-#L #Z #X #IHL #I #V elim (IHL Z X) -IHL
-#J #K #W #H #_ >H -H >ltail_length
-@(ex2_3_intro … J (K.ⓑ{I}V) W) /2 width=1 by length_pair/
-qed-.
-
(* Advanced inversion lemmas on length for local environments ***************)
(* Basic_2A1: was: length_inv_pos_dx_ltail *)
lemma length_inv_succ_dx_ltail: ∀L,l. |L| = ⫯l →
∃∃I,K,V. |K| = l & L = ⓑ{I}V.K.
#Y #l #H elim (length_inv_succ_dx … H) -H #I #L #V #Hl #HLK destruct
-elim (lpair_ltail L I V) /2 width=5 by ex2_3_intro/
+elim (lenv_case_tail … L) [2: * #K #J #W ]
+#H destruct /2 width=5 by ex2_3_intro/
qed-.
(* Basic_2A1: was: length_inv_pos_sn_ltail *)
lemma length_inv_succ_sn_ltail: ∀L,l. ⫯l = |L| →
∃∃I,K,V. l = |K| & L = ⓑ{I}V.K.
#Y #l #H elim (length_inv_succ_sn … H) -H #I #L #V #Hl #HLK destruct
-elim (lpair_ltail L I V) /2 width=5 by ex2_3_intro/
+elim (lenv_case_tail … L) [2: * #K #J #W ]
+#H destruct /2 width=5 by ex2_3_intro/
qed-.
(* Inversion lemmas with length for local environments **********************)
(* Basic eliminators ********************************************************)
(* Basic_1: was: c_tail_ind *)
-lemma lenv_ind_alt: ∀R:predicate lenv.
- R (⋆) → (∀I,L,T. R L → R (ⓑ{I}T.L)) →
- ∀L. R L.
-#R #IH1 #IH2 #L @(f_ind … length … L) -L #x #IHx * // -IH1
-#L #I #V #H destruct elim (lpair_ltail L I V) /4 width=1 by/
+(* Basic_2A1: was: lenv_ind_alt *)
+lemma lenv_ind_tail: ∀R:predicate lenv.
+ R (⋆) → (∀I,L,T. R L → R (ⓑ{I}T.L)) → ∀L. R L.
+#R #IH1 #IH2 #L @(f_ind … length … L) -L #x #IHx * //
+#L #I #V -IH1 #H destruct
+elim (lenv_case_tail … L) [2: * #K #J #W ]
+#H destruct /3 width=1 by/
qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/syntax/term.ma".
+
+(* BINDERS FOR LOCAL ENVIRONMENTS ******************************************)
+
+inductive bind: Type[0] ≝
+| BUnit: bind1 → bind
+| BPair: bind2 → term → bind
+.
+
+(* Basic properties ********************************************************)
+
+lemma eq_bind_dec: ∀I1,I2:bind. Decidable (I1 = I2).
+* #I1 [2: #V1 ] * #I2 [2,4: #V2 ]
+[ elim (eq_bind2_dec I1 I2) #HI
+ [ elim (eq_term_dec V1 V2) #HV /2 width=1 by or_introl/ ]
+ @or_intror #H destruct /2 width=1 by/
+| @or_intror #H destruct
+| @or_intror #H destruct
+| elim (eq_bind1_dec I1 I2) #HI /2 width=1 by or_introl/
+ @or_intror #H destruct /2 width=1 by/
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/syntax/term.ma".
+
+(* BINDERS FOR LOCAL ENVIRONMENTS ******************************************)
+
+include "basic_2/syntax/term_weight.ma".
+include "basic_2/syntax/bind.ma".
+
+(* WEIGHT OF A BINDER FOR LOCAL ENVIRONMENTS *******************************)
+
+rec definition bw I ≝ match I with
+[ BUnit _ ⇒ 1
+| BPair _ V ⇒ ♯{V}
+].
+
+interpretation "weight (binder for local environments)" 'Weight I = (bw I).
+
+(* Basic properties *********************************************************)
+
+lemma bw_pos: ∀I. 1 ≤ ♯{I}.
+* //
+qed.
lemma rfw_shift: ∀p,I,K,V,T. ♯{K.ⓑ{I}V, T} < ♯{K, ⓑ{p,I}V.T}.
normalize /2 width=1 by monotonic_le_plus_r/
qed.
-
+(*
+lemma rfw_clear: ∀p,I1,I2,K,V,T. ♯{K.ⓤ{I1}, T} < ♯{K, ⓑ{p,I2}V.T}.
+normalize /4 width=1 by monotonic_le_plus_r, le_S_S/
+qed.
+*)
lemma rfw_tpair_sn: ∀I,L,V,T. ♯{L, V} < ♯{L, ②{I}V.T}.
normalize in ⊢ (?→?→?→?→?%%); //
qed.
lemma fw_shift: ∀p,I,G,K,V,T. ♯{G, K.ⓑ{I}V, T} < ♯{G, K, ⓑ{p,I}V.T}.
normalize /2 width=1 by monotonic_le_plus_r/
qed.
-
+(*
+lemma fw_clear: ∀p,I1,I2,G,K,V,T. ♯{G, K.ⓤ{I1}, T} < ♯{G, K, ⓑ{p,I2}V.T}.
+normalize /4 width=1 by monotonic_le_plus_r, le_S_S/
+qed.
+*)
lemma fw_tpair_sn: ∀I,G,L,V,T. ♯{G, L, V} < ♯{G, L, ②{I}V.T}.
normalize in ⊢ (?→?→?→?→?→?%%); //
qed.
| GRef: nat → item0 (* reference by position: starting at 0 *)
.
+(* binary binding items *)
+inductive bind1: Type[0] ≝
+ | Void: bind1 (* exclusion *)
+.
+
(* binary binding items *)
inductive bind2: Type[0] ≝
| Abbr: bind2 (* abbreviation *)
#Hni12 @or_intror #H destruct /2 width=1 by/
qed-.
+lemma eq_bind1_dec: ∀I1,I2:bind1. Decidable (I1 = I2).
+* * /2 width=1 by or_introl/
+qed-.
+
(* Basic_1: was: bind_dec *)
lemma eq_bind2_dec: ∀I1,I2:bind2. Decidable (I1 = I2).
* * /2 width=1 by or_introl/
(**************************************************************************)
include "basic_2/notation/constructors/star_0.ma".
+include "basic_2/notation/constructors/dxitem_2.ma".
+include "basic_2/notation/constructors/dxbind1_2.ma".
include "basic_2/notation/constructors/dxbind2_3.ma".
+include "basic_2/notation/constructors/dxvoid_1.ma".
include "basic_2/notation/constructors/dxabbr_2.ma".
include "basic_2/notation/constructors/dxabst_2.ma".
-include "basic_2/syntax/term.ma".
+include "basic_2/syntax/bind.ma".
(* LOCAL ENVIRONMENTS *******************************************************)
interpretation "sort (local environment)"
'Star = LAtom.
-
+(*
+interpretation "local environment binding construction (unary)"
+ 'DxBind1 L I = (LUnit L I).
+*)
interpretation "local environment binding construction (binary)"
'DxBind2 L I T = (LPair L I T).
-
+(*
+interpretation "void (local environment)"
+ 'DxVoid L = (LPair L Void).
+*)
interpretation "abbreviation (local environment)"
'DxAbbr L T = (LPair L Abbr T).
(* *)
(**************************************************************************)
-include "basic_2/syntax/term_weight.ma".
+include "basic_2/syntax/bind_weight.ma".
include "basic_2/syntax/lenv.ma".
(* WEIGHT OF A LOCAL ENVIRONMENT ********************************************)
(* Basic properties *********************************************************)
lemma lw_pair: ∀I,L,V. ♯{L} < ♯{L.ⓑ{I}V}.
-/3 width=1 by lt_plus_to_minus_r, monotonic_lt_plus_r/ qed.
+normalize /2 width=1 by monotonic_le_plus_r/ qed.
(* Basic_1: removed theorems 4: clt_cong clt_head clt_thead clt_wf_ind *)
(* Basic_1: removed local theorems 1: clt_wf__q_ind *)
rec definition tw T ≝ match T with
[ TAtom _ ⇒ 1
-| TPair _ V T ⇒ tw V + tw T + 1
+| TPair _ V T ⇒ ⫯(tw V + tw T)
].
interpretation "weight (term)" 'Weight T = (tw T).
[ "lenv" * ]
}
]
+ [ { "binders for local environments" * } {
+ [ "bind" "bind_weight" * ]
+ }
+ ]
[ { "terms" * } {
[ "term_vector ( Ⓐ?.? )" * ]
[ "term_simple ( 𝐒⦃?⦄ )" * ]