Representing Syntax
This page is part of the introduction to proving metatheorems with STELF.
To use STELF, you need to know how to represent deductive systems using the LF logical framework. LF is a very convenient language for representing deductive systems that involve TODO and hypothetical judgements, such as programming languages and logics. However, we won’t see any examples of such uses of LF until later. The goal of the first part of this guide is to take a broad sweep through LF and STELF; you will see how to represent and prove properties of a very simple language, which will prepare you for more sophisticated (and more impressive) content later on.
Our first task is to introduce LF and see how to represent the syntax of a deductive system in it. We refer to a language that we are formalizing in LF as an object language (the language that it is the object of our study). In contrast, we sometimes refer to LF as the meta-language. To keep things simple, we use the natural numbers as first example object language.
Natural numbers
Section titled “Natural numbers”Metatheoretic Definition
Section titled “Metatheoretic Definition”The syntax of the natural numbers is defined in the metatheory is as follows 1:
That is,
- In any context, zero is a natural number
- If in a context , is a natural number, then in , is a natural number.
Indeed, this would be the way define the natural numbers in Prolog:
nat(zero).nat(succ(N)) :- nat(N).LF representation
Section titled “LF representation”LF is a typed lambda-calculus2. We represent an object language in LF by giving an LF signature that declares the LF types and constants that represent the syntax of the object language. For example, we can represent the syntax of the natural numbers with the following LF signature:
%sort nat%term z nat%term s %pi nat %-> natIntuitively, the LF type nat classifies the LF representations of natural numbers. The LF constant z corresponds to and the LF constant s corresponds to .
-
The signature declares that
zhas typenat, which makes sense because is a natural number. -
The signature declares that
shas function type%pi nat %-> nat. An LF term of function type can be applied to another LF term of the appropriate type to form a new term. For example, the constantscan be applied to the constantzto form the terms zrepresenting the number . Thenscan be applied to this term to forms (s z), and so on. An informal natural number is represented by the LF terms Nwhere is represented byN.
We can state the relationship between the informal presentation of the object language and its LF representation by giving an encoding judgement relating an informal object with its representation:
Adequacy
Section titled “Adequacy”Footnotes
Section titled “Footnotes”-
being a metavariable representing the context, and being a term metavariable. ↩
-
for those familiar with the Lambda Cube, LF is the canonical fragment of the calculus. ↩

