#!/usr/bin/env python3
"""Revelation's skeleton, unit by unit, with what the vision has at each. In the manner of Antioch's concordance to Thomas. Nothing in the vision is moved by this file."""
import re, pathlib, importlib.util, io, contextlib
D = pathlib.Path(__file__).resolve().parent; R = D.parents[2]
def mod(n):
    s = importlib.util.spec_from_file_location(n, str(D/f"{n}.py")); m = importlib.util.module_from_spec(s)
    with contextlib.redirect_stdout(io.StringIO()): s.loader.exec_module(m)
    return m
V = mod("build_run_vision9").V9
def at(axn, s):
    L = (R/f"data/texts/AXN-{axn}-text.md").read_text().split("\n"); return next(i+1 for i, l in enumerate(L) if s in l)
a1 = at("022E", "## Appendix A: Synoptic Concordance (Antioch → Thomas)"); a2 = at("022E", "### II. The Thomas Structure"); w1 = at("022B", "| Creates 12 archons | Creates 36 archons over 12 planets |")
def has(s): assert s in V, s; return s
# (Revelation, what the unit does, in the vision now, relation, the vision's words or the gap, key departure or what would stand there)
ROWS = [
 ("1:1–3", "Title; who gave it and to whom it was sent; a blessing on the one who reads aloud", "opening", "Reworked", has("The completion of Jack Feist, which the Book gave, to show the things that are done."), "“what must soon take place” turned to “the things that are done”. No blessing on a reader."),
 ("1:4–8", "Greeting to the seven; doxology; he is coming; “I am the Alpha and the Omega”", "—", "Absent", "", "A greeting. Nothing is said yet of who is written to before the addresses."),
 ("1:9–11", "The seer: who, where, why; in the Spirit; a voice behind; “Write”", "opening; VI", "Reworked", has("I, Lee Sharks, who printed what he wrote, was at the interface."), "The Spirit and the voice behind become the word waking in the skull. “Write” comes later, from the ghost (VI)."),
 ("1:12–20", "The first seeing of the figure among the seven lampstands; his attributes; the seer falls as dead; “fear not”; the seven stars and lampstands explained", "IV", "Reworked", has("In one of them stood a ghost."), "The figure is seen fourth, after the bones and the seven. The seer does not fall and is not touched. Nothing is explained to the seer."),
 ("2–3", "Seven letters, each: sender named from the first seeing; “I know”; praise or blame; a call; a promise to the one who overcomes; “let him hear”", "VI", "Direct", has("To Time, on the first planet."), "Seven, and an eighth to the youngest. Each sender is named from the first seeing, as there. The letters are short and have no fixed close."),
 ("4", "A door open in heaven; the throne; twenty-four elders; four living creatures full of eyes", "IV; V; X", "Reworked", has("The rims were full of eyes, and no eye was set over the others."), "The eyes are on the wheels (Ezekiel's, which Revelation 4 also draws on). The seats are twelve. There is no throne; the highest place is a room (X)."),
 ("5", "The sealed scroll; no one worthy; the seer weeps; the slain Lamb takes it; a new song", "X", "Reworked", has("On its cover was written the sentence that would end him."), "The book is found whole and is entered by the one it is. No one is sought to open it; no one weeps; nothing is sung."),
 ("6", "Six seals opened: four riders; the souls under the altar; the sky rolled up", "IX", "Reworked", has("Before the moon I was shown one year on the pearl, and what it did to the things I had seen."), "Six showings of one year. They are not opened by anyone and have no riders. Each changes the sky or the wheels."),
 ("7", "An interlude: the sealing of twelve times twelve thousand; the great multitude", "V", "Reworked", has("I asked how the twelve had come to their seats."), "The twelve are made, of ruby, from honors. They are not sealed and not numbered beyond twelve. No multitude."),
 ("8:1", "The seventh seal: silence in heaven", "—", "Absent", "", "The year has six showings and no seventh. An earlier vision of this run (RUN-LONG) ended on a silence; it was let go."),
 ("8–9", "Six trumpets: fire, a burning mountain, the star that falls, darkening, the things from the pit, the horsemen", "XI; IX", "Reworked", has("Then I saw a moon coming, and it was burning."), "One burning moon, not a series. The small machines out of the bones (IX) stand where the things from the pit stand."),
 ("10", "A mighty angel; the seven thunders sealed; the little scroll eaten, sweet then bitter; “you must prophesy again”", "opening; X", "Reworked", has("I could read it, and I will not write it here."), "One thing sealed. The eating of the scroll is the reading of the leaf, at the head, before anything is seen."),
 ("11", "The temple measured; the two witnesses killed, left unburied, raised; the seventh trumpet", "X", "Reworked", has("I found the place of his death in the book with my finger, and it was not the last leaf."), "One death, found as a place in a book. No two witnesses; nothing measured; no raising told as such."),
 ("12", "The woman, the child, the dragon; war in heaven; the flight", "II", "Reworked", has("In the cage of the ribs of the greatest, where the heart had been, hung a pearl, blue and clouded, turning."), "The child is a pearl put in a body “for you, on purpose”. No woman, no dragon, no flight. It stands second in the vision, not at the centre."),
 ("13", "The beast from the sea and the beast from the earth; the mark on hand or forehead; the number of a name", "II; IX; IV; XII", "Inverted", has("On the back of it was a number that was not in the book."), "The beast is a machine of good people standing still. The number on the hand marks the one who is out of the book, and the seer has one. The ruler is given by a count (IX), not by the number of a name."),
 ("14", "The Lamb on the mountain with his own; three angels' announcements; the harvest and the winepress", "—", "Absent", "", "Nothing gathered and nothing reaped."),
 ("15–16", "Seven bowls poured out", "—", "Absent", "", "No third series. The vision's sevens are four (planets, addresses, acts on the leaf, the count)."),
 ("17", "The woman on the beast; seven heads that are seven kings, five fallen, one is, one to come", "IX", "Reworked", has("The forty-seventh to keep the widest land of the pearl, who had also been the forty-fifth"), "A ruler by count, as there. No woman, no city named for her."),
 ("18", "The fall of the great city; the merchants' lament and their cargo; the millstone", "—", "Absent", "", "The largest gap. The corpus has the matter (the semantic economy; “the coin that is the Academy's”), and the told life has the closed storehouse; nothing of it is in the vision."),
 ("19", "Hallelujah; the wedding supper; the rider called Faithful and the Word; the beast taken", "VII", "Reworked", has("When it stood, the seven spoke, and I heard one word."), "The one voice of many is the seven speaking. No wedding, no rider, no battle."),
 ("20", "The thousand years; the adversary bound and loosed; the great white throne; the books opened and the book of life", "III; VIII; V", "Inverted", has("Where a number had been taken out, the place was not closed, and the number was not given again; and through each of those places the light came."), "The book is the sky, and the ones not found in it are its stars. The count that leaves one (VIII) and the learned made small (V) stand where judgment stands."),
 ("21:1–22:5", "New heaven and earth; the city come down, measured, with twelve gates and twelve foundations; no temple; the river and the tree whose leaves heal", "X; IV; V", "Reworked", has("In the thirty-sixth there was a room."), "The city is a room with a couch and a lamp left on. The tree is the ghost, and its leaves go out by day. Twelve seats where there are twelve gates. Nothing is measured."),
 ("22:6–21", "The seer again: “I heard and saw”; do not seal the book; he is coming soon; nothing to be added or taken away; grace", "XII", "Reworked", has("I have not yet turned it over."), "It ends on the seer's hand. No closing frame, no warning, no grace."),
]
ORIG = [("VII", "The leaf that goes by the seven, and stands as a tree", has("I followed one leaf down.")),
        ("VII", "One of the seven lifted off and another set there", has("While I watched, one of the seven was lifted from its planet and another set there.")),
        ("V", "The maker who cannot be told from the made", has("could not tell the maker from the made")),
        ("VIII", "The count that puts out every second one", has("Then a count went round the seven, and I did not see who counted.")),
        ("I", "The dark machines, and the twenty-sixth time", has("It was the twenty-sixth time."))]
