Replies: 3 comments 8 replies
-
P.S.: To give you an idea of the theory sizes for Isabelle/HOL:
Note: Terms make up for about 99% of the theory size. |
Beta Was this translation helpful? Give feedback.
-
With an appropriate pretty-printer, it might actually be a good idea, but I can't help but think the readability would make debugging translators more complicated. |
Beta Was this translation helpful? Give feedback.
-
I don't think we need only one format for interoperability and for debugging. One can use two formats in the same way we already have a Claudio Sacerdoti Cohen proposed a similar idea for Coq using XML. Since JSON is somehow the new XML it could make sense. Overall, it could make sense to use JSON. But I kinda of disagree with the current pros/cons list proposed:
I think menhir users would write a parser in the same amount of time. Writing an efficient parser with menhir, is, AFAIK, not a real issue.
I would prefer to compare with Menhir in that case. You are using a framework, the same way Menhir can be seen as a framework.
That's a HUGE pro. Most common programming languages use such a tooling already.
Since it is a bout the same, I would say it is nor a pro nor a cons.
I don't understand why it is a pro here. This depends on your internal representation of terms. I don't understand how this point differs from Menhir grammar for example.
Are you sure about this point?
I think it does matter. However, it also means we can have an external tool like Which leads to another cons: It might require more tooling on our side, especially to support text editors. |
Beta Was this translation helpful? Give feedback.
-
I have understood that one motivation behind the new Dedukti standard is the exchange of theories across tools, such as Dedukti, Lambdapi etc.
I would like to therefore propose a seemingly radical idea: Use JSON to encode theories!
JSON is an industry standard for data representation. There is a vast ecosystem of tools around it that helps with processing / parsing / generation. Moreover, it can also still be read by human beings.
I hereby propose a preliminary encoding of lambda-Pi terms in JSON:
"eta"
. This allows us to drop syntax à la{|...|}
to escape special characters."c"
, namely{"c": ["theory_u", "prop"]}
. This allows us to extend the module system later to nested modules, if desired.eta (arrow x y)
in DK2 syntax becomes["eta", ["arrow", 1, 0]]
. (The empty list could be used to encodeType
/TYPE
.)x
and of typet
is encoded as:{"v": x, "t": t}
. Both keysv
andt
can be omitted for lambda-abstractions, and for Pi-abstractions, onlyv
can be omitted.b1, ..., bn
to a termt
is encoded as{"l": [b1, ..., bn], "t": t}
.Example: The DK term
becomes
We could also omit the variable names, yielding:
While this looks a bit scary, using
jq .
, I was able to quickly produce a formatted and syntax-highlighted version of this term:Pros of the JSON encoding:
serde
framework in about three hours (without ever having done something like this before). The resulting parser (without any effort spent on optimisation) was already as fast as my hand-rolled, optimised parser developed over weeks. Given that parsing performance is currently a bottleneck in Dedukti, this could speed up Dedukti as a whole (OCaml bindings).jq
. This makes it very easy to process the data; for example, to obtain the list of all symbols occurring in a theory, it suffices to run:jq '.. | select(type == "string")'
Cons of JSON:
The encoding I showed above could be generalised to commands such as
def
,thm
, rewrite rules and so on.My vision would be the generation and exchange of Dedukti theories happening in a format as described above, while writing theories manually could continue to be performed in the established syntax of Dedukti or Lambdapi.
I am looking forward to your opinions on this.
Beta Was this translation helpful? Give feedback.
All reactions