A typing context: the sort of each free variable.
Equations
Instances For
The argument categories of a function symbol, read off its rule's non-terminal items in order.
Equations
Instances For
WellSorted p Γ t c: term t has sort c in context Γ, with every subterm well-sorted. A
variable has its context sort; an application has its function symbol's result sort, with arguments
well-sorted at the symbol's argument sorts.
- var {p : Presentation} {Γ : Ctx} {x : String} {c : Cat} : List.lookup x Γ = some c → WellSorted p Γ (AST.var (DottedPath.base x)) c
- sexp {p : Presentation} {Γ : Ctx} {l : Label} {args : List AST} (r : Rule) : r ∈ p.terms → r.label = l → WellSortedList p Γ args r.argSorts → WellSorted p Γ (AST.sexp l args) r.cat
Instances For
Pointwise well-sortedness of an argument list against a list of categories.
- nil {p : Presentation} {Γ : Ctx} : WellSortedList p Γ [] []
- cons {p : Presentation} {Γ : Ctx} {a : AST} {c : Cat} {as : List AST} {cs : List Cat} : WellSorted p Γ a c → WellSortedList p Γ as cs → WellSortedList p Γ (a :: as) (c :: cs)
Instances For
The substitution lemma (inst half): instantiating a well-sorted term with a substitution that is well-sorted for the source context yields a well-sorted term. Proved by mutual induction on the well-sortedness derivation: a variable is handled by the substitution hypothesis, an application recurses into its arguments.