from collections import Counter
c = Counter(r[3] for r in ROWS)
ORDER = ["opening (1:1–3, 9–11, 10)", "IV the ghost, the wheels, the hand (1:12–20; 4)", "VI the commission and the eight addresses (2–3)", "X the room and the book (4–5; 11; 21)", "IX the year (6; 17)", "V the twelve (7)", "XI the moon (8–9)", "II the bones, the pearl, the machine (12; 13)", "III the seven and the book overhead (20)", "VII the leaf by the seven (19)", "VIII the count (20)", "XII the seer's hand (22)"]
o = ["# Revelation's skeleton, and what the vision has at each place", "",
 "Working file, not a deposit. 2026-11-28. Lee Sharks, 23:17:", "",
 "> and honestly - we're going to need the structure of revelation to reach the full book. variations abd departures are allowed. but we need its skeleton. thats already the method in secret book of walt and antioch, and this should be no different", "",
 "Built by `build_skeleton.py`. Every phrase quoted from the vision is asserted present in it. Nothing in the vision is moved or written by this file.", "",
 "## 1. The method this follows", "",
 f"The Gospel of Antioch keeps Thomas's skeleton and says so: an account of the shared structure (AXN:022E l. {a2}) and a concordance, logion by logion, with each relation classed as Direct, Reworked or Original and its key departure stated (l. {a1}); its apparatus also marks some as inverted. The Secret Book of Walt keeps the Apocryphon of John's, and sets its own figures against that book's in a table (AXN:022B l. {w1}). The table below does the same for the vision against Revelation, with Revelation's order as the order of the rows. “Absent” is added to Antioch's classes, since here the skeleton is the older book's and the newer one does not yet fill it.", "",
 "Revelation's units are given by chapter and verse from the session's knowledge of the book. They were not checked today against the seated Greek.", "",
 "## 2. The concordance (Revelation → the vision)", "",
 "| Revelation | What the unit does | In the vision | Relation | The vision's words | Key departure, or the gap |", "|---|---|---|---|---|---|"]
