Initial work on the theory of solvable terms #1148
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
this PR continues your existing work in
examples/lambda
, by an initial part of the theory of "solvable" terms (Chapter 8.3 of Barendregt 1984 [1]).First of all, a (lambda) term is closed if its free variable set (
FV
) is empty. Since sometimes there's a need of expressing a list of (lambda) terms are all closed. Now I have added the following definitionclosed_def
intotermTheory
(so that HOL terms likeEVERY closed Ns
can be used when needed):Given any (lambda) term, we can "close" it by wrapping some
LAM
s with all its free variables, so that the overallFV
becomes empty. Due to different order of these free variables, we can only define this the concept of "closure" as a set of terms:When the order of free variables is irrelevant, we can arbitrarily choose one from
closures M
by using the HOL termCHOICE (closures M)
(NOTE: this choice is always possible because|- closures M <> EMPTY
can be proved), which is overloaded toclosure M
. In two cases, the setclosures M
is singleton, as shown in the following two theorems:Now, a term is solvable if its closure (any of it), after applying a list of other terms, becomes the "I" combinator (Definition 8.3.1 of [1, p.171]):
In particular, for already closed terms, the definition of "solvable" can be simplified without using `closures": (as a theorem)
With above definitions, we can prove some common combinators and terms (defined in
chap2Theory
) are indeed solvable:Then we focus on various equivalent alternative definitions of solvable terms. Note that, in the above definitions the list of terms
Ns
are not required to be closed, but they can be closed when needed in some proofs:Also note that, the existential quantifier
∃Ns
used insolvable_def
(and all above theorems) can be actually upgraded to universal quantifiers. This result is extremely useful when specific order of free variables is required in certain (future) proofs, and is so far the hardest proof in this PR:Now comes to the Lemma 8.3.3 (i) (M is solvable iff there exists a (closed) substitution instance M' of M and closed terms Ns such that
M' @* Ns == I
). Closed substitution instance is now defined on top of yourssub
(simultaneous substitution based on finite maps):Now Lemma 8.3.3 (i) itself is proved:
Many new supporting lemmas (for
LAMl
andssup
) are need, and I have added them into their original theories. The following lemma is hard but very useful, which connectsLAMl
,appstar
andssub
once together:Besides, in core theory
finite_mapTheory
, I added the following new lemma forFUN_FMAP
:And in
listTheory
, I added "LIST_TO_SET_SING" in addition to "SET_TO_LIST_SING" as the other side of it:[1] Barendregt, H.P.: The Lambda Calculus, Its Syntax and Semantics. College Publications, London (1984).