geometor.byrne.pseudocode

Formal grammar, AST, and 3-way Rosetta metrics for Oliver Byrne’s 1847 Visual Pseudocode.

Models Oliver Byrne’s 1847 notation (Introduction, pp. ix–xi, xxvii–xxix) as a pointer-free, typed geometric value-token language:

  • Classical Euclidean Text (Heath / Heiberg): Pass-by-reference. Geometric objects are unnamed in ink; vertices carry alphabetic memory addresses (A, B, C, …) and prose dereferences composite tuples (line AB, angle BAC, triangle FBC, square ABFG) at every step.

  • Byrne 1847 Visual Pseudocode: Pass-by-value. Every geometric primitive is assigned a perceptual signature (kind, color, stroke, fill) that appears literally inside vertical symbolic equations (∴, ∵, =, +, ⊏, ⊐, ∥, ⊥, ∷) with marginal axiom/proposition citations.

  • GEOMETOR Formal Pseudocode (elements / model): Typed Constructive DAG. Explicit constructor steps (line, circle, intersect) and symbolic algebraic invariants over exact number fields.

Attributes

ROSETTA_PROGRAMS

Classes

TokenKind

Typed geometric primitive sorts in Byrne's 1847 visual grammar.

StrokeMode

Stroke patterns used by Byrne to multiply his 4-color register space.

FillMode

Planar region rendering modes in Chiswick Press woodblock plates.

ProofPhase

Canonical block phases in Byrne's structured proposition layout.

VisualToken

An inline pass-by-value geometric glyph in a Byrne statement.

OpToken

An algebraic, relational, or deductive operator in a Byrne equation.

TextFragment

Minimal connecting English keyword in Byrne's telegraphic equations.

ByrneStatement

A single structured line in a Byrne visual program.

ByrneProgram

Complete 3-way Rosetta formalization of a Euclidean proposition.

RegisterDiagnostic

Static visual register-allocation audit for a ByrneProgram.

RosettaMetrics

Quantitative comparison across Heath (alphabetic), Byrne (visual), and GEOMETOR (DAG).

Functions

count_alphabetic_dereferences(text) → int

Count symbolic letter-pointer dereferences (AB, BCD, point A, ...) in classical prose.

analyze_visual_registers(program) → RegisterDiagnostic

Audit visual register allocation and collision freedom in program.

compute_rosetta_metrics(program) → RosettaMetrics

Compute quantitative Rosetta comparison metrics for a ByrneProgram.

get_rosetta_program(prop_id) → ByrneProgram

Lookup a ByrneProgram by proposition ID (e.g. "I.47").

Module Contents

class geometor.byrne.pseudocode.TokenKind

Bases: enum.StrEnum

Typed geometric primitive sorts in Byrne’s 1847 visual grammar.

LINE = 'line'
ANGLE = 'angle'
TRIANGLE = 'tri'
SQUARE = 'sq'
RECTANGLE = 'rect'
ARC = 'arc'
CIRCLE = 'circle'
MAGNITUDE = 'mag'
class geometor.byrne.pseudocode.StrokeMode

Bases: enum.StrEnum

Stroke patterns used by Byrne to multiply his 4-color register space.

SOLID = 'solid'
DASHED = 'dashed'
DOTTED = 'dotted'
SOLID_DOTTED = 'solid-dotted'
class geometor.byrne.pseudocode.FillMode

Bases: enum.StrEnum

Planar region rendering modes in Chiswick Press woodblock plates.

NONE = 'outline'
FILLED = 'filled'
HALF = 'half'
THREE_SIDE = 'three-side'
class geometor.byrne.pseudocode.ProofPhase

Bases: enum.StrEnum

Canonical block phases in Byrne’s structured proposition layout.

ENUNCIATION = 'enunciation'
GIVEN = 'given'
SOUGHT = 'sought'
CONSTRUCTION = 'construction'
DEMONSTRATION = 'demonstration'
QED = 'qed'
class geometor.byrne.pseudocode.VisualToken

An inline pass-by-value geometric glyph in a Byrne statement.

Encodes primitive kind (TokenKind), Byrne color expression, stroke (StrokeMode), fill (FillMode), optional interactive geom_ref, squared exponent flag, Book V shape_hint, and intentional symmetric congruence_group.

kind: TokenKind
color: str
stroke: StrokeMode
fill: FillMode
geom_ref: str = ''
squared: bool = False
shape_hint: str = ''
congruence_group: str = ''
property register_signature: tuple[str, str, str, str, str]