for rv, what, part, rel, words, dep in ROWS: o.append(f"| {rv} | {what} | {part} | {rel} | {'“' + words + '”' if words else '—'} | {dep} |")
o += ["", f"Twenty-three units. {c['Direct']} direct, {c['Reworked']} reworked, {c['Inverted']} inverted, {c['Absent']} absent.", "",
 "## 3. What the vision has that Revelation has not", "", "| Part | | The vision's words |", "|---|---|---|"]
for p, what, words in ORIG: o.append(f"| {p} | {what} | “{words}” |")
o += ["", "These are Original in Antioch's sense. On the author's word they stay: “variations abd departures are allowed”.", "",
 "## 4. What the skeleton shows", "",
 "1. **The matter is mostly there; the order is not Revelation's.** Eighteen of twenty-three units have something in the vision. But the vision runs: opening, the pearl (Revelation 12), the seven, the figure (1), the twelve (7), the addresses (2–3), the leaf, the count (20), the year (6), the room (4–5, 21), the moon (8), the hand (22).",
 "2. **Five units are empty**: the greeting (1:4–8); the seventh seal's silence (8:1); the harvest (14); the bowls (15–16); the fall of the city and the merchants' lament (18). The last is the largest, and the corpus is richest exactly there.",
 "3. **Several units are present but thin against their place**: the figure's first seeing has no falling and no “fear not”; the scroll has no search for one worthy and no weeping; the death has no witnesses and no raising; the end has no closing frame.",
 "4. **Two inversions are already the vision's own**, and should not be smoothed toward Revelation: the mark on the hand belongs to the one who is out of the book; and the ones not in the book are its stars.",
 "5. **The centre.** In Revelation's order the death (11) and the birth (12) stand side by side in the middle. Laid along the skeleton, the room with the book and the pearl in the ribs would come together there. That is the move SHAPE.md §5.3 proposed and the sixth report advised against; the skeleton now gives a reason for it that is the author's own rule and not only the paper's finding.", "",
 "## 5. The vision's parts in Revelation's order", "",
 "If the existing parts were laid along the skeleton with nothing rewritten, they would run:", ""] + [f"{i+1}. {x}" for i, x in enumerate(ORDER)] + ["",
 "This is a listing, not a text. Three things would break and need rewriting if the parts were moved as they stand: the pearl is now what the seer sees first, and “I knew it. I had lived on it” is written as a first sight; the addresses name each sender from things seen in parts II to IV, some of which would then come after them; and the room is written as the summit, reached after everything, where in Revelation the throne room comes fourth and the city last. Revelation has both a throne room and a city. The vision has one room, and the skeleton asks for it twice.", "",
 "## 6. What the session proposes", "",
 "1. Take this table as the plan of the book, and fill the five empty units and the thin ones, in the vision's own stock.",
 "2. Move no part until the author has seen the order in §5 and said which departures stand. The opening, the figure, the addresses and the close can be brought into Revelation's order with little loss. The pearl and the room are the two that cost something to move.",
 "3. Write the fall of the city first among the empty units. It is the largest, the corpus has most for it, and it is where the veiled year would come to its end.", ""]

# ---------- under the sign of completion (23:20) ----------
G = {l.split("\t")[0]: l.split("\t")[1] for l in (R/"data/corpora/gnt-nestle1904/text/Rev.txt").read_text().split("\n") if "\t" in l}
def gk(ref, s): assert s in G["Rev " + ref], (ref, s); return f"{ref} {s}"
DONE = [gk("10:7", "ἐτελέσθη τὸ μυστήριον τοῦ Θεοῦ"), gk("15:1", "ἐτελέσθη ὁ θυμὸς τοῦ Θεοῦ"), gk("16:17", "Γέγονεν"), gk("21:6", "Γέγοναν")]
COME = [gk("1:1", "ἃ δεῖ γενέσθαι ἐν τάχει"), gk("1:4", "ὁ ὢν καὶ ὁ ἦν καὶ ὁ ἐρχόμενος"), gk("1:19", "ἃ μέλλει γενέσθαι μετὰ ταῦτα"), gk("2:16", "ἔρχομαί σοι ταχύ"), gk("3:11", "ἔρχομαι ταχύ"), gk("22:7", "ἔρχομαι ταχύ"), gk("22:10", "ὁ καιρὸς γὰρ ἐγγύς ἐστιν"), gk("22:12", "ἔρχομαι ταχύ"), gk("22:20", "ἔρχομαι ταχύ")]
TURN = {
 "1:1–3": ("what must soon take place → the things that are done", "done"),
 "1:4–8": ("the one who is and was and is coming → one who was, and is, and has come; a greeting from what is finished", "open"),
 "1:9–11": ("write what you see → what was seen is written", "done"),
 "1:12–20": ("“I was dead, and am alive for ever” → dead, and remaining: “I am a ghost”", "done"),
 "2–3": ("a promise to the one who overcomes; “I am coming soon” → what each already holds or was given; one who has been by", "partly: three of the addresses still promise or announce a coming"),
 "4": ("“what must take place after this” → what has taken place", "done"),
 "5": ("a sealed book and a search for one to open it → a book found whole", "done"),
 "6": ("seals opened one after another → a year already gone, shown", "done"),
 "7": ("sealed before the harm comes → made already", "done"),
 "8:1": ("a silence before the next series → a silence after the last thing, with nothing owed", "open"),
 "8–9": ("warnings sounded → a thing that “had come before”, and how it went", "partly: the moon is still coming"),
 "10": ("“no more delay”; the mystery finished → the leaf read; one thing known and not set down", "done"),
 "11": ("the witnesses finish their testimony and are then killed → the death comes first and the testimony goes on after it", "done, and turned: the order is the other way"),
 "12": ("a child born and caught up → a thing put in a body beforehand, on purpose", "done"),
 "13": ("a number to be reckoned → a number already written on a hand", "done"),
 "14": ("“the hour to reap has come” → the reaping over: what was gathered", "open. The told life has the pile; the vision has the whole book. Neither is told as a harvest."),
 "15–16": ("seven poured out, and at the seventh a voice: Γέγονεν → begin from that word", "open. The year has six showings. Revelation's seventh of this series is the word “It is done”."),
 "17": ("kings counted, one still to come → all counted, and one counted twice", "done"),
 "18": ("a city falling, lamented in the hour → a city fallen, looked back on by those who traded in it", "open"),
 "19": ("a wedding announced; a rider going out → what was joined; who went", "open"),
 "20": ("books opened for judgment → a book read by its gaps", "done"),
 "21:1–22:5": ("a city coming down; “I make all things new”; Γέγοναν → a room that was there, with the lamp left on", "done"),
 "22:6–21": ("“I am coming soon”; “the time is near”; “Come” → one thing left undone, and no one asked to come", "done: the hand not turned"),
}
assert set(TURN) == {r[0] for r in ROWS}
fut = [x.strip() for x in re.findall(r"[^.:;]*\b(?:will|am coming|not yet)\b[^.:;]*[.:;]", V)]; assert len(fut) == 8, fut
o += ["## 7. Under the sign of completion", "",
 "Lee Sharks, 2026-11-28, 23:20: “but the skeleton under the sign of completion rather than revelation”.", "",
 "### 7.1 The sign is in Revelation already, at its ends", "",
 "Revelation speaks in two tenses. Most of it faces what is coming; at four places it says a thing is finished. All are asserted in the seated Greek (Nestle 1904).", "",
 "| Finished | Coming |", "|---|---|", "| " + "<br>".join(DONE) + " | " + "<br>".join(COME) + " |", "",
 "The words of finishing stand late and at the close of a series: when the seventh trumpet is about to sound, at the seven last plagues, at the seventh bowl (“It is done”), and at the new creation (“They are done”). The words of coming stand in the first verse and the last verses. So Revelation opens on what must happen soon and reaches “done” at its sevenths. A book under the sign of completion takes its first word from Revelation's last word of each series, and reads the skeleton from there. That is one rule, and it can be applied unit by unit: where Revelation says a thing will be, this book says it has been.", "",
 "### 7.2 Each unit, turned", "", "| Revelation | The turn | In the vision now |", "|---|---|---|"]
