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

Initial boehm_treeTheory (up to dhnf_cases) #1157

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

binghe
Copy link
Member

@binghe binghe commented Oct 24, 2023

Hi,

This PR continues previous work under examples/lambda. It intends to start the theory of Böhm trees but so far I only committed code up to the proof of dhnf_cases (dB version of hnf_cases, explicit form of head normal forms):

dhnf_cases
⊢ ∀M. dhnf M ⇒ ∃n y Ms. M = dABSi n (dV y ·· Ms)

where dhnf is now just an overload to hnf o toTerm. This proof (indirectly) requires a lot of new lemmas about dB versions of LAMl (now renamed to dLAMl for dB terms) and @* (appstar), which is now defined in pure_dBTheory. A key (direct) lemma is the following "transition" lemma from dLAMl to dABSi, FUNPOW of the primitive dABS:

dLAMl_to_dABSi
⊢ ∀vs.
    ALL_DISTINCT vs ⇒
    (let
       n = LENGTH vs;
       body = FOLDL lift t (GENLIST I n);
       phi = ZIP (GENLIST dV n,MAP (λi. i + n) (REVERSE vs))
     in
       dLAMl vs t = dABSi n (body ISUB phi))

Since I also moved some useful theorems upwards, the entire code changes involve many files, and seem already large enough as a stage work for code review. This is also to prevent merge conflicts with potential parallel work.

--Chun

@@ -952,3 +935,4 @@ Proof
QED

val _ = export_theory()
val _ = html_theory "churchnum";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you cause HTML files to be generated as part of script-file running, can you also clean them up by adding the relevant names to an EXTRA_CLEANS line in the directory's Holmakefile please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just modified that EXTRA_CLEANS. I've already done such changes in Holmakefiles in sub-directories of examples/lambda.

@mn200
Copy link
Member

mn200 commented Oct 25, 2023

I'm confused by

LAMl vs t = dABSi n (body ISUB phi)

This looks as if dABSi is generating a value of type :term. But then I see from looking at the sources that you've overloaded LAMl in pure_dbTheory to be a pure_db-constructing function. Can you make that name dLAMl instead please?

@binghe
Copy link
Member Author

binghe commented Oct 25, 2023

I'm confused by

LAMl vs t = dABSi n (body ISUB phi)

This looks as if dABSi is generating a value of type :term. But then I see from looking at the sources that you've overloaded LAMl in pure_dbTheory to be a pure_db-constructing function. Can you make that name dLAMl instead please?

OK. But what about the "appstar" (@*) that I also overload to the same symbol for :term? I guess this one is not too much confusing thus can be kept?

@mn200
Copy link
Member

mn200 commented Oct 25, 2023

... [@* for dB terms] ...

I agree this one is an interesting case. Being symbolic I don't see it as confusing as LAMl. I also can't see what the "dB" version of @* would be. In the Unicode syntax, there is a superscript ‘d’ available, so that it might become

  dV i ··ᵈ Ms

but that just seems excessive. And in contexts like the above where the leading token is already dV, I think there's a good chance the reader won't get confused. (Contrast LAMl which is the first thing you see when reading form the left.)

@binghe
Copy link
Member Author

binghe commented Oct 25, 2023

... [@* for dB terms] ...

I agree this one is an interesting case. Being symbolic I don't see it as confusing as LAMl. I also can't see what the "dB" version of @* would be. In the Unicode syntax, there is a superscript ‘d’ available, so that it might become

  dV i ··ᵈ Ms

but that just seems excessive. And in contexts like the above where the leading token is already dV, I think there's a good chance the reader won't get confused. (Contrast LAMl which is the first thing you see when reading form the left.)

Fair enough. Currently we just have no case in which @* (for dB terms) occurs in a confusing way, but let's see what will happen in the future, and your suggestion of putting a d-superscript may be put in use.

@mn200 mn200 merged commit 4f44597 into HOL-Theorem-Prover:develop Oct 25, 2023
2 checks passed
@binghe binghe deleted the boehm_tree.1 branch October 31, 2023 10:28
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