Open h0nzZik opened 1 year ago
We cannot remove sort parameters of symbols. It is used extensively in other places. So put that out of your mind entirely. With that being established, I'm not sure the change really does anything meaningful unless you're also talking about a lot of behind-the-scenes work that is not going to get prioritized because it's not really necessary.
You seem generally to have an idea that there must be a perfectly clear meaning to anything that is syntactically valid KORE. This is manifestly untrue. All you need to do is to consume the KORE generated by the frontend and generate a Coq axiomatization that accurately captures the rewrite theory described by that KORE. With that goal in mind, the overhead you are describing as bringing onto yourself doesn't really make sense to me as necessary work.
Applicative matching logic, the mathematical theory underpinning (indirectly) KORE, does not have any explicit treatment of sorts, allowing sorts to be explicitly axiomatized. If you think the best axiomatization of injections in KORE is via subsorting and an order-sorted structure, that's fine. If you think that it makes sense to use many-sorting and explicit parametric injection symbols with explicit axioms relating to injections, fine. I don't particularly care as long as the rewrite theory described by the axioms you generate is equivalent to the existing semantics of KORE.
If you want to take the work of doing what you describe (minus the part about parametric symbols which is simply unworkable) onto yourself and make the necessary modifications to 4 different parsers and pretty-printers and 7 different components written across 6 different languages entirely onto yourself and you have a plan for how to make the 6+ different PRs that would be required in a way that doesn't interrupt or break anything for anyone else at the company, I'm not fundamentally opposed to the simple syntactic change that you're talking about. But it's not a useful use of anyone else's time, and I'm not persuaded it's a useful use of yours either.
You seem generally to have an idea that there must be a perfectly clear meaning to anything that is syntactically valid KORE. This is manifestly untrue. All you need to do is to consume the KORE generated by the frontend and generate a Coq axiomatization that accurately captures the rewrite theory described by that KORE.
How do you argue as to whether the "axiomatization" "accurately captures the rewrite theory" without having formal semantics (i.e. "perfectly clear meaning to anything that is syntactically valid")?
TL;DR: I think that In Kore,
inj
should be considered a built-in operator instead of a sort-overloaded symbol. This would simplify the semantics of Kore a lot, and most likely simplify the backends also a bit.Proposal
Currently, subsorting in Kore is done by means of the sort-overloaded symbol
inj{From, To}
that has to be declared in the *.kore file, like this:typically in an
INJ
module:From a language-design perspective, this has some drawbacks:
sortInjection
attribute, which has very tricky semantics. First, it is not clear what concrete symbols it actually defines (does it declare the symbolinj{A,B}
if A,B are unrelated sorts - for example,Int
andList
?). Second, the interpretation of the symbols is very hard to specify, especially in the presence of “diamond sub-sorting” (e.g., ifA < B
,C < D
, where<
denotes subsorting, what is the relation betweeninj{A, D}(a)
,inj{B,D}(inj{A, B}(a))
, andinj{C,D}(inj{A, C}(a))
. This unnecessarily complicates the precise documentation of Kore, let alone formal semantics.sortInjection
attribute.I will explain these issues in more detail below. Now, as a remedy, it would suffice if we:
inj
symbol) in the frontendupcast-pattern
and simplifiedapplication-pattern
as follows;