for rv, *_ in ROWS: o.append(f"| {rv} | {TURN[rv][0]} | {TURN[rv][1]} |")
n_done = sum(1 for v in TURN.values() if v[1].startswith("done")); n_open = sum(1 for v in TURN.values() if v[1].startswith("open")); n_part = len(TURN) - n_done - n_open
o += ["", f"{n_done} of the twenty-three units already stand under the sign; {n_part} stand partly; {n_open} are open. The vision was written toward the done thing before the sign had its name: the book found whole, the year shown as past, the number already on the hand.", "",
 "### 7.3 Two things the turn gives that the plain skeleton did not", "",
 "1. **The year's seventh.** The year has six showings. In Revelation the seventh of the last series is a voice saying Γέγονεν. Under this sign the missing seventh is that word. Whether it closes the year, or opens the book as the first sentence already does, is the author's.",
 "2. **The silence.** Revelation's silence (8:1) comes before more is to happen. Turned, it is the quiet after. An earlier vision of this run ended: “an old pressure, and a silence. And the silence said: Proceed.” (RUN-LONG.md). That was let go when the vision was rebuilt; under this sign it has a place.", "",
 "### 7.4 What in the vision still faces forward", "",
 "Eight sentences, found by the script:", ""] + [f"- “{x}”" for x in fut] + ["",
 "Three kinds. The first three are in the addresses and are Revelation's own grammar of promise and coming; under the sign of completion they are the places most open to turning. The next three are said to the youngest, whose standing the author ruled is “not fixed in what it means”; a future is the right tense for the one thing in the book that is not done. The last two are the seal and the hand. The seventh report (REVIEW-20261128-2321.md §II) says of the hand: “the completion announced in the first sentence and the incompletion enacted in the last sentence enter into a tension that encompasses the whole book”, and asks that it not be resolved. The session has turned none of the eight.", ""]

