NixLabConnectionconnecting
ProjectsProject
web /

dreamstop.openfp.net

publicguest

dreamstop.openfp.net, the website and user manual of dreamstop, a language for continuous disambiguation

git clone git@nixlab.openfp.net:web/dreamstop.openfp.net.git
ec1e4025b5ba84b97bf40e4cd47100dc56fbd29emanual/dreamstop.vx
let
  s :: String -> String -> [Inline]
  s annotation sentence = [text (sentence ++ " ")]
  sx :: String -> [Inline] -> [Inline]
  sx annotation inlines = inlines ++ [text " "]
  c :: String -> [Inline]
  c code = [inlineCode Nothing code]
  t :: String -> [Inline]
  t phrase = [text phrase]
  codepoints :: [[[Inline]]] -> Content ()
  codepoints = table [t "Codepoint", t "Meaning", t "Example", t "Algebra"]
  cp :: String -> String -> String -> String -> [[Inline]]
  cp code meaning example algebra = [c code, t meaning, t example, t algebra]
  pairs :: String -> [[[Inline]]] -> Content ()
  pairs question = table [t "Side", t ("Question: " ++ question), t "Annotation"]
  bad :: String -> String -> [[Inline]]
  bad sentence annotation = [t "Bad", t sentence, c annotation]
  good :: String -> String -> [[Inline]]
  good sentence annotation = [t "Good", t sentence, c annotation]
  readingTable :: [[[Inline]]] -> Content ()
  readingTable = table [t "Reading", t "Annotation", t "What a reader takes from it"]
