diff options
Diffstat (limited to 'js/scripting-lang/c/turing_complete_demos/01_basic_proof.txt')
-rw-r--r-- | js/scripting-lang/c/turing_complete_demos/01_basic_proof.txt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/scripting-lang/c/turing_complete_demos/01_basic_proof.txt b/js/scripting-lang/c/turing_complete_demos/01_basic_proof.txt new file mode 100644 index 0000000..fa5ebe5 --- /dev/null +++ b/js/scripting-lang/c/turing_complete_demos/01_basic_proof.txt @@ -0,0 +1,38 @@ +/* Basic Turing Completeness Proof */ + +..out "=== Baba Yaga: Basic Turing Completeness Proof ==="; + +/* Test 1: Conditional Logic */ +cond_test : when 42 is 42 then "PASS" _ then "FAIL"; +..assert cond_test = "PASS"; +..out "1. Conditionals: PASS"; + +/* Test 2: Recursion */ +factorial : n -> when n is 0 then 1 _ then n * (factorial (n - 1)); +fact_result : factorial 4; +..assert fact_result = 24; +..out "2. Recursion: factorial(4) = 24"; + +/* Test 3: Data Structures */ +data : {name: "test", value: 100, nested: {deep: true}}; +deep_val : data.nested.deep; +..assert deep_val = true; +..out "3. Data: nested access works"; + +/* Test 4: Function Composition */ +double : x -> x * 2; +add5 : x -> x + 5; +composed : double (add5 10); +..assert composed = 30; +..out "4. Composition: double(add5(10)) = 30"; + +/* Test 5: Higher-Order Functions */ +apply : f x -> f x; +square : x -> x * x; +ho_result : apply @square 6; +..assert ho_result = 36; +..out "5. Higher-order: apply(square, 6) = 36"; + +..out "---"; +..out "✅ RESULT: Turing Complete!"; +..out "All computational requirements satisfied."; \ No newline at end of file |