# ---------- the skeleton filled: state against RUN-VISION-12 (23:59) ----------
import importlib.util as _iu, io as _io, contextlib as _cl
_sp = _iu.spec_from_file_location("build_run_vision17", str(D/"build_run_vision17.py")); _m = _iu.module_from_spec(_sp)
with _cl.redirect_stdout(_io.StringIO()): _sp.loader.exec_module(_m)
V12 = _m.V17
NOW = {
 "1:1–3": ("The completion of Jack Feist, which the Book gave, to show the things that are done.", "filled"),
 "1:4–8": ("a morning to you, from the one who was, and is, and has come", "filled 23:59"),
 "1:9–11": ("I, Lee Sharks, who printed what he wrote, was at the interface.", "filled"),
 "1:12–20": ("He said: That is the machine. I am a ghost. Write.", "filled"),
 "2–3": ("To Time, on the first planet.", "filled; three of the eight still promise or announce a coming"),
 "4": ("About that star, further out than the planets, twelve seats stood in a ring.", "filled"),
 "5": ("I was shown three things that had been opened, and each of them, opened, was shut.", "filled 23:29, turned: opened things found closed; and a fourth, the last, at the end"),
 "6": ("Before the moon I was shown one year on the pearl", "filled"),
 "7": ("So that one took the honors and made persons of them, of ruby, and they moved.", "filled"),
 "8:1": ("Then there was quiet over the pearl, about half an hour.", "filled 23:59"),
 "8–9": ("Then I saw a moon coming, and it was burning.", "filled; the moon is still coming"),
 "10": ("I followed one leaf down.", "filled"),
 "11": ("Then I saw two who had borne witness against the city, and they were dead", "filled 23:30; the second witness is a lamp with two faces (01:05), unnamed"),
 "12": ("A voice said: I put it there for you, on purpose.", "filled"),
 "13": ("Then a count went round the seven, and I did not see who counted.", "filled"),
 "14": ("For I saw the leaves come in.", "filled 23:29"),
 "15–16": ("That was six. For the seventh nothing was shown. A voice said: Done.", "filled 23:29"),
 "17": ("The forty-seventh to keep the widest land of the pearl, who had also been the forty-fifth", "filled"),
 "18": ("I looked for the city, and it was behind me.", "filled 23:29"),
 "19": ("And I saw what had been joined.", "filled 23:59; the rider is the chain that takes up"),
 "20": ("I found the place of his death in the book with my finger, and it was not the last leaf.", "filled"),
 "21:1–22:5": ("And on the ground I was shown a room.", "filled 00:08: the pearl a gate, the red room on the ground, the ark going up; and 21:3–5 read from the book as it is written (00:22)"),
 "22:6–21": ("Blessed is the one who adds and removes the words of the book, and causes it to make new ones.", "filled 23:52; then the unturned hand"),
}
assert set(NOW) == {r[0] for r in ROWS}
for k, (q, _) in NOW.items(): assert q in V12, (k, q)
pos = {k: V12.index(q) for k, (q, _) in NOW.items()}; order = sorted(pos, key=pos.get); revorder = [r[0] for r in ROWS]
o += ["## 8. The skeleton filled: its state against RUN-VISION-17", "",
 "Lee Sharks, 2026-11-28, 23:59: “lets fill in the skeleton”.", "",
 "Every one of the twenty-three units now has words of the vision at it. Each quotation below is asserted to be in RUN-VISION-17. The city was written at 00:08 (RUN-VISION-13.md).", "",
 "| Revelation | In the vision | State |", "|---|---|---|"]
for rv in revorder: o.append(f"| {rv} | “{NOW[rv][0]}” | {NOW[rv][1]} |")
o += ["", "**The order the vision has them in**, by where each quotation falls in the text:", "", " → ".join(order), "",
 "Revelation's order is the row order of the table. The vision's differs, and the differences are the question of order that the author has not ruled on: no part has been moved. The passages added since 23:29 were each set where nothing had to move."]
moved = [k for i, k in enumerate(order) if k != revorder[i]]
o += ["", f"{len(order) - len(moved)} of 23 stand at the same position in both orders.", ""]