Perceptual tuple distinguishing this token in visual working memory.

role_spec_body(plate_id: str = '') → str

Build the RST role argument string for :byrne-<kind>:.

to_rst(plate_id: str = '') → str

Compile this visual token into a Sphinx :byrne-*: role.

to_html(plate_id: str = '') → str

Render this visual token directly to an interactive HTML/SVG span.

to_compact() → str

Return a concise human-readable token representation for CLI/tables.

class geometor.byrne.pseudocode.OpToken

An algebraic, relational, or deductive operator in a Byrne equation.

symbol: str
to_rst() → str
to_html() → str
to_compact() → str
class geometor.byrne.pseudocode.TextFragment

Minimal connecting English keyword in Byrne’s telegraphic equations.

text: str
to_rst() → str
to_compact() → str
class geometor.byrne.pseudocode.ByrneStatement

A single structured line in a Byrne visual program.

Stores block phase (ProofPhase), ordered items of visual tokens, operators, and minimal connectors, marginal Euclidean justifications, and an optional analytical comment.

phase: ProofPhase
items: tuple[StatementItem, ...]
justifications: tuple[str, ...] = ()
comment: str = ''
visual_tokens() → list[VisualToken]

Return all VisualToken instances in this statement.

word_count() → int

Count natural-language words (excluding pure visual glyphs and operators).

to_rst(plate_id: str = '') → str

Compile statement into RST with inline :byrne-*: and :just: roles.

to_compact() → str

Render statement into compact Unicode pseudocode.

class geometor.byrne.pseudocode.ByrneProgram

Complete 3-way Rosetta formalization of a Euclidean proposition.

Pairs Byrne’s 1847 pointer-free visual program with Heath’s classical alphabetic English translation and GEOMETOR’s formal DAG pseudocode.

prop_id: str
plate_id: str
heath_id: str
g_id: str
title: str
pickering_page: str
number_field: str
statements: tuple[ByrneStatement, ...]
heath_text: str
geometor_steps: tuple[str, ...]
design_notes: str = ''
all_visual_tokens() → list[VisualToken]

Flatten all visual tokens appearing across all phases of the program.

class geometor.byrne.pseudocode.RegisterDiagnostic

Static visual register-allocation audit for a ByrneProgram.

distinct_signatures: int
distinct_geom_refs: int
uses_stroke_modulation: bool
uses_composite_tokens: bool
intentional_congruence_twins: tuple[str, ...]
ambiguous_collisions: tuple[str, ...]
property is_unambiguous: bool

Return True iff zero unintended visual register collisions exist.

class geometor.byrne.pseudocode.RosettaMetrics

Quantitative comparison across Heath (alphabetic), Byrne (visual), and GEOMETOR (DAG).

prop_id: str
heath_words: int
heath_pointer_dereferences: int
byrne_words: int
byrne_pointer_dereferences: int
byrne_visual_tokens: int
byrne_distinct_registers: int
byrne_statement_count: int
geometor_step_count: int
word_compression_ratio: float
register_diagnostic: RegisterDiagnostic
geometor.byrne.pseudocode.count_alphabetic_dereferences(text: str) → int

Count symbolic letter-pointer dereferences (AB, BCD, point A, …) in classical prose.

Excludes Roman numeral proposition references (I, II, III, IV, V, VI) when preceded by Book or Prop.

geometor.byrne.pseudocode.analyze_visual_registers(program: ByrneProgram) → RegisterDiagnostic

Audit visual register allocation and collision freedom in program.

Distinguishes:

  1. Stroke modulation (dashed / dotted / solid-dotted) when 4 colors alone cannot separate adjacent collinear or overlapping elements;

  2. Composite tokens (yellow+black split angles or red/blue/black triangles);

  3. Intentional congruence twins (e.g. equal legs / A B / and / A C / in I.5 deliberately sharing red solid to encode AB = AC visually); and

  4. Ambiguous collisions (two unequal geom_ref entities sharing an identical register signature without a congruence_group declaration).

geometor.byrne.pseudocode.compute_rosetta_metrics(program: ByrneProgram) → RosettaMetrics

Compute quantitative Rosetta comparison metrics for a ByrneProgram.

geometor.byrne.pseudocode.ROSETTA_PROGRAMS: dict[str, ByrneProgram]
geometor.byrne.pseudocode.get_rosetta_program(prop_id: str) → ByrneProgram

Lookup a ByrneProgram by proposition ID (e.g. "I.47").