Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda term is solvable iff it has hnf (head normal form) #1156

Merged
merged 6 commits into from
Oct 16, 2023

Conversation

binghe
Copy link
Member

@binghe binghe commented Oct 15, 2023

Hi,

This PR continues and connects #1150 and #1155, finally proved Theorem 8.3.14 (Wadsworth) [1, p.175] saying that an λ-term is solvable iff it has hnf (head normal form):

[solvable_iff_has_hnf] (solvableTheory)
⊢ ∀M. solvable M ⇔ has_hnf M

The proof is hard at each lemmas, especially the following one (the case analysis is much more complicated than the textbook version):

[has_hnf_APP_E] (standardisationTheory)
⊢ has_hnf (M @@ N) ⇒ has_hnf M

For easily reasoning of head reduction paths, I have established more lemmas on one-one mapping to list and llist, in the finite and infinite case, resp.:

[infinite_head_reduction_path_to_llist]
⊢ ∀M. infinite (head_reduction_path M) ⇔
      ∃l. ¬LFINITE l ∧ (LNTH 0 l = SOME M) ∧
          ∀i. THE (LNTH i l) -h-> THE (LNTH (SUC i) l)

[finite_head_reduction_path_to_list]
⊢ ∀M. finite (head_reduction_path M) ⇔
      ∃l. l ≠ [] ∧ (HD l = M) ∧ hnf (LAST l) ∧
          ∀i. SUC i < LENGTH l ⇒ EL i l -h-> EL (SUC i) l

[finite_head_reduction_path_to_list_every_has_hnf]
⊢ ∀M. finite (head_reduction_path M) ⇔
      ∃l. l ≠ [] ∧ (HD l = M) ∧ hnf (LAST l) ∧ EVERY has_hnf l ∧
          ∀i. SUC i < LENGTH l ⇒ EL i l -h-> EL (SUC i) l

[finite_head_reduction_path_to_list_last_has_hnf]
⊢ ∀M. finite (head_reduction_path M) ⇔
      ∃l. l ≠ [] ∧ (HD l = M) ∧ has_hnf (LAST l) ∧
          ∀i. SUC i < LENGTH l ⇒ EL i l -h-> EL (SUC i) l

I also added a few new useful lemmas into listTheory and pathTheory, to support some definitions.

--Chun

[1] Barendregt, H.P.: The Lambda Calculus, Its Syntax and Semantics.
College Publications, London (1984).

@mn200
Copy link
Member

mn200 commented Oct 16, 2023

Thanks for this!

@mn200 mn200 merged commit 5f1d5f3 into HOL-Theorem-Prover:develop Oct 16, 2023
1 of 2 checks passed
@binghe binghe deleted the solvable_iff_has_hnf branch November 2, 2023 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants