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
refactor listTheory #98
Comments
least impact option might be to have a new core_listTheory, and build a listTheory with roughly the same stuff in it as currently on top (and possibly merge it with rich_list). |
A. Yes, rich_list (and related conversions) needs to be revised or retired.
list Konrad. On Tue, Oct 30, 2012 at 12:17 PM, Ramana Kumar notifications@github.comwrote:
|
It’s not obvious to me that it is overly cluttered (and removing MEM made it less cluttered of course :-). The complete list of constants is
If you were going to remove things because they were too obscure, I’d go for all those from “ListPair” (i.e., EVERY2, FOLDL2, MAP2, ZIP and UNZIP), and also LRC. The rest all look pretty reasonable to me. (The fact that we have two copies of LIST_REL (that and listRel) is not good of course...) SET_TO_LIST is also pretty weird and wild, so I’d feel OK with deleting that. Finally, I’ve just had a look at the Isabelle library, and I see that they have a ListMem constant, defined inductively, and for which there are no further theorems. Their theorems whose names include the substring “mem” typically have |
Having a separate ListPair theory makes sense to me. I would actually propose creating a completely new directory under src/ and starting a clean list development from scratch. That way users can keep on using the existing theories for now and wait until the new one stabilises (there's agreement/maturity). In time, the old theories can be abandoned en masse. Of course, the old theories can be raided for proofs -- hopefully with a fair bit of cleaning up. Mucking around with the existing theories in situ is probably going to be too disruptive. I don't see why we can't simply mimic the Standard ML libraries (almost verbatim style). In particular, things like "GENLIST" should be called "tabulate". An separate theory can be used for set/relational stuff. I find mapPartial to be a useful SML function; zip and unzip are also pretty useful (I wouldn't describe them as being that obscure). |
I didn't mean to denigrate I also like mapPartial, so would be more than happy to see it in listTheory. I think that setting up (I can’t help but note that the basis library doesn’t have a MEM function at all.) Finally, I don’t want to put users into the situation of deciding that they should be doing
and then having to later switch back to
and what if they end up including/open-ing both? We want |
There are a few other differences: nth, EL SML has "find" (which is useful) and "getItem" (which I don't use), "SNOC" and "FRONT" don't appear in the Basis either. I agree that re-implementing something as widely used as the list theory would be a fairly radical move, so there would have to be a clear imperative. A couple of previous bit-vector theories have been deprecated/removed., This approach works best when something isn't being heavily used, or if porting to the new development is very easy or highly beneficial. I think a much cleaner/better version of listTheory could be developed, especially if one isn't shackled by supporting/maintaining the existing version. However, I admit that the benefits would be largely aesthetic. The state of the current version is somewhat embarrassing. If refactoring work is to be done on listTheory then perhaps it is best if a new branch is created for that purpose? |
Yes, a Is it just:
These all seem to be sufficiently low-impact that they’d be fine as small commits on |
Speculation: mem not in SML List structure because it has an equality type. On Tue, Oct 30, 2012 at 7:53 PM, Michael Norrish
|
Totally agree about providing a |
I think it's important to have reasonably well-founded reasons for selecting the locations for each of the constants. In particular, I don't think being "infrequently used" or "not used by me" is a good criteria for pushing something out of the core theory. It's too cheap to have extra constants around and too annoying to have "hidden / less well known" theories around. Frequency of use is too fragile/confusing a criteria. Distinctions can be made on the basis of dependencies and hopefully some unambiguous taxonomical criteria. So having PairLists and "Equality Type / Set Based" lists seems reasonable. Whereas a dumping ground for SNOC, PAD_{LEFT/RIGHT} seems pointless. I'd prefer it if SNOC where renamed to something like append1. An overload is an interesting proposal but it could be hard to pull off. |
How about |
Yes, something for list segments sounds reasonable. Having a consistent naming convention would be good, e.g. something like: listPair, listSet (or ?), listSegment. A decision would have to be made about what gets loaded with bossLib. As a user of the heaps feature, I have a bias towards the "load everything"' approach but I agree that Mosml users won't be happy with that. (PolyML 5.5 is now pretty good at managing memory.) In any case, a library should be added as a shortcut to loading everything (users can then simply add this to their heap). |
I agree. Loading listLib should load everything. Hopefully this Konrad. On Wed, Oct 31, 2012 at 5:16 AM, acjf3 notifications@github.com wrote:
|
See github issue #98 for more information. Essence of work to date is that core_list has the type definition, and the “basic” functions on that type. Derived theorems and other constants are left until listScript to be defined.
I’ve started branch features/list-refactor for work on this idea. We can give up on the whole idea if it proves too ugly, or for whatever other reason. What I’ve committed so far (0d14a13) creates a minimal The resulting, gutted |
Looks good. I'd vote to get rid of SUM from core_listTheory. I'd be inclined to argue that core_listTheory should contain basic Konrad. On Wed, Oct 31, 2012 at 11:06 PM, Michael Norrish
|
Yeah, I agree that SUM could probably go. What do you think needs to be there |
I'm not sure what you meant by "Does it get used anywhere?", but I certainly use SUM in some of my theories. I don't think it's being removed in this proposal, just moved, so that's fine. But I should probably reiterate the question I sent to the dev mailing list about testing external example theories (reply there). |
LIST_REL and EVERY2 are the same constant. |
LIST_REL is an important constant from the quotient library. It is parallel Peter On Sat, Mar 30, 2013 at 12:21 PM, Ramana Kumar notifications@github.comwrote:
"In Your majesty ride prosperously |
Speaking of which, OPTION_REL is the same as OPTREL in optionTheory. I've found the latter to have a much more useful definition theorem. I merely suggest that one day we remove one of each pair of duplicated constants [(LIST_REL,EVERY2),(OPTION_REL,OPTREL)], keeping all the unique theorems and probably keeping both names with overloads. |
Yes. Having two constants is unnecessary. Having two names for the same constant is fine. |
Preserve the EVERY2 theorems, at least for the moment. This issue was first identified in discussion around github issue #98
Preserve quotient_optionTheory.OPTTION_REL_def as a theorem derived from OPTREL’s definition. This is another issue arising from discussion associated with github issue #98.
Speaking of these constants like LIST_REL, there is an even more important This is the infix constant ===>, defined in quotientScript.sml as val FUN_REL = Given two partial equivalence relations R : 'a -> 'a -> bool and S : 'b -> Peter On Sun, Mar 31, 2013 at 2:56 AM, Michael Norrish
"In Your majesty ride prosperously |
listTheory is cluttered with stuff that has moved in over time from rich_listTheory, and depends on probably too many things (like pred_setTheory). There is arguably a "core" theory about lists, that could serve as listTheory, and the remainder can be moved elsewhere (e.g. to rich_list, or refactored further into different pieces). This issue comes in part from fallout discussion on the HOL developers mailing list after #52 was first closed.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: