-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathArity.v
43 lines (33 loc) · 1.48 KB
/
Arity.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Require Import Syntax.ScopeSystem.
Require Import Auxiliary.Family.
Require Import Syntax.SyntacticClass.
Section Arity.
Context `{σ : scope_system}.
(** \cref{def:arity} *)
Global Definition arity : Type
:= family (syntactic_class * scope_carrier σ).
(**
Entries in the family represent arguments of a constructor; the [σ] component
represents the variables bound in each argument.
For instance, the [Π-intro] rule (i.e. fully annotated λ-abstraction) would
have arity [Family_from_List [(Ty,0), (Ty,1), (Tm,1)]]; application would
have arity [Family_from_List [(Ty,0), (Ty,1), (Tm,0), (Tm,0)]].
The use of [family] instead of e.g. [list] serves two purposes. Firstly, it
abstracts the aspects of the [list] version that we really need, and so makes
the code significantly cleaner/more robust. Secondly, it allows this
definition to be later re-used for non-finitary syntax, although we do not
intend to explore that for now.
*)
(* Access functions for arity *)
Global Definition argument_class {a : arity} (i : a) : syntactic_class
:= fst (a i).
Global Definition argument_scope {a : arity} (i : a) : σ := snd (a i).
(* Given a scope, return the arity of that scope in which all the
syntactic classes are terms. *)
Local Definition simple (γ : σ) : arity
:= {| family_index := γ
; family_element i := (class_term, scope_empty _)
|}.
End Arity.
Bind Scope family_scope with arity.
Arguments arity _ : clear implicits.