-
Notifications
You must be signed in to change notification settings - Fork 15
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
Should we show how STS relations are inductive datatypes? #677
Comments
As someone with no formal background in Agda (or formal methods in general) who has read and actively uses the spec in day to day work, I tend to agree with you @WhatisRT. If the goal is to allow the specification to be a document accessible to blockchain developers in general, there is no reason to make the specification more esoteric. Those who have a deep understanding of Agda or dependent types will almost always have the ability to read the source, and thus there is no need to tailor the PDF to them. In general, I think the goal should always be to reduce difficulty of reading the specs without reducing technical accuracy. |
If you want to focus on making it more understandable, I would devote more of a preamble to explaining the mental model around it. I'm working on a draft of the whole spec that tries to do this throughout, but something like this in the introduction: 1.1 OverviewThis document describes, in a very precise and executable way, the behavior of a Ledger that can be updated in response to a series of events. Because of the precise nature of the document, it can be dense and difficult to read at times, and it can be helpful to have a high level understanding of what it is trying to describe, which we will present below. Just be aware that this section focuses on intuition that the rest of the document will make precise. By "Ledger", we mean a record of, at a specific point in time, a data structure. This data structure contains, for example, an accounting of how funds in the system are distributed among different accounts; the ADA currently held in the reserves; a list of stake pools operating the network, and so on. This ledger can be updated in response to certain signals, such as receiving a new transaction, time passing and crossing an "epoch boundary", enacting a governance proposal, to name a few. Thus, the ledger also defines a set of rules for what signals are valid to apply, and exactly how the state should be updated in response to those signals. A description of this state, the possible signals, and the aforementioned rules is exactly what this document seeks to make precise. We will model this via a number of "state transition systems" (STS) that describe different subsets of the behavior, and can be composed into the full description of the protocol. Each state transition system will consist of:
For example, the "UTXOW" transition system defined on page 32 checks that, among other things, the transaction is signed by the appropriate parties. These transition systems can be composed by requiring another transition system to hold as part of the preconditions. For example, the "UTXOW" transition system mentioned above also requires that the "UTXO" transition, which checks that the inputs to the transaction exist, that the transaction is balanced, and several other rules. A brief description of each transition system is provided below, with a link to where they are defined in this document:
|
I think if I had had something like the description above the first time reading through this, it would have gone a lot smoother; I have have someone on my team go through the exercise of reading it for the first time if you'd like to validate that hypothesis. |
regarding the initial question, I don't think stuff like that is the major barrier to comprehension; I think there are two major barriers to comprehension, one of which there's not much you can do about:
The first is what I'm trying to solve with my writeup above; The latter isn't impacted by removing "data" and "where"; the hard part is exactly what you leave behind, and is exactly the core of the spec. I think that's just going to be intimidating and impenetrable to people no matter what you do, and will just require effort to get familiar with / used to. Where you can help the agda code is by being more verbose: longer variable names, more intermediate let bindings, less cryptic symbols like |
I think this kind of human-readable explanation - in parallel with the formal definition - is exactly what's needed. If we could shift it into Markdown+Agda as well, that would be perfect ;-) I don't think that's a reason to make the 'dense symbolic logic' even denser, though - as a complete Agda-newbie (-phobe?) I at least had some hope that
would make sense given more context. |
Thanks for the comments! @Quantumplation do you mind if we copy what you wrote into the introduction? It looks quite nice! It could also be integrated with the diagrams (#639) we have. As for the symbols, there has been an effort to remove the more obscure one as much as possible. In particular @sandtreader we just discussed literate Markdown in our meeting yesterday, but mostly as a way to cater to Agda experts. We now have issue #680 for this. For the definition of the Note that this feeds back into the original discussion: when we explain what |
@WhatisRT Yes, please feel free, if you find it useful! |
@WhatisRT I don't think you need to contort the code to remove <$> if it's that convenient; A note in the notation section, and some more verbose variable names probably go a long way there. The question I would ask in each case is:
The former should be minimized, but aren't the worst sin, whereas the latter is what is really harmful; and because the document has both types, a new reader will generally feel that that they are all the latter. If you can get to the point where they're all the former, then you can mention that in the notation section: "The following agda constructs might be useful to understand the workings of the code, but generally are more about the mechanistic operation of the proof systems, and can be safely ignored". In the case of <$>, I feel like it's a case of the former; it's basically just saying "run this function on this argument", and so if you told the user to ignore it, it wouldn't actually harm the human interpretation of the code. Whereas something like So replacing that with an infix (I'll also disclaim, part of the challenge you'll face is that comprehension sometimes just takes time, and thorough reading, and you're never going to be able to completely circumvent that; if someone skims the document and misses a clause where you say you can ignore the ? and ¿ operators, they're still going to get confused when they read that elsewhere in the document 😅) |
After some internal discussions, it seems we need to settle the question of how to present our STS relations. This is a follow-up to this comment: #663 (comment)
The two main options are:
data
andwhere
keywords). This would mirror the style of the old PDF specs. It would look something like this:∙_
,_∙_
and_──────────────────────_
symbols. It would look something like this:Compare this with a data type we already have:
My personal opinion is that most of the target audience does not care that our relations are datatypes, and showing that they are will mostly lead to confusion and distraction. For somebody consuming the PDF as a piece of documentation, knowing how to work with values of these types is completely irrelevant. There is of course some potential for confusing people familiar with Agda or dependent types in general, but these people can always just have a look at the source code.
The text was updated successfully, but these errors were encountered: