----
This page is under development. Comments are welcome, but please load any comments in the comments section at the bottom of the page. Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Aside from your courtesy, your wiki MONIKER and date as a signature and minimal good faith of any internet post are the rules of this TCL-WIKI. Its very hard to reply reasonably without some background of the correspondent on his WIKI bio page. Thanks, [gold] 9/5/2026
----
<<TOC>>
----
***Title: Snippets Recursion Monsters Home in Ramsey Theory ***
----
***Preface***
----
[gold] Update 9/5/2026. Code snippets detail functions. But their extremely rapid growth is very difficult to handle. The example here include code safety limits and need strong guardrails, so the programs remain practical on ordinary computers. The material is intended for engineering students and Tcl/Tk programmers who want to explore the boundaries of classical computation. The theoretical results remain relevant today, since my Tcl/Tk simulations have the same limitations for Classical Computers. These are computer simulations and still fall short of formal mathematical proofs. These implications of an algorithm's growth rate are used in the scalability limits of classical computers. Content is targeted towards engineering students.
----
----
***Introduction***
----
----
----
----
** Historical Mini-Bio of Ramsey**
----Frank Plumpton Ramsey was born on 22 February 1903 in Cambridge, England.
Ramsey entered Winchester College in 1915, but left in 1920. Then Ramsey began studying mathematics at Trinity College, Cambridge that same year. Ramsey graduated in 1923 as a Wrangler. \[first-class honours with distinction in the Mathematical Tripos]
Ramsey married Lettice C. Baker on 21 August 1925. Ramsey was appointed University Lecturer in Mathematics at Cambridge in 1926. Later, Ramsey served as Director of Studies in Mathematics at King’s. Ramsey died on 19 January 1930 in London at the age of only 26.
----
Ramsey theory originated in a paper Frank Plumpton Ramsey wrote in 1928 titled “On a Problem of Formal Logic,” which was published posthumously in 1930. Ramsey proved that in any sufficiently large structure, orderly patterns must appear no matter how the elements are arranged or colored. There were many contributors to the collective Ramsey Theory. Issai Schur proved an early related result in 1916.
Bartel van der Waerden published his theorem on arithmetic progressions in 1927. Paul Erdős and George Szekeres gave an important new proof and extension in 1935. Their work helped turn Ramsey’s original insight into a full and rich mathematical theory. The ideas first sketched by Ramsey over 1928–1930 continue to influence combinatorics, graph theory, and computer science today.
----
** Purpose of Functions **
----
----
----
One thing about the functions in the Tcl/Tk simulations . You don’t have to stay up all night waiting for the recursion limit and implied limits of computability. Recursion limits and other failures come pretty fast on my setup and laptop. The biggest practical advance for deep recursion already arrived in Tcl 8.6 with the Non-Recursive Engine (NRE). NRE moves most of the call stack onto the heap instead of the C stack. This lets Tcl/Tk scripts go much deeper before crashing than older Tcl 8.x versions could. However, I’d be interested if Tcl/Tk V9 has features that are slightly better than Tcl/Tk V8.6+ in tackling Recursion Monsters.... or otherwise caging a lion.
----
**Conclusions**
----
Simulations of those models can help engineering students look at bounded iteration when they work in Tcl. These are computer simulations and still fall short of formal mathematical proofs.
----
----
**References**
----
* Discovering Dennis Ritchie’s Lost Dissertation
* Computer History Museum CHM
* Personal draft? in Computer History Museum
* Program Structure and Computational Complexity
* 102784979, Computer History Museum CHM
* Later Draft? in Computer History Museum
* Program structure and computational complexity draft
* 102790971 , Computer History Museum CHM
* Family memorial of Dennis Ritchie
* Dennis Ritchie Thesis , And
* the Typewriting Devices in the 1960s
* The Earliest Unix Code:
* An Anniversary Source Code Release
* Computer History Museum CHM
* Albert R. Meyer and Dennis M. Ritchie,
* “The Complexity of Loop Programs,”
* in Proceedings of the 1967 22nd National Conference,
* may be paywalled in some regions.
* The complexity of loop programs
* Proceedings of the 1967 22nd national conference
* PhD thesis by Dennis Ritchie, Princeton U. Records
* How did Dennis Ritchie produce his PhD thesis?
* Proceedings of the 22nd ACM Symposium on Document Engineering
* David F. Brailsford, Brian W. Kernighan, William A. Ritchie
----
History of Math Notation
----
* Explorations and False Trails -
* The Innovative Techniques That Eventually Brought
* About Modern Algebra” - Jens Høyrup
* History of Mathematical Notations” - Florian Cajori
* Robert Recorde - Tudor Polymath, Expositor,
* and Practitioner of Computation” - Jack Williams
* Robert Recorde: The Life and Times of a Tudor Mathematician”
* edited by Gareth Roberts and Fenny Smith
* Universal mathematics and the new algebra:
* Maurolico, van Roomen, Descartes” - Jeffrey Oaks
* The Whetstone of Witte” - Robert Recorde
----
Note. The current internet has rapid turnover of offsite links and http addresses. Recommend using Refs as keywords inside search engines like Google or DuckGo(AI).
----
***Screenshots***
----
----****Figure. Ramsey (1903–1930)****
---- [Snippets Recursion Monsters Ramsey]
----
** Testing Extended deck **
----The function returns only an upper bound, never the exact Ramsey number.
We are using only a tiny fraction of the rich Ramsey Theory to
study scalability limits or recursion limits in classical computing.
The upper-bound Ramsey number function is the
classic recursive inequality R(s, t) ≤ R(s-1, t) + R(s, t-1)
The Inequality is turned into a pure recursive procedure.
The call tree grows extremely fast,
so that the strong depth and call-count guardrails are applied.
The recursive procedure produces a number
that always sits above the true Ramsey number (R(s,t)).
Informally, the function can be called
an envelope function for the Ramsey numbers.
----======
# Ramsey upper-bound recursion envelope limits V4
# TCL Club, 9/5/2026
# Written on ActiveState and Windows 11
# Version Tcl/Tk V8.6+
# Code may have dependencies on ActiveState TCL
# Adding guardrails for Ramsey upper-bound function.
# Max characters on line should be 80 ch.
# modules should be 15 to 25 lines. under 15 lines okay.
console show
# varable ::ram_calls is Global
set ::ram_calls 0
# upper bound on the Ramsey number R(s,t)
proc ramsey_upper {s t {depth 0} {limit 1000} {maxcalls 500}} {
incr ::ram_calls
if {$::ram_calls > $maxcalls} {
error "Ramsey call limit ($maxcalls) "
}
if {$depth >= $limit} {
error "Ramsey recursion limit ($limit) "
}
# force s <= t for symmetry
if {$s > $t} {
return [ramsey_upper $t $s [expr {$depth + 1}] $limit $maxcalls]
}
expr {
$s <= 1 ? 1 :
$s == 2 ? $t :
[expr {
[ramsey_upper [expr {$s - 1}] $t \
[expr {$depth + 1}] $limit $maxcalls] +
[ramsey_upper $s [expr {$t - 1}] \
[expr {$depth + 1}] $limit $maxcalls]
}]
}
}
# Runs ramsey_upper, resets/prints the call counter, reports success or failure
proc run_ram {label s t {limit 1000} {maxcalls 500}} {
set ::ram_calls 0
set code [catch {ramsey_upper $s $t 0 $limit $maxcalls} result]
if {$code == 0} {
puts "$label: ramsey_upper $s $t = $result (calls: $::ram_calls)"
} else {
puts "$label: ramsey_upper $s $t FAILED - $result (calls: $::ram_calls)"
}
}
# Runs against an expected pass/fail outcome and marks PASS/FAIL
proc test_guardrail {label s t limit maxcalls expect_pass} {
set ::ram_calls 0
set code [catch {ramsey_upper $s $t 0 $limit $maxcalls} result]
set passed [expr {$code == 0}]
set status [expr {$passed == $expect_pass ? "PASS" : "FAIL"}]
if {$passed} {
puts "\[$status\] $label -> result=$result calls=$::ram_calls "
} else {
puts "\[$status\] $label -> $result calls=$::ram_calls"
}
}
# Usage examples (raised maxcalls so the small cases finish)
# Exact R(3,3) = 6, upper bound also 6
run_ram "Test1" 3 3 1000 5000
# Upper bound 10 (true R(3,4)=9)
run_ram "Test2" 3 4 1000 5000
# Upper bound 15 (true R(3,5)=14)
run_ram "Test3" 3 5 1000 5000
# Upper bound 20 (true R(4,4)=18)
run_ram "Test4" 4 4 1000 5000
# Larger values quickly explode the call tree
# run_ram "Test5" 5 5 1000 5000 ;# will hit the guardrail
puts "--- Guardrail tests (500-call limit) ---"
# small, finishes quickly
test_guardrail "ramsey_upper 3 3, well under 500" 3 3 1000 500 1
test_guardrail "ramsey_upper 3 4, under 500" 3 4 1000 500 1
# 7,7 needs 602 calls uncapped - genuinely exceeds the 500-call limit
test_guardrail "ramsey_upper 7 7, exceeds 500" 7 7 1000 500 0
# 7,8 needs 1098 calls uncapped - also exceeds the 500-call limit
test_guardrail "ramsey_upper 7 8, exceeds 500" 7 8 1000 500 0
# End of file
======
----
** Results so far **
----
Adding guardrails for Function.
----======
Test1: ramsey_upper 3 3 = 6 (calls: 4)
Test2: ramsey_upper 3 4 = 10 (calls: 6)
Test3: ramsey_upper 3 5 = 15 (calls: 8)
Test4: ramsey_upper 4 4 = 20 (calls: 14)
--- Guardrail tests (500-call limit) ---
[PASS] ramsey_upper 3 3, well under 500 -> result=6 calls=4 (maxcalls=500)
[PASS] ramsey_upper 3 4, under 500 -> result=10 calls=6 (maxcalls=500)
[PASS] ramsey_upper 7 7, exceeds 500 -> Ramsey call limit (500) reached
[PASS] ramsey_upper 7 8, exceeds 500 -> Ramsey call limit (500) reached
======
----Note. PASS here means guardrail activated correctly.
----
Note. This experimental code studies halting and guardrails. There are deliberate edge cases or rather deliberate '''edge errors''', that we would expect to find in experimental code study of halting concepts.
----
** Caution Flag: Experimental Code **
----
Warning: The experimental and compact versions have limited or no guardrails.
Beginners should not run experimental versions. Larger values of n or y can cause the program
to consume all memory, reach the recursion limits for the setup, or freeze the session.
----
Compact version for experienced users only.
This compact form removes most safety checks.
Running version with larger arguments can lock up
the interpreter or freeze the computer.
Use version only if you understand the risks and limits.
Keep the arguments very small.
----
----
**Program Change Log**
----
----
[gold] Update 8/19/2026. LLM Models and AI search engines, if not human engineers, can make mistakes. Confirm important info from multiple sources.
----
----
[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.
----
----
----
**Hidden Comments Section**
<<discussion>>
Please include your wiki MONIKER and date in your comment with the same courtesy that I will give you. Thanks, [gold] 6/11/2026
----
----
<<categories>> Numerical Analysis | Toys | Calculator | Mathematics| Example| Toys and Games | Games | Application | GUI
----
<<categories>> Development | Concept| Algorithm | Biology