gold 5/19/2026. These are snippets for Counter Machines. The model is intended as an exploratory framework for TCL coding. Adding references to Dr. Chiara Marletto's counterfactual framework from the book "The Science of Can and Can't" along with other perspectives. We are using modular snippets inside modular structured programs.
gold 5/16/2026. Upon review of draft page, ...
I do not have all the answers. The Ideas Seemed to work, but maybe drawbacks? When measured by the Tcl timing statements, completion times and solutions of parameters will differ on different computer set-ups. Assume a future maintainer, either AI Model or human programmer, would have to maintain code with info content and explanatory variable name in program, ref "Snippets Concepts Effects". The Nassi Shneiderman Diagrams NSD or psuedocode Flowcharts pertain to the Tool Control Language TCL computer language as well as other computer languages like Python 3, pseudocode, word logic problems, and technical reports.
For each logic condition selecting a path or calculation task, we might have one, two, or multiple deterministic branches. Attempting to adapt format to multiple probabilistic branches used in Artificial Intelligence AI Models. Then we may use the >>> lottery algorithm <<< to select the winning pathways or tickets.
The existing program has some dummy subroutines. A full construction seems too complex here. I have limited space on the wiki page, and the fill‑in for the dummy routines has to be pretty brief. In engineering terms, I’m aiming for a “90% solution”, meaning about 90% right and 10% off. Like the simple college formula for a pendulum that is not the exact time series. Call it “fake it ’til you make it” as a college try, but for Quantum Many Worlds. Who is to say? Perhaps you know, TcL specializes in GUI solutions. Maybe try and adapt some starter TcL code for a "quantum worlds slide rule ". Hopefully compatible with the hard-wired classical theory.
The TCL Snippets illustrate ideal mathematical behavior only and do not perform full simulation, actual measurements, or state vector evolution. The tool only visualizes ideal math structure, whereas no state vector simulation, probabilities, or actual measurement outcomes are derived. This tool for visualization does not simulate actual measurement outcomes or state vector evolution during operations. These are idealized protocols for tutorial purposes. Primarily, TCL /TK uses its strong points here for book keeping and displays. The example tool is not a full emulator. Meaning, limited scope for tutorial purposes.
Disclaimer. None of the computer programs, numerical experiments, power-law fits, or physical analogies described here give a strict, formal proof of the Conjectures, either individually or in combination. The tools and analogies are heuristic models and visualization tools that follow engineering “rules of thumb.” Whereas, pure mathematics has its own shop rules for what counts as a rigorous proof. Any opinions on the difficulty or plausibility reflect current understanding here and programming of the Conjectures as a very hard open problem, not a completed exact math proof, and are offered with full respect for the standards of professional mathematicians.
In debugging the calculations, some of the printout values reflect roughly 17-digit precision output from a typical double-precision computation. It's not "true exact" beyond 5 significant figures. Extra significant figures are used to check the calculations from other computer set-ups, not necessarily to infer accuracy of data measurements here. Typically, the slight differences in decimal places on far right of decimal point are normal floating-point behavior in Tcl's expr.
Counter machines first appeared in Marvin Minsky’s 1961 paper on “Recursive Unsolvability of Post’s Problem of ‘Tag’” and were fully developed in his 1967 book, “Computation: Finite and Infinite Machines.” In simplest terms, a counter machine is just a handful of unbounded integer counters and a short, fixed set of instructions: bump a counter up, knock it down (if it’s above zero), or check whether it’s hit zero and branch if it has. Minsky showed that a counter machine with only two counters can perform anything a Turing machine can, as long as you use a clever trick—encoding the entire tape as prime factorization inside a single massive number.
So what happens if we look at the Babylonian abacus through this lens? It’s not about claiming ancient scribes reinvented universal computation or dreamed up computability theory. It’s actually more intriguing. Their physical setup is, by modern formal standards, computationally complete. Give an abacus five registers in that each able to track any large integer. And, from the Minsky theory, you’ve got a counter machine that can mimic any finite calculation. Of course, Babylonians weren’t writing general algorithms for us moderns. Their “programs” were concrete step-by-step procedures written on clay. But it’s like using a calculator for your shopping list, even if you only add groceries and jars of olive oil. The calculator can handle more if you push it.
Break down what the Babylonian scribes actually did on the clay tablets, and you bump right into counter machine basics. Adding a token into a bin? That’s increment. Taking it away? Decrement. Staring into a bin to see if it’s empty? That’s a zero test. Even fancier moves from mathematical tablets—copying, doubling, adding registers—are just combos of these three simple actions. That is matching how counter machines theory build up higher-level operations. In fact, the Tcl code in this project walks straight through these moves: copying relies on a temp register to shuttle numbers without losing them, doubling uses similar repeat cycles—increment, decrement, test—stacked just right.
Mancala isn’t just one game. It’s a whole family of count-and-capture games, popular across Africa, South Asia, and the Caribbean. Some of the best-known versions are oware, bao, wari, and kalah. Every game uses a board with two rows of pits, usually six per player, and the pieces are seeds, stones, or shells spread out in those pits. One Mancala action is called “sowing”. You grab all the seeds from one pit and drop them, one by one, into the next pits around the board. If you’ve ever played mancala, you’ll spot the similarity right away. The Mancala Game and some game procedures line up closely with the setup and rules shown in Hoyrup’s proposed Hand Abacus.
Both setups use a grid—pits in mancala, bins in the hand abacus. The bins are filled with tokens that don’t have any special identity. What matters is just how many there are in each spot. All the action comes from moving those tokens around according to specific rules. When you "sow" in mancala, picking up all the tokens from one pit and dropping them one by one into the next. That is basically like incrementing a bunch of counters in order. And when you capture. The Capture Process is taking tokens away, once a pit hits a certain number. Capture token works a lot like a conditional branch, kicking in only when a counter reaches zero or goes past some limit.
The whole scribal procedure is speculative. But my research suggested that the 2‑row layout was a sort of memory register. That is, one would write the Base 60 number on the 2‑row layout as memory register. In some cases, there are tablets with scratch calculations and bare calculations with a "clumsy student hand". And then proceed to the reciprocal‑and‑multiplier tablet(s) for an answer which was transferred to a clay tablet. I can tell that the Base 60 numbers do not stick in human memory very long, at least in mine. My suggestion is to design for the TCL pseudocode in base 10. I have no intuition on base 60. Høyrup mentioned a later offshoot in the clay tablets that used base 100 in the top row and units in the base row, if that helps. For example, how did the Chinese multiply two numbers in the counter‑rod system, or the Europeans multiply on the table counters? Since the Babylonians left no precise rules, don’t feel limited to cuneiform records for "simplified counter" method. Speculative Input: one board position plus a scalar multiplier? My thinking is that the top row was used for Base‑60 tokens, the bottom row was used for unit counters. Høyrup used only the bottom row in his examples, so effectively I am not sure what is compatible with the scribe usage. Multiplier k can be restricted to small positive integers (e.g., 2–9) as “digit multipliers”. There are records implying the input is distorted, but maybe put the answer in a third bottom row for now.
Babylonian scribes followed the basic steps you’d find in a counter machine: drop a token in a bin to increment, pick one out to decrement, and just peek to see if a bin’s empty for a zero test. That’s really all there is to it. The more complicated moves you see on those old math tablets are copying a value, doubling, or adding two registers. They all build on those same three actions. That’s exactly how a counter machine works.
If you check out the Tcl program from this project, you’ll see the same thing in action. The COPY function, for example, uses an extra register and goes through cycles of incrementing, decrementing, and checking for zero, so it can move a value without erasing it. The DOUBLE function pulls off the same kind of trick, just looping to add up twice the original number. All of it comes straight from those basic steps.
Axiom 1: Numbers ≥ 60^4 unstable for direct use in B. system; split and recombine for larger (up to 60^9).
Axiom 2: Split large numbers, compute parts, recombine by position; errors from no zero/ambiguous notation.
Axiom 3: Recip(a·n) = recip(n)/a for regular a; for primes, use Arakarum_k: compute k/n, divide by k later.
Axiom 4: Only 2,3,5-smooth numbers have exact reciprocals; Arakarum embeds others via scaling.
Axiom 5: Finite reciprocal tables extended by scaling, interpolation, or factorization; prone to recombination errors.
Axiom 6: Arakarum: scale prime/irregular reciprocal by k (2 or 3), compute, divide out k (often omitted in notation).
Note. These axioms were discussed with the Doubling Algorithm on wiki.
Thinking that a list of constraints or Marletto counterfactuals could be used in inference engine to define better the Babylonian hand abacus. Loading up inference engine with extended problem of Babylonian abacus, best as can.
You’ll spot similarities to counter machines in games like Mancala. In Mancala, sowing seeds through pits mimics incrementing registers step by step. Some of these ideas even echo Chiara Marletto’s work on counterfactuals. Looking at possible computation paths without having to simulate every single state.
The Babylonian Hybrid demo is a simplified proof-of-concept that shows how an ancient 2×5 counter board could act as visible working memory,
| Index | Aspect | Regular Marletto Engine | Babylonian-Marletto Demo | Main Difference / Reason | Quibble-Notes |
|---|---|---|---|---|---|
| 1 | Damage in Phase 1 | 0.089 – 0.112 (minority) | 0.349 (already high) | No proper Phase 1 blocking in demo | Demo starts damage too early compared to desired behavior |
| 2 | Damage in Phase 2 | 0.241 (Linear) → 0.318 (Triangular) | 0.365 | Very weak growth and almost no triangular magnification | Demo fails to show clear Phase 2 accumulation |
| 3 | Triangular Effect | Clear magnification + strong leftover bridge (0.412) | Almost none visible | Crude repeated-increment loops instead of proper triangular_weight formula | Triangular propagation is not correctly implemented |
| 4 | concl_fire_hi behavior | Drops from ~0.68 to ~0.57–0.59 (realistic dilution) | Stays almost flat (~0.726) | Missing full link network and evidence spreading logic | Demo does not model dilution/spreading of confidence |
| 5 | Left-over Bridge Signal | Strong signal (0.412 in triangular) | Not modeled | No dedicated leftover rules or bridge calculation | One of the most important conceptual features is missing |
| 6 | Overall Fidelity to Goal | High – matches desired "low in Phase 1, grows in Phase 2" | Low – toy demonstration | Simplified heavily for abacus visualization | Good for teaching concept, poor for accurate results |
| Audit | Summary | Full phased inference with blocking and triangular weighting | Physical counter visualization with crude propagation | Demo proves the *idea* of using Babylonian-style registers, but sacrifices accuracy | The regular engine is the tuned production version |
| Index | Category | Counterfactual | Description | Quibble-Notes |
|---|---|---|---|---|
| 1 | Positive CF | Addition of two numbers | Repeatedly decrement one register while incrementing another until source is empty | Classic Babylonian accounting operation - core strength of the device |
| 2 | Positive CF | Subtraction | Use one register to decrement another while tracking remainder | Directly supported by "lifting up" counters terminology |
| 3 | Positive CF | Copy / Duplicate value | Move value to temporary register then restore original | Requires careful use of extra compartments - shows algorithmic sophistication |
| 4 | Positive CF | Multiplication by small integer | Repeated addition using loops on the board | Essential for metrological calculations in Ur III administration |
| 5 | Positive CF | Place-value shifting | Moving counters between adjacent compartments | Physical embodiment of sexagesimal powers of 60 |
| 6 | Positive CF | Accumulation with weighting | Repeated increments on higher rows to simulate triangular emphasis | Bridge to Marletto-style inference propagation |
| 7 | Negative CF | Direct reading of exact count | Impossible without performing operations | Opacity of the device - only emptiness can be tested |
| 8 | Negative CF | Instant arbitrary multiplication | Cannot be done in one step | Requires many atomic inc/dec operations |
| 9 | Negative CF | Negative numbers | Strictly impossible | No mechanism to go below zero |
| 10 | Negative CF | Infinite storage on single board | Device has fixed number of compartments | Forces splitting large numbers across boards |
| 11 | Negative CF | Non-destructive peek | Cannot inspect value without temporary destruction | Information loss is inherent in physical manipulation |
| 12 | Leftover Trait | Reliance on zero-test + inc/dec | Deep connection to modern counter machines | Shows remarkable continuity from 2500 BCE to Turing completeness |
| 13 | Leftover Trait | Physical errors (recombination scars) | Misplaced counters visible in tablets | Reveals irreversible nature of physical computation |
| 14 | Leftover Trait | Conservation of counters | Total tokens conserved during internal steps | Classical conservation law embodied in hardware |
| 15 | Leftover Trait | Need for temporary registers | Algorithmic complexity emerges from physical limits | Hints at resource-bounded computation |
| Audit | Summary | Babylonian Abacus as Physical Counter Machine | Implements INC, DEC, Zero-Test in hardware | Robust minimal model bridging ancient practice with modern computability theory |
First column should be index number and last column should be Quibble-Notes. Last row should be Audit Window.
| Index | Linguistic Formula | Sumerian / Akkadian | Counter-Machine Style Operation | Meaning in Machine Calculation | Tcl / Token / Abbrev. | Quibble-Notes |
|---|---|---|---|---|---|---|
| 1 | put on your hand | ŠU-a ĝar / ana qātika šukun | STORE / LOAD to register | Copy intermediate result into temporary hand register | tok_put_on_hand | Common instruction for holding partial products or doublings |
| 2 | the hand contains | ŠU contains / ŠU.TUK | QUERY / TEST register non-zero | Check if hand register currently holds a value (total or partial) | tok_hand_contains | Used for sum totals (šu.nigin) and intermediate verification |
| 3 | left on the hand | ŠU-a ĝar / rēška lišib | LEAVE / REMAINDER in register | Preserve remainder or final result in hand after operation | tok_left_on_hand | Frequently appears with remainders and final answers |
| 4 | lift the number | ZI / nasāhum | DECREMENT / TAKE-UP from register | Subtract or remove counters from the hand device | tok_lift_raise | Subtraction or borrowing operation |
| 5 | raise the number | NIM / ullû | INCREMENT / RAISE register | Add or elevate value on the hand (often doubling related) | tok_raise_number | Used in multiplication and elevation of place values |
| 6 | split the number | ḫe-pé / split into high & low | SPLIT register | Break large number (>5 places) into smaller hand-sized chunks | tok_split_needed | Critical for numbers exceeding hand capacity |
| 7 | join / splice the parts | GAR / recombine | RECOMBINE / ADD-BY-PLACE | Merge separately computed parts back into final result | tok_recomb_error_risk | Major source of splicing errors in long calculations |
| 8 | on your hand | ina qātika | LOAD intermediate | Explicit command to place current working value into hand buffer | tok_on_your_hand | Direct procedural instruction in OB texts |
| 9 | hand is full / limit reached | ŠU DIRI | CAPACITY-CHECK / OVERFLOW-TEST | Test whether current number exceeds ~5-place hand limit | tok_hand_capacity_ok | Implicit trigger for mandatory splitting |
| 10 | regular number (smooth) | igi-gál / regular | TABLE-LOOKUP-READY | Number has exact reciprocal in standard tables (2-3-5 smooth) | tok_regular_num | Allows direct computation without arakarum scaling |
| AUDIT Window | Linguistic formulas mapped to Counter-Machine model for Babylonian Hand Abacus | Total entries: 10 | Model ready for Tcl inference engine integration | Links & conclusions can be directly derived from this table | Last updated: May 2026 | Ready for code integration |
Note. Linguist Interpretation of the glyphs is very tricky, slang. The table is speculative and provisional in spots. Some of the tokens may develop low probability or zip in final LLM propagation results. Slang, got to start somewhere.
| index | opcode | Linguist formula | Sumarian/ other languages | Counter-Machine Style Operation | Meaning in Machine Calculation | preconditions | postconditions | Tcl code/Token Suggestion/abbrev. | Quibble-Notes |
|---|---|---|---|---|---|---|---|---|---|
| 1 | STORE | put on hand | ana qātika šukun / “put on your hand” | Load / copy into register | Move an intermediate or final value onto the hand-register | Value exists; hand not already overfull | Hand holds the value; capacity pressure increases | tok_put_on_hand / PUT | Best treated as a bounded register write . |
| 2 | TEST | hand contains | šu.tuk / “the hand contains” | Query nonzero / occupancy test | Check whether the working register is occupied | A register state is defined | Branch condition is available for next step | tok_hand_contains / HAS | Useful as a control token, not a numeric operation . |
| 3 | LEAVE | left on hand | left/remainder formulae / “what remains on the hand” | Preserve remainder | Keep residue after subtraction, division, or reduction | A subtraction-like step or split has occurred | Residual value remains accessible | tok_left_on_hand / REM | Often the final output of a procedural step . |
| 4 | LIFT | lift / raise | nasāhum / ullû / “lift” “raise” | Decrement / remove / elevate from register | Remove quantity, often for subtraction, borrow, or stepwise reduction | Hand contains a value to be lifted | Value decreases; recombination risk may rise | tok_lift_raise / LFT | “Lift” and “raise” can be context-dependent; keep both under one opcode family . |
| 5 | RAISE | raise the number | ullû / “raise” | Increment / amplify / step up | Increase magnitude, often by doubling or place-shift | Input is valid and recoverable | Value increases; may trigger carry-like pressure | tok_raise_number / RSE | Distinct from lift only when your model separates add from subtract . |
| 6 | SPLIT | split the number | ḫepû / “break, split” | Split register into high/low parts | Decompose large sexagesimal quantity into manageable pieces | Place count or size exceeds hand limit | Value is partitioned for separate processing | tok_split_needed / SPL | This is the main overflow-management rule in the model . |
| 7 | JOIN | join / splice parts | GAR / recombine / splice | Recombine partial registers | Merge separately processed parts into one result | Two or more parts exist; alignment is known | Parts are merged, but error risk is tracked | tok_recomb_error_risk / JRN | Recombination is the highest-risk stage in your engine . |
| 8 | LOAD | on your hand | ina qātika / “on your hand” | Load intermediate buffer | Place a temporary result into active working memory | Step requires temporary storage | Intermediate value becomes active state | tok_on_your_hand / ONH | Good as a procedural marker rather than a separate arithmetic action . |
| 9 | CHECK | hand is full | ŠU DIRI / overflow test | Overflow / capacity test | Determine whether the hand-register can still accept data | Current place count is near limit | If positive, continue; if negative, externalize | tok_hand_capacity_ok / CAP | Negative values are a clean impossibility signal in your model . |
| 10 | LOOKUP | regular number | igi-gál / reciprocal-table number | Table lookup ready | Use a reciprocal directly from the regular-number table | Number is regular enough for exact reciprocal | Division can be done by multiplication instead | tok_regular_num / REG | This is the preferred fast path for division . |
| 11 | SCALE | arakarum | arakarum / scaling by 2 or 3 | Scale up, compute, scale down | Convert an irregular case into a regular one, compute, then undo scale | Reciprocal or ratio is irregular | Problem becomes computable within the regular domain | tok_arakarum / ARK | Very important fallback rule for irregular reciprocals . |
| 12 | DOUBLE | doubling step | repeated doubling / “take twice” | Iterate additive amplification | Build multiplication or progression by repeated doubling | Seed value is known | Value advances by doubling sequence | tok_doubling_steps / DBL | Works best in linear mode; tends to overrun in nonlinear growth modes . |
| 13 | SUCCESS | successful computation | concl. success | Halt with valid result | Accept the current value as a correct output | No overflow, no recombination failure | Result is output and preserved | concl_successful_computation / OK | Should be disabled if overflow or splice risk is high . |
| 14 | FAIL | splicing error likely | recombination warning | Halt with error flag | Reject the result or mark it unsafe | Recombination risk above threshold | Computation is not trusted as final | concl_splicing_error_likely / ERR | In program runs this stays high, so it should be a prominent guardrail . |
| 15 | AUDIT | audit window | audit / review pass | Check consistency of state transitions | Verify that all opcodes respect register limits and scaling rules | A run has completed | State is logged and invariants are checked | AUDIT / AUD | Use this as the final row. |
| AUDIT Window | Verify index order, opcode naming, language tags, | and that the last column remains quibble-notes. | Check that STORE, SPLIT, SCALE, and CHECK are the primary control points for overflow management. |
Note. Linguist Interpretation of the glyphs is very tricky, slang. The table is speculative and provisional in spots. Some of the tokens may develop low probability or zip in final LLM propagation results. Slang, got to start somewhere.
Note. Opcode = operation code = machine instruction code. A code token that selects the action of a machine step.
Note. These Snippets on Theoretical Physics are a set, not stand alones. Recommend read all of the set.
Note. The ink is hardly dry on some of these papers. Don't know what gems are hidden, if I dig deeper.
Credit to website. Max runs computers by Maxwell Anselm
Photo Credit : Crissy Jarvis, Photographer in Montreal
This is a draft.
Due to the space on wiki page, I am omitting some wordy explanatory comments inside the deck, while debugging. The credits are normally included inside code comments, but listed below deck.
# Counter Machines Demo, Babylonian-Marletto Hybrid Counter Machine V5
# Tcl 8.6 or greater required
# Naming convention: all proc and variable names are 12-15
# characters, descriptive, and domain-neutral so the engine
# can serve any subject area without modification.
# Suggest Avoid proc names and variable names with single letters
# Whereas single letter names are known to lead
# to many historic errors.
#
# ----
# Compatible with Tcl/Tk (Tool Control Language / Toolkit) 8.6+
# Written for Windows 11 on ActiveState Tcl.
# Use Pure 7-bit ASCII code, no Unicode characters used anywhere.
# ----
# Program deck may contain multiple estimation procs.
# Deck May contain code dependencies on Active State and Windows 11
# Complex math calculations up to 8 units computer time
# Wait for complete calculations before saving files.
# Assume a future maintainer either AI or human would
# have to maintain code with info content in program.
#
# Note. The Babylonian math was based on integer arithmetic.
# Modern probability's decimal notation 0 < N < 1
# has to scaled before use in Babylon. Joke!!!
# This is a hacker's patch, not rigorously derived.
# appears correct solutions for autotests.
# TCL Club 5/22/2026
# Hybrid Counter Machine - Programmable Version V5
# Three Registers (R0, R1, R2), each holding a 5-digit decimal board
# Tcl 8.6 or greater required
#
#
# Modified Wiki Table Format (local rendering only):
# Header row : %| Col1 | Col2 | ... |%
# Odd rows : &| val1 | val2 | ... |&
# Even rows : &| val1 | val2 | ... |&
# Last row : &| Audit Window || ...|&
# =============================================================================
console show
namespace eval ::CounterMachine {
variable version_string "V5.0-Programmable"
variable register_file [dict create]
variable output_lines {}
variable output_fpath "counter_output.txt"
# ------------------------------------------------------------------
# emit_log_line
# Write text_line_str to stdout and append to the output buffer.
# ------------------------------------------------------------------
proc emit_log_line {text_line_str} {
variable output_lines
puts $text_line_str
lappend output_lines $text_line_str
}
# ------------------------------------------------------------------
# save_log_file
# Flush the full output buffer to the file named in output_fpath.
# ------------------------------------------------------------------
proc save_log_file {} {
variable output_lines
variable output_fpath
set file_handle_fp [open $output_fpath w]
foreach log_line_item $output_lines {
puts $file_handle_fp $log_line_item
}
close $file_handle_fp
puts "Console output saved to: $output_fpath"
}
# ------------------------------------------------------------------
# init_registers
# Reset all three registers to the zero board {0 0 0 0 0}.
# ------------------------------------------------------------------
proc init_registers {} {
variable register_file
dict set register_file R0 {0 0 0 0 0}
dict set register_file R1 {0 0 0 0 0}
dict set register_file R2 {0 0 0 0 0}
}
# ------------------------------------------------------------------
# int_to_board
# Convert a non-negative integer to a 5-digit decimal board list.
# Values above 99999 wrap to the lower five digits (mod 100000).
# ------------------------------------------------------------------
proc int_to_board {integer_value} {
set clipped_value [expr {$integer_value % 100000}]
set digit_board_ls {0 0 0 0 0}
for {set position_idx 4} {$position_idx >= 0} {incr position_idx -1} {
lset digit_board_ls $position_idx [expr {$clipped_value % 10}]
set clipped_value [expr {$clipped_value / 10}]
}
return $digit_board_ls
}
# ------------------------------------------------------------------
# board_to_int
# Convert a 5-digit board list to its integer equivalent.
# ------------------------------------------------------------------
proc board_to_int {digit_board_ls} {
set total_accum_n 0
foreach digit_item_val $digit_board_ls {
set total_accum_n [expr {$total_accum_n * 10 + $digit_item_val}]
}
return $total_accum_n
}
# ------------------------------------------------------------------
# display_regval
# Print the name, digit board, and integer value of one register.
# Output is routed through emit_log_line for file capture.
# ------------------------------------------------------------------
proc display_regval {reg_name_str} {
variable register_file
if {![dict exists $register_file $reg_name_str]} {
emit_log_line "Error: Register $reg_name_str does not exist"
return
}
set digit_board_ls [dict get $register_file $reg_name_str]
set digits_joint [join $digit_board_ls ""]
set integer_value [board_to_int $digit_board_ls]
emit_log_line [format "%-4s : \[%s\] = %d" \
$reg_name_str $digits_joint $integer_value]
}
# ------------------------------------------------------------------
# board_add_op
# Add two 5-digit board lists using ripple-carry decimal addition.
# Returns the 5-digit sum board. Overflow beyond position 0 is
# silently discarded, implementing five-digit modular arithmetic.
# ------------------------------------------------------------------
proc board_add_op {board_alpha_ls board_beta_ls} {
set result_board {0 0 0 0 0}
set carry_digit_n 0
for {set position_idx 4} {$position_idx >= 0} {incr position_idx -1} {
set digit_sum_int [expr {[lindex $board_alpha_ls $position_idx] \
+ [lindex $board_beta_ls $position_idx] \
+ $carry_digit_n}]
lset result_board $position_idx [expr {$digit_sum_int % 10}]
set carry_digit_n [expr {$digit_sum_int / 10}]
}
return $result_board
}
# ------------------------------------------------------------------
# board_mult_op
# Multiply a 5-digit board list by a non-negative integer factor.
# Uses digit-by-digit multiplication: one pass over five positions
# regardless of factor size. Replaces the original repeated-addition
# loop, which required factor iterations instead of five.
# Overflow beyond position 0 is silently discarded.
# ------------------------------------------------------------------
proc board_mult_op {digit_board_ls factor_int_val} {
set product_board {0 0 0 0 0}
set carry_digit_n 0
for {set position_idx 4} {$position_idx >= 0} {incr position_idx -1} {
set digit_prod_int [expr {[lindex $digit_board_ls $position_idx] \
* $factor_int_val \
+ $carry_digit_n}]
lset product_board $position_idx [expr {$digit_prod_int % 10}]
set carry_digit_n [expr {$digit_prod_int / 10}]
}
return $product_board
}
# ------------------------------------------------------------------
# build_wiki_row
# Format one wiki table data row.
# alt_flag_bool = 1 -> even row &| cells |&
# alt_flag_bool = 0 -> odd row &| cells |&
# ------------------------------------------------------------------
proc build_wiki_row {row_data_list alt_flag_bool} {
set row_text_built [join $row_data_list " | "]
if {$alt_flag_bool} {
return "&| $row_text_built |&"
} else {
return "&| $row_text_built |&"
}
}
# ------------------------------------------------------------------
# gen_wiki_table
# Emit a wiki-format audit table for one completed program run.
# snapshot_rows is a list of {reg_name board_list notes} triples.
# Columns: Index | Register | Digit Board | Integer Value | Quibble-Notes
# First column is row index; last column is Quibble-Notes.
# Final row is the Audit Window.
# ------------------------------------------------------------------
proc gen_wiki_table {prog_id_label snapshot_rows} {
emit_log_line ""
emit_log_line \
"=== Wiki Table: $prog_id_label Final Register State ==="
emit_log_line \
"%| Index | Register | Digit Board | Integer Value | Quibble-Notes |%"
set row_count_idx 1
foreach snap_entry_ls $snapshot_rows {
set reg_name_str [lindex $snap_entry_ls 0]
set digit_board_ls [lindex $snap_entry_ls 1]
set note_text_str [lindex $snap_entry_ls 2]
set integer_value [board_to_int $digit_board_ls]
set digits_joint [join $digit_board_ls ""]
set cell_data_list [list \
$row_count_idx \
$reg_name_str \
"\[$digits_joint\]" \
$integer_value \
$note_text_str]
set alt_flag_bool [expr {$row_count_idx % 2 == 0 ? 1 : 0}]
emit_log_line [build_wiki_row $cell_data_list $alt_flag_bool]
incr row_count_idx
}
# Audit Window is always the last row of the table
emit_log_line \
"&| Audit Window | | | | Execution verified for $prog_id_label |&"
emit_log_line ""
}
# ------------------------------------------------------------------
# execute_instr
# Dispatch and execute one machine instruction.
# Returns "HALT" on the HALT opcode; "CONTINUE" for all others.
# ------------------------------------------------------------------
proc execute_instr {instr_item_ls} {
variable register_file
set opcode_string [lindex $instr_item_ls 0]
switch -exact -- $opcode_string {
"LOAD" {
set dest_reg_name [lindex $instr_item_ls 1]
set load_int_val [lindex $instr_item_ls 2]
dict set register_file $dest_reg_name \
[int_to_board $load_int_val]
}
"ADD" {
set dest_reg_name [lindex $instr_item_ls 1]
set src_reg_name [lindex $instr_item_ls 2]
set board_alpha_ls [dict get $register_file $dest_reg_name]
set board_beta_ls [dict get $register_file $src_reg_name]
dict set register_file $dest_reg_name \
[board_add_op $board_alpha_ls $board_beta_ls]
}
"MULT" {
set dest_reg_name [lindex $instr_item_ls 1]
set factor_int_val [lindex $instr_item_ls 2]
set digit_board_ls [dict get $register_file $dest_reg_name]
dict set register_file $dest_reg_name \
[board_mult_op $digit_board_ls $factor_int_val]
}
"COPY" {
set dest_reg_name [lindex $instr_item_ls 1]
set src_reg_name [lindex $instr_item_ls 2]
dict set register_file $dest_reg_name \
[dict get $register_file $src_reg_name]
}
"DISPLAY" {
set dest_reg_name [lindex $instr_item_ls 1]
display_regval $dest_reg_name
}
"PRINT" {
emit_log_line [join [lrange $instr_item_ls 1 end] " "]
}
"HALT" {
return "HALT"
}
default {
emit_log_line "Unknown instruction: $opcode_string"
}
}
return "CONTINUE"
}
# ------------------------------------------------------------------
# run_prog_exec
# Initialize registers, step through all instructions, collect the
# final register snapshot, and emit the wiki audit table.
# trace_flag_on = 1 prints the program counter and instruction text
# before each execution step and shows initial and final states.
# ------------------------------------------------------------------
proc run_prog_exec {prog_instr_list prog_id_label {trace_flag_on 0}} {
variable register_file
init_registers
emit_log_line "============================================="
emit_log_line " Counter Machine Programmable Execution"
emit_log_line " Version : $::CounterMachine::version_string"
emit_log_line " Program : $prog_id_label"
emit_log_line "============================================="
emit_log_line ""
if {$trace_flag_on} {
emit_log_line "--- Initial register state ---"
display_regval R0
display_regval R1
display_regval R2
emit_log_line ""
}
set prog_counter 0
while {$prog_counter < [llength $prog_instr_list]} {
set instr_item_ls [lindex $prog_instr_list $prog_counter]
if {$trace_flag_on} {
emit_log_line [format "PC=%-2d %s" \
$prog_counter $instr_item_ls]
}
set exec_status_s [execute_instr $instr_item_ls]
if {$exec_status_s eq "HALT"} {
emit_log_line ""
emit_log_line "Program halted at PC=$prog_counter."
break
}
incr prog_counter
}
emit_log_line ""
if {$trace_flag_on} {
emit_log_line "--- Final register state ---"
display_regval R0
display_regval R1
display_regval R2
emit_log_line ""
}
emit_log_line "=== Execution Complete: $prog_id_label ===\n"
# Collect the final register snapshot for the wiki audit table
set snapshot_rows {}
foreach reg_name_str {R0 R1 R2} {
set digit_board_ls [dict get $register_file $reg_name_str]
set note_text_str "Final value after $prog_id_label"
lappend snapshot_rows \
[list $reg_name_str $digit_board_ls $note_text_str]
}
gen_wiki_table $prog_id_label $snapshot_rows
}
} ;# end namespace ::CounterMachine
# =============================================================================
# Demo Programs
# =============================================================================
# Program 1: Basic multiplication and addition
#
# Expected step-by-step results:
# After LOAD R0 12345 : R0 = [12345] = 12345
# After LOAD R1 7 : R1 = [00007] = 7
# After MULT R0 7 : R0 = [86415] = 86415 (12345 * 7)
# After ADD R2 R0 : R2 = [86415] = 86415 (0 + 86415)
#
# Final wiki table data rows:
# Row 1 (odd) : R0 = [86415] = 86415
# Row 2 (even) : R1 = [00007] = 7
# Row 3 (odd) : R2 = [86415] = 86415
set prog_instr_one {
{LOAD R0 12345}
{LOAD R1 7}
{DISPLAY R0}
{DISPLAY R1}
{MULT R0 7}
{DISPLAY R0}
{ADD R2 R0}
{DISPLAY R2}
{PRINT "Program 1 finished."}
{HALT}
}
# Program 2: Five-digit overflow and rollover test
#
# Expected step-by-step results:
# After LOAD R0 99999 : R0 = [99999] = 99999
# After LOAD R1 2 : R1 = [00002] = 2
# After MULT R0 2 : R0 = [99998] = 99998 (199998 mod 100000)
# After COPY R2 R0 : R2 = [99998] = 99998
# After ADD R2 R1 : R2 = [00000] = 0 (100000 mod 100000)
#
# Final wiki table data rows:
# Row 1 (odd) : R0 = [99998] = 99998
# Row 2 (even) : R1 = [00002] = 2
# Row 3 (odd) : R2 = [00000] = 0
set prog_instr_two {
{LOAD R0 99999}
{LOAD R1 2}
{MULT R0 2}
{DISPLAY R0}
{COPY R2 R0}
{ADD R2 R1}
{DISPLAY R2}
{HALT}
}
# =============================================================================
# Run both demo programs, then save the full console log to disk
# =============================================================================
puts "Running Program 1:\n"
::CounterMachine::run_prog_exec $prog_instr_one "Program-1" 1
puts "\nRunning Program 2:\n"
::CounterMachine::run_prog_exec $prog_instr_two "Program-2" 1
::CounterMachine::save_log_fileRunning Program 1: ============================================= Counter Machine Programmable Execution Version : V5.0-Programmable Program : Program-1 ============================================= --- Initial register state --- R0 : [00000] = 0 R1 : [00000] = 0 R2 : [00000] = 0 PC=0 LOAD R0 12345 PC=1 LOAD R1 7 PC=2 DISPLAY R0 R0 : [12345] = 12345 PC=3 DISPLAY R1 R1 : [00007] = 7 PC=4 MULT R0 7 PC=5 DISPLAY R0 R0 : [86415] = 86415 PC=6 ADD R2 R0 PC=7 DISPLAY R2 R2 : [86415] = 86415 PC=8 PRINT "Program 1 finished." Program 1 finished. PC=9 HALT Program halted at PC=9. --- Final register state --- R0 : [86415] = 86415 R1 : [00007] = 7 R2 : [86415] = 86415 === Execution Complete: Program-1 === === Wiki Table: Program-1 Final Register State ===
| Index | Register | Digit Board | Integer Value | Quibble-Notes |
|---|---|---|---|---|
| 1 | R0 | 86415 | 86415 | Final value after Program-1 |
| 2 | R1 | 00007 | 7 | Final value after Program-1 |
| 3 | R2 | 86415 | 86415 | Final value after Program-1 |
| Audit Window | Execution verified for Program-1 |
Running Program 2: ============================================= Counter Machine Programmable Execution Version : V5.0-Programmable Program : Program-2 ============================================= --- Initial register state --- R0 : [00000] = 0 R1 : [00000] = 0 R2 : [00000] = 0 PC=0 LOAD R0 99999 PC=1 LOAD R1 2 PC=2 MULT R0 2 PC=3 DISPLAY R0 R0 : [99998] = 99998 PC=4 COPY R2 R0 PC=5 ADD R2 R1 PC=6 DISPLAY R2 R2 : [00000] = 0 PC=7 HALT Program halted at PC=7. --- Final register state --- R0 : [99998] = 99998 R1 : [00002] = 2 R2 : [00000] = 0 === Execution Complete: Program-2 === === Wiki Table: Program-2 Final Register State ===
| Index | Register | Digit Board | Integer Value | Quibble-Notes |
|---|---|---|---|---|
| 1 | R0 | 99998 | 99998 | Final value after Program-2 |
| 2 | R1 | 00002 | 2 | Final value after Program-2 |
| 3 | R2 | 00000 | 0 | Final value after Program-2 |
| Audit Window | Execution verified for Program-2 |
Console output saved to: counter_output.txt
# References. # Inspired by counterfactual principles discussed in Chiara Marletto's book # "The Science of Can and Can't: A Physicist's Journey Through the Land of Counterfactuals" (2021). # No text, quotes, or direct examples from the book are used in this code. # The subroutine(s) implements a generic weighted scoring mechanism that # loosely draws on the high-level principle that possible transformations # can reveal hidden assumptions. # The dummy subroutine implements a generic axiom for educational purposes only. puts "==============================================================" puts "Credits" puts "Reference: Maria Violaris, arXiv:2601.08102v1, January 2026" puts "Reference: https://wiki.tcl-lang.org/page/Snippets+Quantum+Many+Worlds" puts "Based on ref. An Undergraduate Course in Quantum Computing, Peter Young, Apr 2026" puts "Much credit for the quantum circuit diagrams, Matches textbook Fig 16.4 etc" puts "University of California Santa Cruz, CA, arXiv:2604.10396"
gold 2/9/2026. Added categories, so can find message in Wiki.
gold 2/3/2025. Testing, encountered initial difficulty in saving work? Long code blocks with or unmatched wiki markup can sometimes confuse the Tcl Wiki formatting engine, especially if fences are not balanced or a line begins with markup it treats specially.
gold 2/14/2026. Added Automatic Dump of Examples, Using ActiveState.
gold 2/14/2026. convert to strict 7-bit ASCII for Playground V9. reporting error at bottom. program should run to completion with automatic test suite.
gold 2/14/2026.
gold 3/7/2026. convert to strict 7-bit ASCII for Playground V9. variables need to be human readable and very explanatory. avoid variables with single letter names. Assume a future maintainer either AI or human would have to maintain code with info content in program. the program is working the numbers correctly . so minimal changes.
gold 4/19/2026. Forwarding Python version to other venue. The TCL version is posted here.
Matrix of Collatz solutions look like two swarms of bees rather a single linear solution or even look like multiple fuzzy levels of solution ranges, eg. non-linear solutions, observable in various pngs. You can tell me different. Based on long experience of fitting equations in engineering, possibly the probabilistic reasoning or pattern matching on quantum solutions plural is more adaptable.
gold 4/24/2026. Difficult for me to evaluate the Quantum math theories. The Python versions are posted in other venues. The TCL version is posted on wiki.
However, I suppose that the model inference programming using TcL could check the Yada-Yada theory for consistencies with other vouched quantum rules. However, code seems interesting from a hack programming viewpoint.
Essentially describing a Bayesian and weighted token scoring system. The same math LLMs use, just without the giant weight matrices.
evidence_tokens → score each conclusion → normalize → top-N conclusions
Please place any comments here with your wiki MONIKER and date, Thanks.gold 5/10/2026
Note. Testing computer methods and computer programs, maybe wrong numbers.
| Category Numerical Analysis | Category Toys | Category Calculator | Category Mathematics | Category Example | Toys and Games | Category Games | Category Application | Category GUI |