in do
  title [text "dreamstop: a user manual for continuous disambiguation"]

  section (Identifier "About this manual") [text "About this manual"] $ do
    paragraph (s "[Assert·Does]" "This manual is for people and agents who write, annotate or review OpenFP documentation." ++ s "[Assert·Does]" "It teaches dreamstop, a language for continuous disambiguation." ++ s "[Assert·Does]" "Its scope is the language: its codepoints, its verdicts, its questions, its document rules and its minimal pairs.")
    paragraph (s "[Assert·Does·Neg]" "The manual does not describe a program." ++ s "[Assert·Doing]" "The dreamstop Haskell package is being built in the dreamstop/dreamstop repository." ++ s "[Assert·Does] [Assert·Does·Neg]" "Every annotation in this manual is written by hand, and no step needs that package.")
    paragraph (s "[Assert·Does]" "The sections build on each other in order." ++ sx "[Direct·Did]" [text "Read ", reference (Identifier "Continuous disambiguation"), text ", ", reference (Identifier "Readings, annotations and clauses"), text " and ", reference (Identifier "Verdicts"), text " first."] ++ sx "[Assert·Does]" [text "The sections from ", reference (Identifier "Force"), text " to ", reference (Identifier "Evidence"), text " are a reference to look codepoints up in."] ++ sx "[Assert·Does]" [reference (Identifier "Annotating a sentence"), text " is a procedure, and ", reference (Identifier "Worked examples"), text " applies it to real ChangeLog sentences."] ++ sx "[Assert·Does]" [text "Terms are defined where they first appear and are collected in the ", reference (Identifier "Glossary"), text "."])
    paragraph (s "[Assert·Does]" "Sentences under study appear as quotations or in tables." ++ s "[Assert·Does]" "Annotations appear in monospace, as in [Assert·Does]." ++ s "[Assert·Does]" "A pair table gives its question in the heading and marks its bad side Bad and its good side Good." ++ s "[Assert·Does]" "The prose of this manual is itself annotated in dreamstop under the rules for manuals, and its source keeps each sentence beside its annotation.")

  section (Identifier "Continuous disambiguation") [text "Continuous disambiguation"] $ do
    paragraph (s "[Assert·Does]" "A sentence is ambiguous when two careful readers take different meanings from it." ++ s "[Assert·Does] [Assert·Does]" "Grammar checks miss this, because an ambiguous sentence is usually grammatical." ++ s "[Assert·Does]" "A review that checks only English form passes such a sentence under either meaning.")
    paragraph (s "[Assert·Does]" "Disambiguation is the work of finding a sentence's meanings and rewriting it until only one remains." ++ s "[Assert·Does]" "Continuous disambiguation does that work on every change, in the way that continuous integration builds every change." ++ s "[Assert·Does] [Assert·Does]" "Every review compares the readings of each sentence, and the author rewrites any sentence that is not clear.")
    paragraph (s "[Assert·Does]" "The reason is cost." ++ s "[Assert·Does]" "A reader who acts on the wrong reading of a ChangeLog entry restarts a service needlessly, or relies on a fix that was never made." ++ s "[Assert·Does] [Assert·Does]" "Finding the second reading at review costs one rewrite, and finding it after a release costs an incident.")
    paragraph (s "[Assert·Does]" "dreamstop gives disambiguation a written form." ++ s "[Assert·Does]" "A reader records each meaning as an annotation, a short row of codepoints." ++ s "[Assert·Does]" "Two readings that differ show up as two annotations that differ in a named slot." ++ s "[Assert·Does]" "A disagreement about meaning becomes a disagreement about one codepoint, which a review settles.")
    paragraph (s "[Assert·Does]" "The goal is that every question a reader is entitled to ask of a document has exactly one answer." ++ s "[Assert·Does]" "A question goes unresolved in two ways." ++ s "[Assert·Does]" "Ambiguity of reading is a sentence with several meanings." ++ s "[Assert·Does]" "Ambiguity by omission is a clear text that fits several situations that matter to the reader." ++ s "[Assert·Does]" "Both leave a question with more than one answer, so dreamstop treats them as one failure.")

  section (Identifier "Readings, annotations and clauses") [text "Readings, annotations and clauses"] $ do
    paragraph (s "[Assert·Does]" "A reading is one meaning that a reader finds in a sentence." ++ s "[Assert·Does]" "An annotation records one reading." ++ s "[Assert·Does]" "It lists the sentence's clauses in order, and gives each clause one vector of codepoints.")
    paragraph (s "[Assert·Does]" "A clause is a part of a sentence that makes one claim, gives one instruction or asks one question." ++ s "[Assert·Does]" "“Added the review store, which moves reviews out of SQLite” has two clauses." ++ s "[Assert·Does]" "The first reports the release action and the second describes the store.")
    paragraph (s "[Assert·Does]" "A vector has eight slots, and each slot is called a layer." ++ s "[Assert·Does]" "Force and aspect always have a value." ++ s "[Assert·Does]" "Phase, outer negation, modality, inner negation, bound and evidence are optional.")
    paragraph (s "[Assert·Does]" "A vector is written as its codepoints joined by a middle dot, inside square brackets." ++ s "[Assert·Does]" "The codepoints follow a fixed order: force, aspect, phase, outer negation, modality, inner negation, bound and evidence." ++ s "[Assert·Does·Neg]" "An absent optional slot is not written." ++ s "[Assert·Does]" "An annotation writes its vectors one after another, separated by a space.")
    codeBlock (Language "text") "[Assert·Did] [Assert·Does]\n[Assert·Does·Gone]\n[Assert·Does·Kept] [Assert·Does·Neg·Can]"
    paragraph (s "[Assert·Does]" "The block above is three annotations, one per line, not a program." ++ s "[Assert·Does]" "The first has two clauses and the others have one and two.")
    paragraph (s "[Assert·Does]" "The fixed order makes the vector a normal form." ++ s "[Assert·Does]" "Two readers who agree on a meaning write the same characters." ++ s "[Assert·Does]" "The order also says how the layers combine: force applies last, and aspect applies first, to the bare proposition.")
    paragraph (s "[Assert·Does]" "The block below sets out the same structure in Haskell notation." ++ s "[Assert·Does·Neg]" "It is an explanatory fragment, not a program to compile.")
    codeBlock (Language "haskell") "type Annotation = NonEmpty Clause\n\ndata Verdict = Nonsense | Clear Annotation | Ambiguous [Annotation]\n\ndata Clause = Clause\n  { force    :: Force            -- Assert | Direct | Ask\n  , aspect   :: Aspect           -- Did | Done | Doing | Does\n  , phase    :: Maybe Phase      -- New | Gone | Kept | Due\n  , modality :: Maybe Modality   -- Must | Should | Can | Nec | Poss\n  , outerNeg :: Bool             -- negates the modality: need not, cannot\n  , innerNeg :: Bool             -- negates the content: must not, can refrain\n  , bound    :: Maybe Bound      -- Once | Each\n  , evidence :: Maybe Evidence   -- Measured | Claimed\n  }"
    paragraph (s "[Assert·Does]" "Annotation is a person's or an agent's work." ++ s "[Assert·Does·Neg·Can]" "No program can compute a sentence's readings from English." ++ s "[Assert·Does]" "Tools check annotations against document rules and against each other.")

  section (Identifier "The codepoints") [text "The codepoints"] $ do
    paragraph (s "[Assert·Does]" "This section gives every codepoint, one layer at a time." ++ s "[Assert·Does]" "Each table gives the codepoint, its meaning, an English example that carries it and its algebraic behaviour." ++ s "[Assert·Does]" "Each layer ends with a minimal pair that turns on that layer.")
    paragraph (s "[Assert·Does]" "Two algebraic terms recur." ++ s "[Assert·Does]" "An operator is monotone when a stronger proposition inside it gives a stronger result." ++ s "[Assert·Does]" "“It happened that the build passed every test” implies “it happened that the build passed a test”, so Did is monotone." ++ s "[Assert·Does]" "An operator is non-monotone when that inference fails.")

    section (Identifier "Force") [text "Force"] $ do
      paragraph (s "[Assert·Does]" "Force says what a clause does for its reader." ++ s "[Assert·Does]" "It is the outermost layer.")
      codepoints
        [ cp "Assert" "states that something holds, truly or falsely" "The shell no longer accepts unsigned commands." "not an operator on propositions: the clause becomes a judgement"
        , cp "Direct" "tells a reader to do something, whether or not they comply" "Back up the state directory." "the clause becomes a plan"
        , cp "Ask" "asks which of several alternatives holds" "Which revision did the build use?" "the clause becomes a set of alternatives"
        ]
      paragraph (s "[Assert·Does·Neg]" "Force is not a function from propositions to propositions." ++ s "[Assert·Does]" "An asserted clause is true or false, a directed clause is complied with or not, and a question is answered." ++ s "[Assert·Does]" "Those are three different kinds of result, so force is the layer that decides the kind.")
      pairs "does the sentence describe the software or instruct the reader?"
        [ bad "Set metering.config to raise the fuel default." "[Direct·Did]"
        , good "Setting metering.config raises the fuel default." "[Assert·Does]"
        ]
      paragraph (s "[Assert·Does]" "The pair differs in the force of clause 1." ++ s "[Assert·Does]" "In a ChangeLog the bad side fails, because a ChangeLog allows only Assert.")

    section (Identifier "Aspect") [text "Aspect"] $ do
      paragraph (s "[Assert·Does]" "Aspect says how the clause views its event: as a whole, by its result, under way or as a habit." ++ s "[Assert·Does]" "It is the innermost layer and applies to the bare proposition.")
      codepoints
        [ cp "Did" "the event happened, viewed as a whole (perfective)" "Added the review store." "monotone"
        , cp "Done" "the event happened and its result holds (perfect)" "The import has finished." "monotone, from an event to a state"
        , cp "Doing" "the event is under way and unfinished (progressive)" "The forge is importing reviews." "non-monotone: the imperfective paradox"
        , cp "Does" "what a thing does typically (habitual or generic)" "The store holds the review book." "tolerates exceptions"
        ]
      paragraph (s "[Assert·Does]" "Doing is non-monotone because of the imperfective paradox." ++ s "[Assert·Does] [Assert·Does·Neg]" "“The forge was importing reviews” is true of an import that crashed, but “the forge imported reviews” is not." ++ s "[Assert·Does]" "Does tolerates exceptions in the way that “the shell answers every call” survives one dropped connection.")
      pairs "what does clause 2 assert?"
        [ bad "Added the review store, which moved reviews out of SQLite." "[Assert·Did] [Assert·Did]"
        , good "Added the review store, which moves reviews out of SQLite." "[Assert·Did] [Assert·Does]"
        ]
      paragraph (s "[Assert·Does]" "The pair differs in the aspect of clause 2, Did against Does." ++ s "[Assert·Does]" "The bad side reads either as a past move or as what the store does, and the good side reads only as what the store does.")

    section (Identifier "Phase") [text "Phase"] $ do
      paragraph (s "[Assert·Does]" "Phase says how a clause's truth changes across a release." ++ s "[Assert·Does]" "It compares the proposition before the release with the proposition after it.")
      codepoints
        [ cp "New" "false before the release and true after it (prose “now”)" "Operators must now back up STATE/reviews." "non-monotone"
        , cp "Gone" "true before the release and false after it (prose “no longer”)" "The shell no longer accepts unsigned commands." "non-monotone"
        , cp "Kept" "true before the release and true after it (prose “still”)" "Compiled loops are still uninterruptible." "monotone"
        , cp "Due" "false before and after the release, and expected later (prose “not yet”)" "The importer does not yet read approvals." "non-monotone"
        ]
      paragraph (s "[Assert·Does]" "Kept is monotone, because truth on both sides of the release survives a weaker proposition." ++ s "[Assert·Does]" "New, Gone and Due each assert a falsehood on one side, and a stronger proposition is false more often, so the inference fails.")
      pairs "what behaves differently after the release?"
        [ bad "The shell accepts unsigned commands." "[Assert·Does]"
        , good "The shell no longer accepts unsigned commands." "[Assert·Does·Gone]"
        ]
      paragraph (s "[Assert·Does]" "The pair differs in the phase of clause 1." ++ s "[Assert·Does]" "In a ChangeLog every standing claim needs a phase, so the bad side fails.")

    section (Identifier "Modality") [text "Modality"] $ do
      paragraph (s "[Assert·Does]" "Modality says whether the clause is about obligation, recommendation, ability, necessity or possibility.")
      codepoints
        [ cp "Must" "obligation (deontic)" "Operators must back up STATE/reviews." "functor with no counit: an obligation is not a fact"
        , cp "Should" "recommendation, a weak obligation" "Operators should restore STATE/reviews." "functor with no counit"
        , cp "Can" "ability (dynamic)" "The shell can stop a block that allocates." "functor"
        , cp "Nec" "necessarily, always (alethic box)" "A failed import is necessarily retried." "comonad"
        , cp "Poss" "possibly, may happen (diamond)" "A block's spend may vary by a few units." "monad, with Poss p equal to Not (Nec (Not p))"
        ]
      paragraph (sx "[Assert·Does]" [reference (Identifier "Modality as functors and comonads"), text " explains the algebra column."])
      pairs "must operators do anything?"
        [ bad "Operators now back up STATE/reviews." "[Assert·Does·New]"
        , good "Operators must now back up STATE/reviews." "[Assert·Does·New·Must]"
        ]
      paragraph (s "[Assert·Does]" "The pair differs in the modality of clause 1." ++ s "[Assert·Does]" "The bad side claims that operators make backups, which no release can make true.")

    section (Identifier "Negation") [text "Negation"] $ do
      paragraph (s "[Assert·Does]" "Negation has two positions, one on each side of the modality." ++ s "[Assert·Does]" "Outer negation denies the modality itself, as in need not and cannot." ++ s "[Assert·Does]" "Inner negation denies the content under the modality, as in must not and can refrain." ++ s "[Assert·Does]" "The position of Neg in the codepoint string is its scope.")
      paragraph (s "[Assert·Does]" "A clause with no modality has only one position, and Neg there simply denies the clause." ++ s "[Assert·Does]" "Neg reverses monotonicity, so a weaker proposition gives the stronger denial.")
      table [t "Codepoints", t "Logic", t "English", t "Example"]
        [ [c "Neg·Must", t "not O p", t "need not: not obligatory", t "Operators need not restart the forge."]
        , [c "Must·Neg", t "O not p", t "must not: forbidden", t "Operators must not edit STATE/reviews by hand."]
        , [c "Neg·Must·Neg", t "not O not p", t "may: permitted", t "Operators may delete the SQLite tables."]
        , [c "Neg·Can", t "not Can p", t "cannot: unable", t "The shell cannot stop the loop."]
        , [c "Can·Neg", t "Can not p", t "can refrain, can leave unset", t "Operators can leave metering.vx unset."]
        , [c "Neg·Can·Neg", t "not Can not p", t "cannot avoid, has to", t "The forge cannot avoid reading the books."]
        ]
      paragraph (s "[Assert·Does]" "May is Neg·Must·Neg, because a permission is the absence of an obligation not to act." ++ s "[Assert·Does]" "That reading makes the may of permission separate from the may of possibility, which is Poss.")
      pairs "must operators restart the forge?"
        [ bad "Operators must not restart the forge." "[Assert·Does·Must·Neg]"
        , good "Operators need not restart the forge." "[Assert·Does·Neg·Must]"
        ]
      paragraph (s "[Assert·Does]" "Need not and must not differ only in where Neg stands." ++ s "[Assert·Does]" "The first leaves the restart optional and the second forbids it, so a reader who confuses them either restarts needlessly or breaks a rule.")
      pairs "are operators allowed to delete the SQLite tables?"
        [ bad "Operators must not delete the SQLite tables." "[Assert·Does·Must·Neg]"
        , good "Operators may delete the SQLite tables." "[Assert·Does·Neg·Must·Neg]"
        ]
      paragraph (s "[Assert·Does]" "Adding the outer Neg turns a prohibition into a permission.")
      pairs "is the restart possible but optional?"
        [ bad "The shell cannot restart the forge." "[Assert·Does·Neg·Can]"
        , good "Operators need not restart the forge." "[Assert·Does·Neg·Must]"
        ]
      paragraph (s "[Assert·Does]" "Cannot and need not share their outer Neg and differ in the modality: one denies an ability and the other denies an obligation.")
      pairs "does the forge work without metering.vx?"
        [ bad "Operators cannot leave metering.vx unset." "[Assert·Does·Neg·Can]"
        , good "Operators can leave metering.vx unset." "[Assert·Does·Can·Neg]"
        ]
      paragraph (s "[Assert·Does]" "Moving Neg from outside Can to inside it turns an inability into an option.")

    section (Identifier "Bound") [text "Bound"] $ do
      paragraph (s "[Assert·Does]" "Bound says whether the clause is about one bounded event or about each occurrence.")
      codepoints
        [ cp "Once" "a single bounded event" "The forge imports every review once." "fixes one occurrence"
        , cp "Each" "every occurrence, one by one" "Each verdict moves the merge request's last touch." "distributes over occurrences"
        ]
      pairs "does a later start import the reviews again?"
        [ bad "On first start the forge now imports every review." "[Assert·Did·New]"
        , good "On first start the forge now imports every review once." "[Assert·Did·New·Once]"
        ]
      paragraph (s "[Assert·Does]" "The pair differs in the bound of clause 1." ++ s "[Assert·Does]" "The bad side leaves open whether a later start imports the reviews again.")

    section (Identifier "Evidence") [text "Evidence"] $ do
      paragraph (s "[Assert·Does]" "Evidence says where a claim comes from.")
      codepoints
        [ cp "Measured" "the claim rests on a measurement or a test" "Large imports used 40 per cent less memory in the regression test." "names a checkable source"
        , cp "Claimed" "the claim rests on the writer's word or reasoning" "The change removes a likely cause of the leak." "names no checkable source"
        ]
      paragraph (s "[Assert·Does]" "A ChangeLog may use the past tense for a Measured outcome, because a measurement is an event that happened.")
      pairs "is the claim measured?"
        [ bad "Large imports used 40 per cent less memory." "[Assert·Did]"
        , good "Large imports used 40 per cent less memory in the regression test." "[Assert·Did·Measured]"
        ]
      paragraph (s "[Assert·Does]" "The pair differs in the evidence of clause 1." ++ s "[Assert·Does]" "In a ChangeLog the bad side fails, because its past tense is licensed only by a Measured outcome.")

  section (Identifier "Tense, aspect and phase compared") [text "Tense, aspect and phase compared"] $ do
    paragraph (s "[Assert·Does]" "Three layers of English grammar deal with time, and dreamstop keeps them apart.")
    bullets
      [ paragraph (s "[Assert·Does]" "Tense relates the reference time to the release.")
      , paragraph (s "[Assert·Does]" "Aspect relates the event to the reference time.")
      , paragraph (s "[Assert·Does]" "Phase is a change in truth across the release.")
      ]
    paragraph (s "[Assert·Does]" "Phase is defined from two functors, Before p and After p, which give the truth of p on either side of the release." ++ s "[Assert·Does]" "They are functors because they only reindex p to a different time and preserve every inference inside it." ++ s "[Assert·Does]" "New is Not (Before p) and After p, Gone is Before p and Not (After p), Kept is Before p and After p, and Due is Not (Before p) and Not (After p) with p expected.")
    paragraph (s "[Assert·Does·Neg]" "dreamstop has no tense codepoint." ++ s "[Assert·Does]" "A ChangeLog fixes the reference time at the release, so tense carries no information that phase and aspect lack." ++ s "[Assert·Does]" "English tense is still a clue when annotating, and past tense is the commonest sign of a Did that should be a Does.")
    table [t "Sentence", t "Aspect", t "Phase"]
      [ [t "The shell accepts unsigned commands.", c "Does", t "none"]
      , [t "The shell no longer accepts unsigned commands.", c "Does", c "Gone"]
      , [t "The shell accepted an unsigned command.", c "Did", t "none"]
      , [t "The forge is importing reviews.", c "Doing", t "none"]
      ]

  section (Identifier "Force and records") [text "Force, and why records are Assert-only"] $ do
    paragraph (s "[Assert·Does]" "Force corresponds to grammatical mood: declaratives assert, imperatives direct and interrogatives ask." ++ s "[Assert·Does]" "Mood is only a clue, because an English imperative can assert.")
    paragraph (s "[Assert·Does]" "“Configure backups to expire after 30 days” reads as Assert in a commit subject, reporting what the release does." ++ s "[Assert·Does]" "The same words read as Direct in an upgrade note, telling operators what to do." ++ s "[Assert·Does]" "That sentence is ambiguous in force, and the rewrite names either the software or the reader as the subject.")
    paragraph (s "[Assert·Does]" "A record, such as a ChangeLog or a README, states what is true of the software." ++ s "[Assert·Does]" "Its value is that a reader can check it." ++ s "[Assert·Does]" "A direction cannot be true or false, and a question asserts nothing, so a record that contains them stops being checkable in those places." ++ s "[Assert·Does]" "Records therefore allow Assert only.")
    paragraph (s "[Assert·Does]" "An obligation in a record is asserted, not directed." ++ s "[Assert·Does·New·Must]" "“Operators must now back up STATE/reviews” asserts that an obligation holds from this release." ++ s "[Assert·Does]" "That is a fact about the release, so it is true or false, and it names the reader who carries the obligation.")

  section (Identifier "Modality as functors and comonads") [text "Modality as functors and comonads"] $ do
    paragraph (s "[Assert·Does]" "Each modality is an operator M on propositions." ++ s "[Assert·Does]" "Its algebra says which inferences survive inside it.")
    paragraph (s "[Assert·Does]" "Every modality is a functor." ++ s "[Assert·Does]" "If p implies q, then M p implies M q." ++ s "[Assert·Does]" "If operators must back up every state directory, then they must back up the state directory of this forge.")
    paragraph (s "[Assert·Does]" "Nec is a comonad." ++ s "[Assert·Does]" "Its counit says that Nec p implies p: what holds necessarily holds." ++ s "[Assert·Does]" "Its comultiplication says that Nec p implies Nec (Nec p).")
    paragraph (s "[Assert·Does]" "Poss is a monad, the dual of Nec." ++ s "[Assert·Does]" "Its unit says that p implies Poss p: what holds is possible." ++ s "[Assert·Does]" "Poss p equals Not (Nec (Not p)).")
    paragraph (s "[Assert·Does]" "Must and Should are functors with no counit." ++ s "[Assert·Does·Neg]" "Must p does not imply p." ++ s "[Assert·Does] [Assert·Does·Neg]" "Operators must back up STATE/reviews, and that does not mean that any operator has done so." ++ s "[Assert·Does]" "This is the deontic no-counit point: an obligation is not a fact.")
    paragraph (s "[Assert·Does]" "The point matters at review." ++ s "[Assert·Does]" "A reviewer who reads an obligation as a fact takes a requirement for evidence that it is met." ++ s "[Assert·Does]" "dreamstop marks the difference in the modality slot, so the two readings cannot share an annotation.")
    paragraph (s "[Assert·Does]" "Can is a functor." ++ s "[Assert·Does·Neg]" "Ability does not imply the event either, because a shell that can stop a block may not have stopped it.")

  section (Identifier "Verdicts") [text "Verdicts"] $ do
    paragraph (s "[Assert·Does]" "A verdict gathers the readings that a set of readers finds in a sentence." ++ s "[Assert·Does]" "Each reader gives every reading they find, and the verdict removes duplicates.")
    table [t "Readings", t "Verdict", t "What happens"]
      [ [t "none", c "Nonsense", t "the author rewrites the sentence so that it says something"]
      , [t "exactly one", c "Clear", t "the sentence stays, with its one annotation"]
      , [t "two or more", c "Ambiguous", t "the author picks a reading and rewrites the sentence to carry only that one"]
      ]
    paragraph (s "[Assert·Does]" "A sentence is clear when every reader finds the same single reading." ++ s "[Assert·Does]" "It is ambiguous when the readings differ." ++ s "[Assert·Does]" "It is nonsense when no reader finds a coherent reading.")
    paragraph (s "[Assert·Does]" "“The shell now still accepts unsigned commands” is nonsense." ++ s "[Assert·Does]" "Now is New, which says the claim was false before the release, and still is Kept, which says it was true before." ++ s "[Assert·Does·Neg]" "No single phase satisfies both, so the sentence has no reading.")
    paragraph (s "[Assert·Does]" "A document rule also removes readings." ++ s "[Assert·Does]" "A reading that breaks the rules for its document does not count." ++ s "[Assert·Does]" "A ChangeLog sentence whose only reading is Direct therefore has no admissible reading.")

  section (Identifier "Document rules") [text "Document rules"] $ do
    paragraph (s "[Assert·Does]" "A document rule is a predicate over annotations." ++ s "[Assert·Does]" "Each kind of document has its own rules.")
    table [t "Document", t "Force", t "Constraints"]
      [ [t "ChangeLog", t "Assert only", t "Did only on the release action. Descriptions use Does. Every standing claim has a phase. Kept needs a New or Gone in the same entry. No Doing. No counterfactuals in behaviour. Obligations are Assert·Must or Assert·Should with a named reader. Past tense allowed for removed components, superseded behaviour with “previously”, and Measured outcomes."]
      , [t "README", t "Assert only", t "Does and states, with no phase: it describes the program, not a release."]
      , [t "Manual", t "Assert and Direct", t "Direct for steps, Done for preconditions."]
      , [t "Issue", t "Assert, Direct and Ask", t "Counterfactuals allowed for options."]
      , [t "Interface copy", t "Assert and Direct", t "Buttons Direct, status Assert."]
      ]
    paragraph (s "[Assert·Does]" "A ChangeLog keeps Did for the release action because the release is the one event the entry reports." ++ s "[Assert·Does]" "Everything else in the entry describes the software after the release, so it takes Does.")
    paragraph (s "[Assert·Does]" "Kept needs a New or Gone in the same entry because “still” only informs a reader beside a change." ++ s "[Assert·Does·Kept] [Assert·Does·Neg·Can]" "“Compiled code that loops without allocating is still uninterruptible, so the shell cannot stop it” belongs in the entry that changes what the shell charges.")
    paragraph (s "[Assert·Does]" "An indicative conditional sits inside Does as content." ++ s "[Assert·Does]" "“If one book has imported and the other has not, every call is refused” is Does applied to the whole conditional." ++ s "[Assert·Does]" "A counterfactual such as “had the import run, the call would have passed” belongs only in hypothetical passages such as issues and design notes.")
    section (Identifier "Pairs per document") [text "Pairs per document"] $ do
      paragraph (s "[Assert·Does]" "Each rule comes with its pairs.")
      pairs "what does the program do?"
        [ bad "README: The shell no longer accepts unsigned commands." "[Assert·Does·Gone]"
        , good "README: The shell refuses unsigned commands." "[Assert·Does]"
        ]
      paragraph (s "[Assert·Does]" "A README describes the program and has no release to compare with, so the bad side fails on its phase.")
      pairs "what do I do?"
        [ bad "Manual: You restart the forge." "[Assert·Does]"
        , good "Manual: Restart the forge." "[Direct·Did]"
        ]
      paragraph (s "[Assert·Does]" "A step in a manual is Direct, so the bad side fails on its force.")
      pairs "what does the button do?"
        [ bad "Interface copy, a button: Manual" "[Assert·Does]"
        , good "Interface copy, a button: Read the manual" "[Direct·Did]"
        ]
      paragraph (s "[Assert·Does]" "A button is Direct, so a button that only names a thing fails on its force.")

  section (Identifier "Questions") [text "Questions"] $ do
    paragraph (s "[Assert·Does]" "Every kind of document has questions that its reader is entitled to have answered." ++ s "[Assert·Does]" "These questions are the specification of the document kind." ++ s "[Assert·Does]" "dreamstop writes each one as an Ask with its alternatives.")
    table [t "Document", t "Questions its reader is entitled to ask"]
      [ [t "ChangeLog", t "What changed? What behaves differently now? Must I do anything? Is any claim measured?"]
      , [t "README", t "What is this? What does it do? What does it need?"]
      , [t "Manual", t "What do I do? In what order? How do I know it worked? How do I recover?"]
      , [t "Every sentence", t "Which reading does it have?"]
      ]
    paragraph (s "[Assert·Does]" "For each question, the text determines some number of answers.")
    table [t "Answers", t "Resolution"]
      [ [t "none", t "a contradiction, or nonsense"]
      , [t "exactly one", t "resolved"]
      , [t "several", t "ambiguous, because a sentence has several readings or because nothing addresses the question"]
      ]
    paragraph (s "[Assert·Does]" "A document passes when every question in its set is resolved." ++ sx "[Assert·Does]" [text "A verdict on a sentence, as in ", reference (Identifier "Verdicts"), text ", is the resolution of the question that every sentence carries: which reading does it have?"])
    paragraph (s "[Assert·Does]" "A ChangeLog entry can be clear in every sentence and still fail." ++ s "[Assert·Does]" "An entry that adds the review store and says nothing about backups leaves “must I do anything?” with two answers." ++ s "[Assert·Does]" "Readers who assume yes and readers who assume no both find the text consistent, so the question is ambiguous by omission.")

  section (Identifier "Minimal pairs") [text "Minimal pairs"] $ do
    paragraph (s "[Assert·Does]" "Minimal pairs drive dreamstop, and there is one kind of pair." ++ s "[Assert·Does]" "A pair is a question, a bad side that leaves the question with no answer or several, a good side that gives it exactly one, and a minimal edit between them.")
    section (Identifier "How pairs define rules") [text "How pairs define rules"] $ do
      paragraph (s "[Assert·Does]" "A document's question set is its specification, and its pairs are the examples that pin each question down." ++ s "[Assert·Does]" "Every pair obeys three laws.")
      ordered
        [ paragraph (s "[Assert·Does]" "The good side resolves the question.")
        , paragraph (s "[Assert·Does·Neg]" "The bad side does not resolve it.")
        , paragraph (s "[Assert·Does·Neg]" "The edit is minimal: no smaller edit to the bad side resolves the question.")
        ]
      paragraph (s "[Assert·Does]" "Whether the edit changes one slot, one clause or one word is derived from the codepoints of the two sides." ++ s "[Assert·Does·Neg]" "A pair never declares it." ++ s "[Assert·Does]" "Most pairs in this manual change one slot of one clause, and the sentence after each pair names that slot.")
      table [t "Pair", t "Question", t "Bad side answers", t "Good side answers"]
        [ [t "“moved” against “moves”", t "What does clause 2 assert?", t "Did or Does", t "Does"]
        , [t "a missing backup obligation", t "Must operators do anything?", t "yes or no", t "yes, back up STATE/reviews"]
        , [t "“should” against “must”", t "Is restoring optional?", t "no consistent answer", t "no"]
        ]
      paragraph (s "[Assert·Does]" "The second pair adds a whole sentence, “Operators must now back up STATE/reviews”, because no smaller edit gives the question one answer.")
    section (Identifier "Writing a pair") [text "Writing a pair"] $ do
      paragraph (s "[Assert·Done]" "Before you start, a review has found a question that a text leaves with no answer or several.")
      ordered
        [ paragraph (s "[Direct·Did]" "Write the question as its reader would ask it, with its alternatives.")
        , paragraph (s "[Direct·Did]" "Copy the bad side exactly as it appeared.")
        , paragraph (s "[Direct·Did]" "Annotate the bad side, and list the answers it allows.")
        , paragraph (s "[Direct·Did]" "Make the smallest edit that leaves the question exactly one answer.")
        , paragraph (s "[Direct·Did]" "Annotate the good side, and confirm that it allows that one answer.")
        , paragraph (s "[Direct·Did]" "Try each smaller edit to the bad side." ++ s "[Direct·Did]" "If one of them resolves the question, take it as the good side and return to step 5.")
        , paragraph (s "[Direct·Did]" "Name the document kind the pair belongs to.")
        ]
      section (Identifier "Checking a pair") [text "Checking a pair"] $ do
        paragraph (s "[Assert·Does]" "The pair is complete when the good side gives the question one answer, the bad side gives none or several, and no smaller edit resolves it.")
      section (Identifier "When a pair cannot be written") [text "When a pair cannot be written"] $ do
        paragraph (s "[Assert·Does]" "Sometimes the annotations of the two sides are identical even though their answers differ." ++ s "[Assert·Does]" "No codepoint separates them, so dreamstop lacks a distinction." ++ s "[Direct·Did]" "Record the pair with both sentences and the question, and open an issue proposing the codepoint or rule that would separate them.")
    section (Identifier "The corpus") [text "The corpus"] $ do
      paragraph (s "[Assert·Does]" "Pairs live as data." ++ s "[Assert·Does]" "Each entry is a Vortex value holding the document kind, the question, both sides, both annotations and the edit." ++ s "[Assert·Does]" "Guides render their examples from the corpus, so the handbook and the checker share one source of truth.")
      paragraph (s "[Assert·Does]" "Agents that annotate are prompted with the pairs for the document kind." ++ s "[Assert·Does]" "The pairs both calibrate annotators and test them." ++ s "[Assert·Does·Neg]" "An annotator that misreads either side of a pair is not trusted.")
      paragraph (s "[Assert·Does]" "Every new ambiguity the owner catches becomes a new pair." ++ s "[Assert·Does]" "If no existing codepoint separates the two sides, the pair adds a codepoint, a rule or a question." ++ s "[Assert·Does]" "The minimal pair is how dreamstop learns.")

  section (Identifier "Annotating a sentence") [text "Annotating a sentence"] $ do
    paragraph (s "[Assert·Done]" "Before you start, you know the kind of document the sentence belongs to." ++ sx "[Assert·Done]" [text "You have also read the pairs for that kind in ", reference (Identifier "Pairs per document"), text "."])
    ordered
      [ paragraph (s "[Direct·Did]" "Split the sentence into clauses." ++ s "[Direct·Did]" "Treat a relative clause such as “which moves reviews out of SQLite” as a clause of its own.")
      , paragraph (s "[Direct·Did]" "For each clause, choose its force: Assert, Direct or Ask.")
      , paragraph (s "[Direct·Did]" "Choose its aspect: Did, Done, Doing or Does." ++ s "[Direct·Did]" "Ask whether the clause reports an event or describes what something does.")
      , paragraph (s "[Direct·Did]" "Choose its phase, if the clause compares the software before and after a release." ++ s "[Direct·Did]" "Look for now, no longer, still and not yet.")
      , paragraph (s "[Direct·Did]" "Choose its negation: Neg before the modality denies the modality, and Neg after it denies the content.")
      , paragraph (s "[Direct·Did]" "Choose its modality, if the clause is about obligation, recommendation, ability, necessity or possibility.")
      , paragraph (s "[Direct·Did]" "Choose its bound and its evidence, if the clause turns on them.")
      , paragraph (s "[Direct·Did]" "Write the vector in slot order and the annotation in clause order.")
      , paragraph (s "[Direct·Did]" "Ask whether another careful reader would choose a different codepoint in any slot." ++ s "[Direct·Did]" "If so, write that reading as a second annotation.")
      , paragraph (s "[Direct·Did]" "Check every annotation against the document rules, and drop the readings that break them.")
      ]
    section (Identifier "Checking an annotation") [text "Checking an annotation"] $ do
      paragraph (s "[Assert·Does]" "The result is a verdict." ++ s "[Assert·Does]" "One remaining annotation means the sentence is clear, several mean it is ambiguous, and none means it is nonsense." ++ s "[Assert·Does]" "An annotation is correct when another reader, working alone, writes the same characters.")
    section (Identifier "When readers disagree") [text "When readers disagree"] $ do
      paragraph (s "[Direct·Did]" "Find the first slot in which the two annotations differ." ++ s "[Direct·Did]" "Look that slot up in its layer's section and read its pair." ++ s "[Assert·Does]" "If both readings remain admissible, the sentence is ambiguous, and the author rewrites it." ++ s "[Direct·Did]" "Annotate the rewrite from step 1.")

  section (Identifier "How reviews use dreamstop") [text "How reviews use dreamstop"] $ do
    paragraph (s "[Assert·Done]" "Before a review starts, the change under review has its documentation in place.")
    ordered
      [ paragraph (s "[Direct·Did]" "Annotate every changed sentence, each reviewer working alone.")
      , paragraph (s "[Direct·Did]" "Compare the annotations sentence by sentence.")
      , paragraph (s "[Direct·Did]" "For each question in the document's set, find the sentences that answer it, and count the answers.")
      , paragraph (s "[Direct·Did]" "Report each question with no answer or several, and each sentence whose annotations differ, naming the slot and the readings on each side.")
      ]
    section (Identifier "Checking a review") [text "Checking a review"] $ do
      paragraph (s "[Assert·Does]" "The review passes when every sentence has a single admissible annotation and every question in the set has exactly one answer." ++ s "[Assert·Does]" "A finding names a question or a slot, so it is short." ++ s "[Assert·Does]" "“Clause 2: Did against Does” tells the author where to look and what to choose between.")
    section (Identifier "Settling a finding") [text "Settling a finding"] $ do
      paragraph (s "[Assert·Does]" "The author answers a finding by rewriting the text." ++ s "[Assert·Does·Neg]" "A reply that explains what the author meant does not settle the finding." ++ s "[Direct·Did]" "Review the rewritten text from step 1." ++ s "[Assert·Does]" "Every finding that a review settles is a candidate pair for the corpus.")

  section (Identifier "This manual's questions") [text "This manual's questions"] $ do
    paragraph (s "[Assert·Does]" "This manual is held to its own question set." ++ s "[Assert·Does]" "Each procedure answers the four questions a manual's reader is entitled to ask, in the sections below." ++ s "[Assert·Does]" "The repository keeps this map as data in prose/questions.vx, and the build checks that every section it names exists.")
    table [t "Procedure", t "What do I do?", t "In what order?", t "How do I know it worked?", t "How do I recover?"]
      [ [t "Annotating a sentence", t "Annotating a sentence", t "its numbered steps", t "Checking an annotation", t "When readers disagree"]
      , [t "Writing a pair", t "Writing a pair", t "its numbered steps", t "Checking a pair", t "When a pair cannot be written"]
      , [t "Reviewing", t "How reviews use dreamstop", t "its numbered steps", t "Checking a review", t "Settling a finding"]
      ]

  section (Identifier "Worked examples") [text "Worked examples"] $ do
    paragraph (s "[Assert·Does]" "These sentences come from the ChangeLogs of nixlab-shell 0.122.0.0 and vortex-shell 0.7.0.0 and 0.7.0.1." ++ s "[Assert·Does]" "Each example quotes the sentence, gives its readings and settles it under the ChangeLog rules.")
    section (Identifier "Example: the review store") [text "The review store"] $ do
      quotation $ paragraph (t "Added the review store (NixLab.ReviewStore), which moved reviews and sign-offs out of SQLite.")
      readingTable
        [ [t "1", c "[Assert·Did] [Assert·Did]", t "the release moved the existing reviews once"]
        , [t "2", c "[Assert·Did] [Assert·Does]", t "the store is where reviews live from this release"]
        ]
      paragraph (s "[Assert·Does]" "The sentence is ambiguous in the aspect of clause 2." ++ s "[Assert·Does]" "Reading 1 breaks the ChangeLog rule that keeps Did for the release action." ++ s "[Assert·Does]" "The rewrite gives clause 2 the present tense, so only reading 2 remains.")
      quotation $ paragraph (t "Added the review store (NixLab.ReviewStore), which moves reviews and sign-offs out of SQLite.")
      paragraph (s "[Assert·Does]" "The same entry says that the forge imports the SQLite tables once, at first use." ++ s "[Assert·Does]" "That sentence carries New and Once, and it holds the one-time event that reading 1 was reaching for.")
    section (Identifier "Example: vortex-shell") [text "vortex-shell and uninterruptible loops"] $ do
      quotation $ paragraph (t "Compiled code that loops without allocating is neither charged nor interruptible. Nothing in the shell stops it.")
      paragraph (s "[Assert·Does]" "vortex-shell 0.7.0.0 had this entry." ++ s "[Assert·Does] [Assert·Does]" "Without a phase it reads as a change, as though 0.7.0.0 introduced the limitation." ++ s "[Assert·Does]" "That breaks the rule that every standing claim has a phase.")
      readingTable
        [ [t "1", c "[Assert·Does·New·Neg]", t "this release made such loops uninterruptible"]
        , [t "2", c "[Assert·Does·Kept·Neg]", t "such loops were uninterruptible before and remain so"]
        ]
      paragraph (s "[Assert·Does]" "0.7.0.1 corrected the entry." ++ s "[Assert·Does]" "Reading 2 was meant, and its Kept is licensed by the New in the same entry: 0.7.0.0 began charging evaluation that allocates.")
      quotation $ paragraph (t "Compiled code that loops without allocating is still uninterruptible, so the shell cannot stop it.")
      paragraph (s "[Assert·Does]" "The rewrite annotates as [Assert·Does·Kept] [Assert·Does·Neg·Can].")
    section (Identifier "Example: operator obligations") [text "Operator obligations"] $ do
      quotation $ paragraph (t "Operators must now back up STATE/reviews/ and STATE/approvals/ with the rest of the state directory.")
      paragraph (s "[Assert·Does]" "This sentence from nixlab-shell 0.122.0.0 is clear." ++ s "[Assert·Does]" "It annotates as [Assert·Does·New·Must].")
      paragraph (s "[Assert·Does]" "Its force is Assert, because the ChangeLog reports that an obligation exists." ++ s "[Assert·Does]" "Its modality is Must and it names the reader, operators, as the rule for obligations requires." ++ s "[Assert·Does]" "Its phase is New, because the obligation did not exist before the release.")
      paragraph (s "[Assert·Does·Neg]" "The obligation is not a fact about backups." ++ s "[Assert·Does]" "A reviewer who reads it as evidence that backups exist has applied a counit that Must lacks.")
      quotation $ paragraph (t "After restoring a state directory without them, operators should now restore them.")
      paragraph (s "[Assert·Does]" "The companion sentence annotates as [Assert·Does·New·Should]." ++ s "[Assert·Does]" "It recommends where the first sentence obliges, and the modality slot records that difference.")

  section (Identifier "Reference table") [text "Reference table"] $ do
    paragraph (s "[Assert·Does]" "The table lists every codepoint in slot order.")
    table [t "Layer", t "Codepoint", t "Meaning", t "Algebra"]
      [ [t "Force", c "Assert", t "states that p", t "judgement"]
      , [t "Force", c "Direct", t "tells a reader to act", t "plan"]
      , [t "Force", c "Ask", t "asks which alternative holds", t "set of alternatives"]
      , [t "Aspect", c "Did", t "happened, as a whole", t "monotone"]
      , [t "Aspect", c "Done", t "happened, result holds", t "monotone, event to state"]
      , [t "Aspect", c "Doing", t "under way", t "non-monotone"]
      , [t "Aspect", c "Does", t "typically", t "tolerates exceptions"]
      , [t "Phase", c "New", t "false before, true after", t "non-monotone"]
      , [t "Phase", c "Gone", t "true before, false after", t "non-monotone"]
      , [t "Phase", c "Kept", t "true before and after", t "monotone"]
      , [t "Phase", c "Due", t "false before and after, expected", t "non-monotone"]
      , [t "Outer negation", c "Neg", t "denies the modality, or the clause", t "reverses monotonicity"]
      , [t "Modality", c "Must", t "obligation", t "functor, no counit"]
      , [t "Modality", c "Should", t "recommendation", t "functor, no counit"]
      , [t "Modality", c "Can", t "ability", t "functor"]
      , [t "Modality", c "Nec", t "necessarily", t "comonad"]
      , [t "Modality", c "Poss", t "possibly", t "monad"]
      , [t "Inner negation", c "Neg", t "denies the content under the modality", t "reverses monotonicity"]
      , [t "Bound", c "Once", t "one bounded event", t ""]
      , [t "Bound", c "Each", t "each occurrence", t ""]
      , [t "Evidence", c "Measured", t "rests on a measurement", t ""]
      , [t "Evidence", c "Claimed", t "rests on the writer's word", t ""]
      ]

  section (Identifier "Glossary") [text "Glossary"] $ do
    glossary
      [ definition (Identifier "Term: annotation") [text "Annotation"] $ paragraph (s "[Assert·Does]" "One reading of a sentence, written as one vector of codepoints per clause.")
      , definition (Identifier "Term: clause") [text "Clause"] $ paragraph (s "[Assert·Does]" "A part of a sentence that makes one claim, gives one instruction or asks one question.")
      , definition (Identifier "Term: codepoint") [text "Codepoint"] $ paragraph (s "[Assert·Does]" "One value of one layer, such as Does or Gone.")
      , definition (Identifier "Term: continuous disambiguation") [text "Continuous disambiguation"] $ paragraph (s "[Assert·Does]" "Comparing readings at every review and rewriting every sentence that is not clear.")
      , definition (Identifier "Term: corpus") [text "Corpus"] $ paragraph (s "[Assert·Does]" "The minimal pairs kept as Vortex data, from which guides render their examples.")
      , definition (Identifier "Term: document rule") [text "Document rule"] $ paragraph (s "[Assert·Does]" "A predicate over annotations for one kind of document, specified by its pairs.")
      , definition (Identifier "Term: layer") [text "Layer"] $ paragraph (s "[Assert·Does]" "One slot of a vector: force, aspect, phase, outer negation, modality, inner negation, bound or evidence.")
      , definition (Identifier "Term: minimal pair") [text "Minimal pair"] $ paragraph (s "[Assert·Does]" "A bad and a good sentence whose annotations differ in exactly one slot of one clause.")
      , definition (Identifier "Term: monotone") [text "Monotone"] $ paragraph (s "[Assert·Does]" "Said of an operator that turns a stronger proposition into a stronger result.")
      , definition (Identifier "Term: reading") [text "Reading"] $ paragraph (s "[Assert·Does]" "One meaning that a reader finds in a sentence.")
      , definition (Identifier "Term: release") [text "Release"] $ paragraph (s "[Assert·Does]" "The event a ChangeLog entry reports, and the point that phase compares across.")
      , definition (Identifier "Term: vector") [text "Vector"] $ paragraph (s "[Assert·Does]" "The codepoints of one clause, written in slot order inside square brackets.")
      , definition (Identifier "Term: verdict") [text "Verdict"] $ paragraph (s "[Assert·Does]" "Nonsense, clear or ambiguous: the result of gathering every reader's readings.")
      ]