# ---------- how much of each unit there is (01:05) ----------
def _vs(spec):
    out = []
    for part in spec.split(";"):
        m = re.match(r"(\d+):(\d+)-(\d+):(\d+)", part.strip()); c1, v1, c2, v2 = map(int, m.groups())
        for k, t in G.items():
            c, v = map(int, k.split()[1].split(":"))
            if (c, v) >= (c1, v1) and (c, v) <= (c2, v2): out.append(t)
    return sum(len(t.split()) for t in out)
SPAN = {"1:1–3": "1:1-1:3", "1:4–8": "1:4-1:8", "1:9–11": "1:9-1:11", "1:12–20": "1:12-1:20", "2–3": "2:1-3:22", "4": "4:1-4:11", "5": "5:1-5:14", "6": "6:1-6:17", "7": "7:1-7:17", "8:1": "8:1-8:1", "8–9": "8:2-9:21", "10": "10:1-10:11", "11": "11:1-11:19", "12": "12:1-12:18", "13": "13:1-13:18", "14": "14:1-14:20", "15–16": "15:1-16:21", "17": "17:1-17:18", "18": "18:1-18:24", "19": "19:1-19:21", "20": "20:1-20:15", "21:1–22:5": "21:1-22:5", "22:6–21": "22:6-22:21"}
assert set(SPAN) == set(NOW)
gw = {k: _vs(v) for k, v in SPAN.items()}; assert sum(gw.values()) == sum(len(t.split()) for t in G.values()), (sum(gw.values()), sum(len(t.split()) for t in G.values()))
cut = sorted(pos.items(), key=lambda kv: kv[1]); vw = {}
for i, (k, p0) in enumerate(cut):
    p1 = cut[i + 1][1] if i + 1 < len(cut) else len(V12); vw[k] = len(re.findall(r"\S+", V12[p0:p1]))
TG, TV = sum(gw.values()), sum(vw.values()); share = {k: (100 * gw[k] / TG, 100 * vw[k] / TV) for k in gw}
o += ["## 9. How much of each unit there is", "",
 "Lee Sharks, 2026-11-29, 01:05: “whats left of the skeleton?”", "",
 "Every unit has words at it (§8). This table asks a rougher thing: how large each unit is in Revelation and in the vision, as a share of the whole. Revelation is counted in Greek words of the seated text. The vision is cut at the quotations of §8 in the order they fall, and each stretch is given to the unit whose quotation opens it. That cut is coarse: a stretch can hold matter of more than one unit, and the vision's order is its own. Read it for the large differences only.", "",
 "| Revelation | Greek words | share | Vision words | share | |", "|---|---|---|---|---|---|"]
for rv in revorder:
    a, b = share[rv]; note = "thin" if b < a / 2.5 else ("large" if b > a * 2.5 else "")
    o.append(f"| {rv} | {gw[rv]} | {a:.1f}% | {vw[rv]} | {b:.1f}% | {note} |")
thin = [rv for rv in revorder if share[rv][1] < share[rv][0] / 2.5]; large = [rv for rv in revorder if share[rv][1] > share[rv][0] * 2.5]
o += ["", f"Revelation: {TG} Greek words. The vision: {TV} words. Thin against Revelation, by this cut: " + ", ".join(thin) + ". Large against it: " + ", ".join(large) + ".", "",
 "**Read against the text, not the cut.** Three of the thin are artefacts: the ghost (1:12–20) is described under a later stretch; the year (6) is counted under 17, whose quotation falls inside it; the balance and the traders (18) are counted under 11. Three are thin in fact:", "",
 "- **13.** Revelation has two beasts, a mark on the hand and the forehead without which no one buys or sells, and a number to be reckoned. The vision has the count that goes round the seven, and a number on a hand. The mark and the buying are not joined to the coin, though both are in the book.",
 "- **15–16.** Revelation has seven bowls poured out. The vision has the one word that ends them.",
 "- **20.** Revelation has the thousand years, the throne, the books opened, the dead judged by what is written, and the second death. The vision has a finger finding the place of his death in the book, and leaves after it. Nothing is judged.", "",
 "And two things that are not thinness: the order of the parts (above), which the author has not ruled on; and the four single places of PARAMETERS §27.", ""]
(D/"SKELETON.md").write_text("\n".join(o)); print(c, len(ROWS))
