Theory Syntax
theory Syntax
imports Main "HOL-Library.Countable"
begin
section ‹Syntax: a deep embedding of HOL in HOL›
text ‹BKK's language of classical higher-order logic --- HOL, by which we mean
Church's simple theory of types throughout (BKK Sections 2.1--2.2) --- in a @{emph ‹locally
nameless›} representation: bound variables are de Bruijn indices, free variables
and parameters carry their type. BKK take alphabetic variants to be identical (BKK
Section 2.1); locally nameless makes that literally true --- ‹α›-equivalent terms are
@{emph ‹equal›}. Binders bind indices and substitution replaces only free names, so
capture cannot arise for locally closed substituends, the only ones used: explicit
‹α›-conversion and bound-variable renaming disappear, while substitution itself
(opening, ‹fsub›, ‹msub›) of course remains.
As in BKK, non-logical constants are @{emph ‹parameters›} with names drawn from a type ‹'p›, and
we include BKK's optional primitive equality ‹Eq σ› (BKK Section 2.1, Remark 7.9),
alongside the always-expressible defined Leibniz equality (BKK Section 2.2).
Beyond BKK's signature we also carry a description operator ‹Iota σ› of type
‹(σ ❙⇒ 𝗈) ❙⇒ σ›, one for each type ‹σ›. BKK themselves have no description operator:
they decline to add one (BKK Section 2.3.1) and point to Andrews 1972 for the semantic
issues. We follow that reference. ‹Iota σ› comes with the description axiom for
singletons: the rule ‹NK(ι)› of the calculus and the model condition ‹gm_descB›, both
schematic in the type ‹σ›. (The ‹ι› in the rule's name is Andrews' symbol for
description, not the type ‹ι› of individuals.) Definitions and lemmas below that carry
no BKK reference are infrastructure of the formalisation: opening, closing, freshness,
parameter renaming, countability. They have no counterpart in the paper, where the
identification of alphabetic variants is handled informally (BKK Section 2.1).›
subsection ‹Types and terms›