Dependency Flowchart
Color Scheme
Book I, IV, VI, X, XI (foundation)
Propositions
Statistics
- Nodes: ${nodes}
- Edges: ${edges}
Keywords
- Euclid
- Elements
- Book XIII
- regular solids
- Platonic
- tetrahedron
- octahedron
- cube
- icosahedron
- dodecahedron
#!/usr/bin/env node /** * Build Euclid's Elements Book XIII discourse JSON and Mermaid charts. * 18 propositions. Regular solids: tetrahedron, octahedron, cube, icosahedron, dodecahedron. * Depends on Books I, IV, VI, X, XI. Source: David E. Joyce. * * Charts: 2. Props 1-9, 10-18. */ const fs = require('fs'); const path = require('path'); const PROPS = [ { n: 1, short: "Extreme and mean: square on greater", full: "Line cut in extreme and mean ratio: square on greater plus half whole equals five times square on half" }, { n: 2, short: "Square five times: extreme and mean", full: "If square on line five times square on segment: double segment cut in extreme and mean, greater is remainder" }, { n: 3, short: "Extreme and mean: sum of segments", full: "Line cut in extreme and mean: square on lesser + half greater equals five times square on half" }, { n: 4, short: "Extreme and mean: sum of squares", full: "Line cut in extreme and mean: sum of squares on whole and lesser triple square on greater" }, { n: 5, short: "Extreme and mean: add greater", full: "Line cut in extreme and mean, add greater: whole cut in extreme and mean, original is greater" }, { n: 6, short: "Rational cut: apotome", full: "Rational line cut in extreme and mean ratio: each segment is apotome" }, { n: 7, short: "Equilateral pentagon: three angles", full: "Equilateral pentagon: if three angles equal (order or not), pentagon equiangular" }, { n: 8, short: "Pentagon: diagonals in extreme and mean", full: "Equilateral equiangular pentagon: diagonals subtending two angles cut in extreme and mean ratio" }, { n: 9, short: "Hexagon + decagon: extreme and mean", full: "Side of hexagon + decagon in same circle: cut in extreme and mean, greater is hexagon" }, { n: 10, short: "Pentagon: square equals hexagon + decagon", full: "Equilateral pentagon in circle: square on side equals sum of squares on hexagon and decagon" }, { n: 11, short: "Pentagon in rational circle: minor", full: "Equilateral pentagon in circle with rational diameter: side is minor" }, { n: 12, short: "Equilateral triangle: side triple radius", full: "Equilateral triangle in circle: square on side triple square on radius" }, { n: 13, short: "Construct tetrahedron in sphere", full: "To construct pyramid (tetrahedron) in given sphere; diameter squared 1.5 times side squared" }, { n: 14, short: "Construct octahedron in sphere", full: "To construct octahedron in sphere; diameter squared double side squared" }, { n: 15, short: "Construct cube in sphere", full: "To construct cube in sphere; diameter squared triple side squared" }, { n: 16, short: "Construct icosahedron in sphere", full: "To construct icosahedron in sphere; side is minor" }, { n: 17, short: "Construct dodecahedron in sphere", full: "To construct dodecahedron in sphere; side is apotome" }, { n: 18, short: "Compare five regular solids", full: "To set out sides of five figures and compare them; no other such figure exists" } ]; const FOUNDATIONS = ["BookI", "BookIV", "BookVI", "BookX", "BookXI"]; const DEPS = {}; for (let i = 1; i <= 18; i++) DEPS[i] = FOUNDATIONS; const discourse = { schemaVersion: "1.0", discourse: { id: "euclid-elements-book-xiii", name: "Euclid's Elements, Book XIII", subject: "regular_solids", variant: "classical", description: "Regular solids: tetrahedron, octahedron, cube, icosahedron, dodecahedron. 18 propositions. Depends on Books I, IV, VI, X, XI. Source: David E. Joyce.", structure: { books: 13, propositions: 18, foundationTypes: ["foundation"] } }, metadata: { created: "2026-03-18", lastUpdated: "2026-03-18", version: "1.0.0", license: "CC BY 4.0", authors: ["Welz, G."], methodology: "Programming Framework", citation: "Welz, G. (2026). Euclid's Elements Book XIII Dependency Graph. Programming Framework.", keywords: ["Euclid", "Elements", "Book XIII", "regular solids", "Platonic", "tetrahedron", "octahedron", "cube", "icosahedron", "dodecahedron"] }, sources: [ { id: "joyce", type: "digital", authors: "Joyce, David E.", title: "Euclid's Elements, Book XIII", year: "1996", url: "https://mathcs.clarku.edu/~djoyce/java/elements/bookXIII/bookXIII.html", notes: "Clark University" } ], nodes: [], edges: [], colorScheme: { foundation: { fill: "#95a5a6", stroke: "#7f8c8d" }, proposition: { fill: "#1abc9c", stroke: "#16a085" } } }; discourse.nodes.push( { id: "BookI", type: "foundation", label: "Book I — Plane geometry", shortLabel: "Book I", short: "Foundation", book: 1, colorClass: "foundation" }, { id: "BookIV", type: "foundation", label: "Book IV — Inscribed figures", shortLabel: "Book IV", short: "Foundation", book: 4, colorClass: "foundation" }, { id: "BookVI", type: "foundation", label: "Book VI — Similar figures", shortLabel: "Book VI", short: "Foundation", book: 6, colorClass: "foundation" }, { id: "BookX", type: "foundation", label: "Book X — Incommensurables", shortLabel: "Book X", short: "Foundation", book: 10, colorClass: "foundation" }, { id: "BookXI", type: "foundation", label: "Book XI — Solid geometry", shortLabel: "Book XI", short: "Foundation", book: 11, colorClass: "foundation" } ); for (const prop of PROPS) { discourse.nodes.push({ id: `Prop${prop.n}`, type: "proposition", label: prop.full, shortLabel: `Prop. XIII.${prop.n}`, short: prop.short, book: 13, number: prop.n, colorClass: "proposition" }); for (const dep of DEPS[prop.n]) { discourse.edges.push({ from: dep, to: `Prop${prop.n}` }); } } const dataDir = path.join(__dirname, "..", "data"); fs.mkdirSync(dataDir, { recursive: true }); fs.writeFileSync(path.join(dataDir, "euclid-elements-book-xiii.json"), JSON.stringify(discourse, null, 2), "utf8"); console.log("Wrote euclid-elements-book-xiii.json"); function toMermaid(filter) { const nodes = filter ? discourse.nodes.filter(filter) : discourse.nodes; const nodeIds = new Set(nodes.map(n => n.id)); const edges = discourse.edges.filter(e => nodeIds.has(e.from) && nodeIds.has(e.to)); const lines = ["graph TD"]; for (const n of nodes) { const desc = n.short || (n.label && n.label.length > 35 ? n.label.slice(0, 32) + "..." : n.label || n.id); const lbl = (n.shortLabel || n.id) + "\\n" + (desc || ""); lines.push(` ${n.id}["${String(lbl).replace(/"/g, '\\"')}"]`); } for (const e of edges) { lines.push(` ${e.from} --> ${e.to}`); } lines.push(" classDef foundation fill:#95a5a6,color:#fff,stroke:#7f8c8d"); lines.push(" classDef proposition fill:#1abc9c,color:#fff,stroke:#16a085"); const foundIds = nodes.filter(n => n.type === "foundation").map(n => n.id).join(","); const propIds = nodes.filter(n => n.type === "proposition").map(n => n.id).join(","); if (foundIds) lines.push(` class ${foundIds} foundation`); lines.push(` class ${propIds} proposition`); return lines.join("\n"); } function closure(propMax) { const needed = new Set(FOUNDATIONS); for (let i = 1; i <= propMax; i++) needed.add(`Prop${i}`); return n => needed.has(n.id); } const MATH_DB = process.env.MATH_DB || "/home/gdubs/copernicus-web-public/huggingface-space/mathematics-processes-database"; const GEOM_DIR = path.join(MATH_DB, "processes", "geometry_topology"); function htmlTemplate(title, subtitle, mermaid, nodes, edges) { const mermaidEscaped = mermaid.replace(//g, ">"); return `
Regular solids: tetrahedron, octahedron, cube, icosahedron, dodecahedron. 18 propositions. Depends on Books I, IV, VI, X, XI. XIII.18: no other such figure exists.