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] ltree_finite_BT_bnf (by ltree_finite_by_unfolding) #1393

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

binghe
Copy link
Member

@binghe binghe commented Feb 8, 2025

Hi,

This PR adds some more useful lemmas into ltreeTheory and further pushed the lambda example.

If an ltree is generated by unfolding (ltree_unfold), and the unfolding seeds have a decreasing "measure", then the resulting ltree must be finite:

   [ltree_finite_by_unfolding']  Theorem (ltreeTheory)
      ⊢ ∀f. (∃m. ∀seed.
               (let
                  (a,seeds) = f seed
                in
                  LFINITE seeds ∧ every (λe. m e < m seed) seeds)) ⇒
            ∀seed. ltree_finite (ltree_unfold f seed)

In a more general version, an extra predicate P is used to restrict the involved seeds:

   [ltree_finite_by_unfolding]  Theorem      
      ⊢ ∀P f.
          (∃m. ∀seed.
             P seed ⇒
             (let
                (a,seeds) = f seed
              in
                LFINITE seeds ∧ every (λe. P e ∧ m e < m seed) seeds)) ⇒
          ∀seed. P seed ⇒ ltree_finite (ltree_unfold f seed)

By the above result, I have proved that Böhm trees of β-normal forms (of λ-terms) are finite:

[ltree_finite_BT_bnf] (examples/lambda/barendregt/lameta_completeTheory)
⊢ ∀X M r. FINITE X ∧ FV M ⊆ X ∪ RANK r ∧ bnf M ⇒ ltree_finite (BT' X M r)

Furthermore, if a λ-term M just has β-normal form, say, M0, then M and M0 are β-equivalent, thus have the same Böhm tree, which is finite:

[ltree_finite_BT_has_bnf]
⊢ ∀X M r. FINITE X ∧ FV M ⊆ X ∪ RANK r ∧ has_bnf M ⇒ ltree_finite (BT' X M r)

The finiteness of Βöhm trees are necessary for their conversion to Rose tree as input of recursive functions (for building the original term from the tree).

P. S. Similar results for λ-terms who are or just have βη-normal forms are not proved yet, but the proof will use the above proven results.

--Chun

@binghe
Copy link
Member Author

binghe commented Feb 9, 2025

Added:

[ltree_finite_BT_benf]
⊢ ∀X M r. FINITE X ∧ FV M ⊆ X ∪ RANK r ∧ benf M ⇒ ltree_finite (BT' X M r)
[ltree_finite_BT_has_benf]
⊢ ∀X M r. FINITE X ∧ FV M ⊆ X ∪ RANK r ∧ has_benf M ⇒ ltree_finite (BT' X M r)

Actually the proof is not as hard as I thought before, given |- has_benf M <=> has_bnf M.

@mn200 mn200 merged commit abe947d into HOL-Theorem-Prover:develop Feb 11, 2025
4 checks passed
@mn200
Copy link
Member

mn200 commented Feb 11, 2025

Thanks!

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