← Back to 20260317 archive

P-Programming Worked Examples

This is the first six-step example ladder. Abstractly these are fixed pattern sets in P. Concretely, in the current SN/UMR realization, they are encoded as fixed entries inside LPP containers because SN does not yet have a separate top-level syntax for ungrouped static product-pattern sets.

1. Boolean Logic

Boolean AND
.c and .sn. One-step combinational translation.
Boolean XOR
.c and .sn. Same syntax, different total relation.

2. Two-Line Straight-Line Program

OR then AND
.c and .sn. Introduces an internal hidden event space x and explicit composition.

3. Register Write

Conditional write to next state
.c and .sn. First persistence-facing example: current state, control flag, input, next state.

4. Branch / Control

Flag-gated routing
.c and .sn. First explicit control example.

5. Sequential Machine

Two-state parity update
.c and .sn. A tiny automaton with real state-update semantics.

6. Classic Algorithm

1-bit full adder
.c and .sn. Internal intermediates t, carry1, carry2, then sum and cout.

Verification

./umr info docs/archive/20260317/boolean-and-example.sn
./umr info docs/archive/20260317/boolean-xor-example.sn
./umr info docs/archive/20260317/two-line-example.sn
./umr info docs/archive/20260317/register-write-example.sn
./umr info docs/archive/20260317/branch-example.sn
./umr info docs/archive/20260317/parity-machine-example.sn
./umr info docs/archive/20260317/full-adder-example.sn