<div dir="ltr">Hi Joe,<br><br>Thanks for your reply, which expresses the problem clearly.<br>There are the three issues with the standard theory library you listed, and<br>there are two perspectives to consider: reading an OpenTheory proof into a<br>theorem prover ("reading"), and creating an OpenTheory proof from a native<br>theory ("creating").<br><br>Before considering issue (3), I want clarify what to do about the other two<br>issues from the creating perspective. For (1), there is no problem since the<br>extra constant can be ignored. For (2), I think some variation on your solution<br>for the reading perspective could work. There are three pieces to the solution:<br><br>  A: Define the native version of the constant<br>  B: Prove an equation relating the native version to the OpenTheory version<br>  C: Use the theorem from B to rewrite theorems mentioning the native constant<br>     into theorems mentioning only the OpenTheory version of the constant.<br><br>How should responsibility for these tasks be divided between readers and<br>creators?  Initially, in the creator role, I am tempted to do only A, and leave<br>B and C to the readers. I would expect you to eventually want all three to be<br>done by the creator. I think there is some variation in how desirable C might<br>be for different readers.<br><br>Now for issue (3) from the creating perspective. I agree that it is a real<br>problem. I have a couple of ideas for possible solutions.<br><br>  0. If the constant only has one natural candidate for how it might be<br>     overspecified, and all theorem provers overspecify it that way, simply do<br>     so in the OpenTheory standard library too.<br>  1. Provide multiple versions of the constant in the standard library for each<br>     of the natural ways of overspecifying it, and prove theorems relating them<br>     (under appropriate conditions). Theorems that can be stated using the<br>     underspecified version should be (and readers should prefer these), but<br>     theorems that require overspecification can also be included (and readers<br>     can handle these as they do issue (2)).<br><br>Indeed, I think issue (3) is a variant of issue (2) where we cannot prove an<br>unconditional equation between different versions of the constants, but where<br>we can still prove a conditional one.<br><br>Do you have any other ideas for how to deal with these issues?<br><br>Cheers,<br>Ramana<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 10 May 2016 at 16:04, Joe Leslie-Hurd <span dir="ltr"><<a href="mailto:joe@gilith.com" target="_blank">joe@gilith.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ramana,<br>
<br>
Despite the radio silence, I have been thinking about your question<br>
off and on since you asked it.<br>
<br>
The essential problem is that the different HOL theorem provers have<br>
slightly different definitions of fundamental constants, and so all<br>
the theories that are built on top of them are incompatible with other<br>
theorem provers.<br>
<br>
The standard theory library uploaded to the Gilith OpenTheory repo is<br>
my attempt at defining a common base that is implemented by all<br>
theorem provers, but it is imperfect in several ways:<br>
<br>
1. It defines constants (such as Data.List.nub) that are not<br>
implemented in all the HOL theorem provers.<br>
2. It defines constants (such as Data.List.zip) that exist in some HOL<br>
theorem provers with a different type.<br>
3. It defines constants (such as Number.Real.inv) that are<br>
underspecified compared to their definitions in some HOL theorem<br>
provers.<br>
<br>
When we are reading an OpenTheory proof into a HOL theorem prover,<br>
then I don't believe any of these imperfections present any real<br>
obstacle:<br>
<br>
1. If the proof relies on Data.List.nub, then this can simply be<br>
defined in the theorem prover. As you rightly say, such constants<br>
shouldn't really be part of the standard theory library, but I believe<br>
there are few enough of them that we can just add to the theorem<br>
provers.<br>
2. In principle the OpenTheory interface in the HOL theorem prover<br>
would be able to translate constants from one type to an isomorphic<br>
one. One way to do this would be to define the OpenTheory versions of<br>
the constants in terms of the native ones and then "clean up" the<br>
resulting theorems by replacing the OpenTheory versions of the<br>
constants by expanding their definitions.<br>
3. The OpenTheory proof will rely on fewer properties of such<br>
constants than are available in the native version, so the proof will<br>
go through.<br>
<br>
However, when creating OpenTheory proofs from native theories, then<br>
(3) appears to be a real problem. In my work I've tried to create a<br>
body of theories that rely only on the underspecified properties of<br>
such constants, but when I tried to translate some existing HOL Light<br>
proofs I found it hard going (I think I was trying to eliminate the<br>
saturated subtraction property: !n. 0 - n = 0).<br>
<br>
Do you have any ideas for how to overcome obstacle (3) so that we can<br>
start to build up a body of theories that can be read into any HOL<br>
theorem prover?<br>
<br>
Cheers,<br>
<br>
Joe<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On Sat, May 7, 2016 at 7:37 PM, Ramana Kumar <<a href="mailto:ramana@member.fsf.org">ramana@member.fsf.org</a>> wrote:<br>
> Hi,<br>
><br>
> I wanted to check if there was further interest in continuing this<br>
> discussion from last month.<br>
><br>
> The reason is that I am putting together a lot of OpenTheory packages based<br>
> on theories made with the HOL theorem prover, and I would like it if this<br>
> work could fit together nicely with other OpenTheory packages rather than<br>
> living in its own universe (and perpetuating the problem of fragmentation).<br>
><br>
> I think the theories I'm looking into (n-bit words, floating point numbers,<br>
> real numbers, integers, rings, streams, quotients, ...) should all<br>
> ultimately end up within the Standard Library. But to get there would I<br>
> imagine require substantial coordination with the designers of the<br>
> OpenTheory standard library, and other interested community members. I am<br>
> also looking for technical advice on how to interface with the existing<br>
> theories in the Gilith repo that seem to cover some of those topics.<br>
><br>
> Cheers,<br>
> Ramana<br>
><br>
> On 13 April 2016 at 17:15, Ramana Kumar <<a href="mailto:ramana@member.fsf.org">ramana@member.fsf.org</a>> wrote:<br>
>><br>
>> Data.List.unzip works as a replacement for list.UNZIP. However, I will<br>
>> hold back for a bit on making a new version of hol-base in case there are<br>
>> further improvements arising from this thread.<br>
>><br>
>> On 13 April 2016 at 15:38, Konrad Slind <<a href="mailto:konrad.slind@gmail.com">konrad.slind@gmail.com</a>> wrote:<br>
>>><br>
>>> Re: MAP2 in HOL4. This is an example of an underspecified function. I<br>
>>> recall having<br>
>>> to redefine map2 to completely specify it in order to get it through the<br>
>>> HOL-->CakeML translator.<br>
>>><br>
>>> So, presumably, different systems can and will define common partial<br>
>>> functions differently, as<br>
>>> either underspecified or completely specified. Is there an OpenTheory<br>
>>> policy on this, for<br>
>>> its standard library?<br>
>>><br>
>>> Konrad.<br>
>>><br>
>>><br>
>>> On Tue, Apr 12, 2016 at 11:56 PM, Ramana Kumar <<a href="mailto:ramana@member.fsf.org">ramana@member.fsf.org</a>><br>
>>> wrote:<br>
>>>><br>
>>>> It looks like list.ZIP can't be mapped to Data.List.zip because the<br>
>>>> latter is curried. But I'm still looking into unzip.<br>
>>>><br>
>>>> On 13 April 2016 at 13:56, Ramana Kumar <<a href="mailto:ramana@member.fsf.org">ramana@member.fsf.org</a>> wrote:<br>
>>>>><br>
>>>>> The HOL4 base library has its own version of constants like<br>
>>>>> Data.List.take and Number.Natural.- because it needs to prove theorems like:<br>
>>>>><br>
>>>>> ⊦ length (list.TAKE n xs) = if n ≤ length xs then n else length xs<br>
>>>>><br>
>>>>> ⊦ (∀m. arithmetic.- 0 m = 0) ∧<br>
>>>>>   ∀m n.<br>
>>>>>     arithmetic.- (suc m) n = if m < n then 0 else suc (arithmetic.- m<br>
>>>>> n)<br>
>>>>><br>
>>>>> I don't think these theorems are provable using the OpenTheory standard<br>
>>>>> library versions of those constants.<br>
>>>>><br>
>>>>> However, I don't know whether Data.List.unzip suffers from this<br>
>>>>> problem. If not, then the HOL4 base package should be updated to use the<br>
>>>>> standard library constant. It would be helpful if you could make a list of<br>
>>>>> any other similar updates that should be made.<br>
>>>>><br>
>>>>> I don't think the current OpenTheory standard library base contains<br>
>>>>> theories that every HOL theorem prover supports. There are constants like<br>
>>>>> Data.List.nub, for example, which are not supported by HOL4. I'm not<br>
>>>>> entirely sure whether being the intersection of what every HOL theorem<br>
>>>>> prover supports is a good goal, but if that is the rule it should at least<br>
>>>>> be followed :)<br>
>>>>><br>
>>>>> However, my question was not solely about the base package, but about<br>
>>>>> the naming scheme for the standard library. If there are useful constants<br>
>>>>> from other theorem provers (like, say, HOL4's list.GENLIST or list.MAP2), I<br>
>>>>> think their name and characterising theorems should be fit into the<br>
>>>>> OpenTheory namespace (Data.List, for example) in a standardised way, even if<br>
>>>>> they don't make it into the base package itself. What do you think of that?<br>
>>>>><br>
>>>>> I envision OpenTheory being used for the twin goals of portability<br>
>>>>> (where being an intersection is good) and designing a rich, cleanly<br>
>>>>> organised, useful standard library of HOL theorems (where being a union is<br>
>>>>> good). These activities can happen simultaneously in different OpenTheory<br>
>>>>> standard packages.<br>
>>>>><br>
>>>>> On 13 April 2016 at 04:11, Joe Leslie-Hurd <<a href="mailto:joe@gilith.com">joe@gilith.com</a>> wrote:<br>
>>>>>><br>
>>>>>> Hi Ramana,<br>
>>>>>><br>
>>>>>> The intent is for the standard theory library to always be evolving,<br>
>>>>>> but slowly, because it's supposed to contain the base theories that<br>
>>>>>> *every* HOL theorem prover supports.<br>
>>>>>><br>
>>>>>> Looking through the theory I see a lot of defined constants that also<br>
>>>>>> occur in the OpenTheory standard library (e.g., list.UNZIP), and I was<br>
>>>>>> wondering why the HOL4 base theory has its own version?<br>
>>>>>><br>
>>>>>> Cheers,<br>
>>>>>><br>
>>>>>> Joe<br>
>>>>>><br>
>>>>>> On Sun, Apr 10, 2016 at 1:54 PM, Ramana Kumar <<a href="mailto:ramana@member.fsf.org">ramana@member.fsf.org</a>><br>
>>>>>> wrote:<br>
>>>>>> > Hi Joe,<br>
>>>>>> ><br>
>>>>>> > You will have seen that the HOL developers have uploaded a package<br>
>>>>>> > called<br>
>>>>>> > hol-base to the Gilith repo. The purpose of this package is twofold:<br>
>>>>>> ><br>
>>>>>> > It proves many useful theorems as found in the basic libraries of<br>
>>>>>> > the HOL<br>
>>>>>> > theorem prover.<br>
>>>>>> > It serves to satisfy the assumptions of further theories developed<br>
>>>>>> > in the<br>
>>>>>> > HOL theorem prover, by proving those assumptions using only the<br>
>>>>>> > theorems of<br>
>>>>>> > the OpenTheory standard library base package.<br>
>>>>>> ><br>
>>>>>> > For purpose 1 in particular, it seems to me that many of the<br>
>>>>>> > constants<br>
>>>>>> > defined by hol-base would benefit from residing in an appropriate<br>
>>>>>> > place in<br>
>>>>>> > OpenTheory's namespace hierarchy, and indeed some of the proofs from<br>
>>>>>> > hol-base might beneficially be moved into the base package itself.<br>
>>>>>> > (Currently, all constants defined by hol-base are in their own<br>
>>>>>> > namespace.)<br>
>>>>>> ><br>
>>>>>> > Is the design of the standard library still evolving, and is it open<br>
>>>>>> > to<br>
>>>>>> > extension? Would you be willing to copy over any useful-looking<br>
>>>>>> > constants?<br>
>>>>>> > And/or settle on some namespace decisions?<br>
>>>>>> ><br>
>>>>>> > Cheers,<br>
>>>>>> > Ramana<br>
>>>>>> ><br>
>>>>>> > _______________________________________________<br>
>>>>>> > opentheory-users mailing list<br>
>>>>>> > <a href="mailto:opentheory-users@gilith.com">opentheory-users@gilith.com</a><br>
>>>>>> > <a href="http://www.gilith.com/opentheory/mailing-list" rel="noreferrer" target="_blank">http://www.gilith.com/opentheory/mailing-list</a><br>
>>>>>> ><br>
>>>>>><br>
>>>>>> _______________________________________________<br>
>>>>>> opentheory-users mailing list<br>
>>>>>> <a href="mailto:opentheory-users@gilith.com">opentheory-users@gilith.com</a><br>
>>>>>> <a href="http://www.gilith.com/opentheory/mailing-list" rel="noreferrer" target="_blank">http://www.gilith.com/opentheory/mailing-list</a><br>
>>>>><br>
>>>>><br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> opentheory-users mailing list<br>
>>>> <a href="mailto:opentheory-users@gilith.com">opentheory-users@gilith.com</a><br>
>>>> <a href="http://www.gilith.com/opentheory/mailing-list" rel="noreferrer" target="_blank">http://www.gilith.com/opentheory/mailing-list</a><br>
>>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> opentheory-users mailing list<br>
>>> <a href="mailto:opentheory-users@gilith.com">opentheory-users@gilith.com</a><br>
>>> <a href="http://www.gilith.com/opentheory/mailing-list" rel="noreferrer" target="_blank">http://www.gilith.com/opentheory/mailing-list</a><br>
>>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> opentheory-users mailing list<br>
> <a href="mailto:opentheory-users@gilith.com">opentheory-users@gilith.com</a><br>
> <a href="http://www.gilith.com/opentheory/mailing-list" rel="noreferrer" target="_blank">http://www.gilith.com/opentheory/mailing-list</a><br>
><br>
<br>
_______________________________________________<br>
opentheory-users mailing list<br>
<a href="mailto:opentheory-users@gilith.com">opentheory-users@gilith.com</a><br>
<a href="http://www.gilith.com/opentheory/mailing-list" rel="noreferrer" target="_blank">http://www.gilith.com/opentheory/mailing-list</a><br>
</div></div></blockquote></div><br></div>