Dataset Viewer
Auto-converted to Parquet Duplicate
filename
large_string
category
large_string
source
large_string
byte_size
int64
line_count
int64
ensures_clauses
large_string
requires_clauses
large_string
effects
large_string
has_refinement_types
bool
has_linear_types
bool
has_effect_handlers
bool
has_capabilities
bool
has_synthesis_holes
bool
typechecks
bool
interpreter_output
large_string
verification_status
large_string
logos_version
large_string
docs/cookbook/01_hello.logos
docs
-- 01_hello.logos — the smallest useful Logos program. -- -- Declares a builtin signature (println), then composes a `main` that -- calls it. The interpreter resolves `println` to its Rust implementation; -- the WASM backend lowers it to a WASI `fd_write` call. Same semantics. -- -- Run: -- logosc run docs/cookbook/0...
497
19
[]
[]
["IO"]
false
false
false
false
false
true
hello from the cookbook 0
verified
1.0.0
docs/cookbook/02_arithmetic.logos
docs
-- 02_arithmetic.logos — pure functions composing. -- -- Pure means: no `effect` clause, no I/O, no Database, no Time. Pure -- functions in Logos are referentially transparent — given the same -- inputs they produce the same output, every time. The compiler relies -- on this for the v0.7.3 optimizer passes (constant fo...
609
20
[]
[]
[]
false
false
false
false
false
true
25
verified
1.0.0
docs/cookbook/03_recursion.logos
docs
-- 03_recursion.logos — recursion with a precondition. -- -- The `requires` clause is a precondition: callers must guarantee the -- predicate holds at the call site, and any call where the predicate -- can't be proved is rejected at compile time (full enforcement lands -- with v0.6 AI synthesis; today the parser stores...
874
25
[]
["n >= 0\n = if n <= 1 then 1 else n * factorial(n - 1)"]
[]
true
false
false
false
false
true
3628800
verified
1.0.0
docs/cookbook/04_records.logos
docs
-- 04_records.logos — named-field product types. -- -- `record` declarations introduce a product type with named fields. -- Every record literal must specify all fields (no defaults, no Option -- shortcuts — explicit construction). Field access uses dotted syntax -- (`p.x`) and is checked structurally by the type check...
1,072
31
[]
["this discipline. Linear types\n-- (TASK-020.07, parked) will later let the compiler reuse storage\n-- in-place when ownership permits.\n--\n-- Run:\n-- logosc run docs/cookbook/04_records.logos\n-- Expected output:\n-- 169"]
[]
false
false
false
false
false
true
169
verified
1.0.0
docs/cookbook/05_sum_types.logos
docs
-- 05_sum_types.logos — sum types and exhaustive pattern matching. -- -- Sum types (also called tagged unions, discriminated unions, algebraic -- data types) are how Logos models "this value is one of N shapes, -- each carrying its own payload." There is no `null` in Logos. To -- represent "maybe an Int," declare an `I...
1,348
38
[]
[]
[]
false
false
false
false
false
true
142
verified
1.0.0
docs/cookbook/06_contracts.logos
docs
-- 06_contracts.logos — the proof-carrying surface. -- -- `requires` is a precondition the caller must satisfy. -- `ensures` is a postcondition the function guarantees about `result`. -- Together they form the function's external contract — the spec the -- compiler-as-AI will eventually prove the body against (v0.6 AI ...
1,652
42
["-- result >= 0` then return `-x` for negative input and you've lied;\n-- once the prover ships, that lie becomes a compile error.\n--\n-- Run:\n-- logosc run docs/cookbook/06_contracts.logos\n-- Expected output:\n-- 157\n\n-- abs: any Int input -> a non-negative result. The ensures clause is\n-- the entire spec; ...
["lo <= hi"]
[]
false
false
false
false
false
true
157
verified
1.0.0
docs/cookbook/07_mutual_recursion.logos
docs
-- 07_mutual_recursion.logos — two functions defined in terms of each other. -- -- Logos handles forward references at the module level — function order -- doesn't matter. `is_even` calls `is_odd` which calls `is_even`, and -- the compiler resolves both names against the module's function table -- before any body is ty...
1,802
51
[]
["n >= 0\n = if n == 0 then true else is_odd(n - 1)", "n >= 0\n = if n == 0 then false else is_even(n - 1)"]
[]
false
false
true
false
false
true
8
verified
1.0.0
docs/cookbook/08_cross_system.logos
docs
-- 08_cross_system.logos — Logos × Zyrn bridge, the showcase recipe. -- -- The point of the seven recipes before this one: every primitive you -- needed to write a real cross-system program is in the language today. -- println for output, sum types for representing outcomes, records for -- data, contracts to specify be...
2,403
55
[]
[]
["Database", "IO", "set"]
false
false
false
false
false
true
logos -> zyrn cookbook recipe appended fact, retrieving by type... [ { "id": "cccccccc-cccc-cccc-cccc-cccccccccccc", "fact_type": "recipe", "schema_version": 1, "fields": { "name": "cookbook_demo", "version": "v1" }, "source_hash": "sha256:cookbook", "source_path": "docs/cookbo...
verified
1.0.0
docs/cookbook/09_native.logos
docs
-- Recipe 09 — native compilation through Cranelift. -- -- Same Logos surface, different backend. Where `logosc run` walks the -- AST and `logosc build --target wasm32` emits WebAssembly, -- `logosc-native build` emits Cranelift-lowered code that can ship -- as either an object file (link with the system C compiler) or...
1,226
37
[]
[]
[]
false
false
false
false
false
true
100
verified
1.0.0
docs/cookbook/10_mcp.logos
docs
-- Recipe 10 — the MCP bridge with linear capability discipline. -- -- A Logos program that opens an MCP (Model Context Protocol) connection -- to a server and immediately closes it. The smallest possible -- cross-system program using the bridge crate shipped at -- TASK-MCP.01–.12 plus the interpreter registration hook...
2,819
76
[]
[]
["Network"]
true
true
false
true
false
true
null
verified
1.0.0
docs/cookbook/11_stdlib.logos
docs
-- Recipe 11 — composing the stdlib pure trivials. -- -- The stdlib in v0.x is signature-first: `stdlib/math.logos`, -- `stdlib/option.logos`, etc. declare contracts and (for the pure -- trivial subset) ship bodies. Until module imports land in v0.0.9, -- a program that wants to USE a stdlib function defines the same -...
2,552
87
["result >= 0\n = if x < 0 then -x else x", "result >= lo && result <= hi\n = if x < lo then lo else if x > hi then hi else x"]
["lo <= hi", "b != 0\n = a - (a / b) * b", "exp >= 0\n = if exp == 0 then 1"]
[]
false
false
false
false
false
true
42
verified
1.0.0
docs/cookbook/12_filesystem.logos
docs
-- Recipe 12 — filesystem operations end-to-end. -- -- The seven fs builtins shipped at `08ed51b` make Logos programs -- first-class participants in filesystem workflows. This recipe -- composes all of them into a single round-trip: create a directory, -- write a file, append to it, inspect its size + kind, read it bac...
2,705
88
["result == 0", "result == 0", "result == 0", "result >= 0", "result == 0"]
[]
["File", "is"]
false
false
false
false
false
true
11
verified
1.0.0
docs/cookbook/13_random.logos
docs
-- Recipe 13 — ambient RNG end-to-end. -- -- The three `random.logos` ambient-RNG builtins shipped at v0.8.12 -- (`ce7f08b`) make Logos programs first-class participants in -- non-deterministic workflows: Monte Carlo sampling, coin-flip -- simulations, randomized testing, gameplay outcomes, etc. -- -- This recipe compo...
2,773
77
["result >= low && result < high"]
["low < high", "low < high\n = if samples <= 0 then true"]
["Random"]
false
false
false
false
false
true
1
verified
1.0.0
docs/cookbook/14_vision.logos
docs
-- Recipe 14 — vision pipeline with YOLO + verification + Zyrn supersession. -- -- The canonical pattern for production computer-vision workflows on -- the Logos stack: cheap detector first pass, expensive verifier -- second pass for important detections, every result stored as a -- Zyrn fact with full provenance. -- -...
8,734
220
[]
[]
["IO", "Network"]
false
true
false
true
false
true
null
verified
1.0.0
docs/cookbook/15_synthesis.logos
docs
-- Recipe 15 — v0.6 AI synthesis: `??` holes filled by a verified -- LLM completion pass. -- -- The smallest end-to-end demonstration of the Logos synthesis -- surface. A function body left as `??` is filled by the -- `logosc-synth` daemon at compile time. The daemon proposes a -- completion; the compiler typechecks th...
4,881
113
[]
[]
["IO"]
false
false
false
false
true
false
null
typecheck_failed
1.0.0
docs/cookbook/16_http.logos
docs
-- Recipe 16 — HTTP client end-to-end through `logosc-http`. -- -- The canonical "validate → probe → branch" pattern for HTTP -- workflows on the Logos stack. Demonstrates the full -- `stdlib/http.logos` surface that landed at HTTP.02 + HTTP.05: -- -- - URL helpers (pure) — `url_is_valid` + `url_host` -- - N...
4,440
118
["result >= 100 && result < 600\n\n-- =============================================================================\n-- Pure status-class predicate (also lives in `stdlib/http.logos`)\n-- =============================================================================\n--\n-- Redeclared with its body so the recipe doesn't...
[]
["IO", "Network", "layer"]
false
false
false
false
false
true
null
verified
1.0.0
docs/cookbook/17_package_manager.logos
docs
-- Recipe 17 — Using the v0.5 package manager. -- -- The cookbook entry for `logosc-pkg`: how to declare, vendor, -- inspect, and verify dependencies in a Logos project. Unlike -- recipes 1–16 which exercise runtime stdlib surfaces, this -- recipe documents a CLI workflow with comment-block exposition -- and a single r...
4,072
104
[]
[]
["IO"]
false
false
false
false
false
true
logosc-pkg v0.5.0: see docs/PACKAGE_MANAGER.md for the full guide commands: init / add / update / lock / list / remove / sync 0
verified
1.0.0
docs/cookbook/18_closures.logos
docs
-- Recipe 18 — Closures end-to-end (CLOSURE.05–.08). -- -- The canonical "first-class function values" recipe. Demonstrates -- the full closures lane that landed across CLOSURE.05 (native -- direct), CLOSURE.06 (WASM direct), CLOSURE.07 (boxed escaping), -- and CLOSURE.08 (true WASM function-table ABI). -- -- The four ...
3,306
86
[]
[]
[]
false
false
true
false
false
true
60
verified
1.0.0
docs/cookbook/19_package_manager_workflow.logos
docs
-- Recipe 19 — Package manager workflow with a real sibling dep. -- -- This file is a one-line redirect to the actual recipe project at -- `docs/cookbook/recipe_19/host/main.logos`. Recipe 19 is the only -- cookbook recipe that needs a multi-file layout because it -- exercises the v0.5 package manager's vendored-module...
2,052
56
[]
[]
[]
true
false
false
false
false
true
0
verified
1.0.0
docs/cookbook/20_linear_types.logos
docs
-- Recipe 20 — Linear types end-to-end (TASK-020.07, shipped). -- -- Logos enforces "use-exactly-once" semantics via the `linear` -- keyword. A `linear` type binding cannot be silently dropped, -- cannot be used twice, and must end up consumed before its -- enclosing scope ends. The typechecker enforces this at compile...
2,557
72
[]
[]
[]
true
true
true
false
false
true
42
verified
1.0.0
docs/cookbook/21_effect_handlers.logos
docs
-- Recipe 21 — Effect handlers end-to-end (TASK-020.06, shipped). -- -- Effect handlers let a program dynamically intercept an effect at -- a specific scope, replacing the default builtin implementation -- with a handler function the program provides. The classic use: -- substitute a side-effecting call with a determin...
2,240
68
[]
[]
["IO", "at", "typing", "wins"]
false
false
true
false
false
true
42
verified
1.0.0
docs/cookbook/22_capabilities.logos
docs
-- Recipe 22 — Capability-based access control (CAP.01 typecheck rules). -- -- Capabilities close the "ambient authority" attack class from -- MANIFESTO §7. A `capability` declaration introduces an opaque -- type whose values are unforgeable — user code cannot construct -- them via literal syntax, and cannot declare th...
4,469
106
[]
[]
["Cap", "IO", "that"]
true
false
true
true
false
true
100
verified
1.0.0
docs/cookbook/23_capabilities_full.logos
docs
-- Recipe 23 — Capabilities end-to-end (CAP.02 privileged-builtin registry). -- -- CAP.02 shipped 2026-05-21. All six capability rules from -- `docs/CAPABILITIES.md` are now enforced. This recipe demonstrates -- the full pattern recipe 22 promised: a privileged builtin produces -- a capability value, user code threads ...
3,066
77
[]
[]
["Cap"]
false
false
false
true
false
true
1024
verified
1.0.0
docs/cookbook/24_refinement_verified.logos
docs
-- Recipe 24 — Refinement contracts lowered to SMT-LIB at compile time. -- -- HONEST STATUS (2026-05-22): v1.0 shipped the FULL lowering -- pipeline: `requires`/`ensures` clauses get compiled to SMT-LIB -- (`compiler/src/smt.rs`) and shipped to the `logosc-synth` -- daemon over the `prove` IPC protocol. The Z3 binding ...
2,751
71
["clause can't be proved. Today, the clause is tracked +\n-- lowered + sent to the daemon; the daemon returns \"not bound\";\n-- the compiler accepts the program as before. The contract still\n-- documents intent + structures the type-system surface.\n--\n-- # The shape that demonstrates verification\n--\n-- A function...
["a + b <= 1000"]
[]
true
false
true
false
false
true
42
verified
1.0.0
docs/cookbook/25_multi_feature.logos
docs
-- Recipe 25 — Multi-feature composition: linear types + capabilities + -- refinement contracts + effect inference in one program. -- -- The v1.0 type system was designed for composition. Linear types -- track resource ownership across boundaries. Capabilities prevent -- ambient authority. Refinement contra...
3,054
80
["\u2014 Z3-verified at compile time\n-- - effect Cap is inferred via the close_file call", "result <= requested\n = requested\n\n-- main demonstrates that ALL FOUR substrate features compose at\n-- the type level. The runtime call to open_file is parked for\n-- the v1.x privileged-builtin registry integration; the ...
["+ ensures \u2014 Z3-verified at compile time\n-- - effect Cap is inferred via the close_file call", "requested > 0", "+ ensures discharged at\n-- compile time\n--\n-- That orthogonal composition is what makes Logos v1.0 a real\n-- systems language. Returns 500."]
["Cap", "inference"]
true
true
false
true
false
true
500
verified
1.0.0
examples/account.logos
examples
-- v0.0.8: bank-account records and field access. record Account { id: Int, customer_id: Int, balance: Int, status: String } open_account(id: Int, customer_id: Int) -> Account = Account { id: id, customer_id: customer_id, balance: 0, status: "open" } account_balance(account: Account) -> Int = account.balan...
788
33
[]
["amount > 0\n = Account {"]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/algorithms/binary_search.logos
examples
-- binary_search.logos - sorted-list binary search corpus example. -- -- Teaches indexed search over a sorted recursive list, a requires contract -- over the sortedness invariant, and deterministic backend-oracle output. type IntList = | Nil | Cons(Int, IntList) list_length(xs: IntList) -> Int ensures result >=...
2,014
67
["result >= 0\n = match xs with\n | Nil => 0\n | Cons(h, t) => 1 + list_length(t)", "result >= -1\n = if lo > hi then -1", "result >= -1\n = binary_search_range(xs, needle, 0, list_length(xs) - 1)"]
["contract\n-- over the sortedness invariant, and deterministic backend-oracle output.", "index >= 0\n = match xs with\n | Nil => default\n | Cons(h, t) =>", "lo >= 0 && hi >= -1", "is_sorted(xs)"]
[]
false
false
false
false
false
true
5090
verified
1.0.0
examples/algorithms/boyer_moore.logos
examples
-- boyer_moore.logos - bad-character string match corpus. -- TASK-CORPUS.A17 -- -- Characters are encoded as integers: A = 1, B = 2, C = 3. The fixed text -- ABABABA contains the pattern ABA at offsets 0, 2, and 4. The search trace -- checks Boyer-Moore's right-to-left comparisons and bad-character shift rule. last_in...
1,408
61
["result >= -1 && result <= 2\n = if ch == 1", "result >= 1\n = if last_index(ch) < mismatch_index", "result == 1\n = bad_character_shift(2, 2)", "result == 3\n = bad_character_shift(3, 2)", "result == 3\n = if window0_match() && window2_match() && window4_match()", "result == 0\n = 0", "result == 4\n = 4", "res...
[]
[]
false
false
false
false
false
true
304
verified
1.0.0
examples/algorithms/convex_hull.logos
examples
-- convex_hull.logos - Graham-scan orientation corpus. -- TASK-CORPUS.A15 -- -- The scan is represented as a deterministic trace over a fixed sorted point -- set. Orientation contracts capture the invariant that clockwise middle -- points are popped while left turns are retained on the hull. cross(ax: Int, ay: Int, bx...
1,414
49
["result == (bx - ax) * (cy - ay) - (by - ay) * (cx - ax)\n = (bx - ax) * (cy - ay) - (by - ay) * (cx - ax)", "result == 8\n = cross(0, 0, 2, 0, 2, 2) + cross(0, 0, 2, 2, 0, 2)"]
[]
[]
false
true
false
false
false
true
12408
verified
1.0.0
examples/algorithms/dijkstra.logos
examples
-- dijkstra.logos - fixed-graph shortest-path corpus example. -- -- Teaches graph adjacency as recursive lists, finite distance tables encoded -- as Int pairs, min-distance node selection, edge relaxation, and backend -- oracle execution through a deterministic checksum. type IntList = | Nil | Cons(Int, IntList) ...
5,034
139
["result >= 0\n = match distances with\n | Nil => inf()\n | Cons(pair, rest) =>", "distance_to(source, result) == 0\n = dijkstra_loop(all_nodes(), initial_distances(source))"]
["distance >= 0\n = match distances with\n | Nil => Cons(encode_pair(node, distance), Nil)\n | Cons(pair, rest) =>"]
[]
false
false
false
false
false
true
287
verified
1.0.0
examples/algorithms/edit_distance.logos
examples
-- edit_distance.logos - Levenshtein edit-distance corpus example. -- TASK-CORPUS.A12 -- -- Sequences are immutable integer lists. The recurrence allows insertion, -- deletion, and substitution, producing deterministic oracle values without -- arrays or mutation. type IntList = | Nil | Cons(Int, IntList) min_int(...
1,898
69
["result >= 0\n = match xs with\n | Nil => 0\n | Cons(_, rest) => 1 + length(rest)", "result >= 0 && result <= max_int(length(a), length(b))\n = match a with\n | Nil => length(b)\n | Cons(ah, at) =>"]
[]
[]
false
false
false
false
false
true
2240
verified
1.0.0
examples/algorithms/fft.logos
examples
-- fft.logos - fixed-size integer FFT corpus. -- TASK-CORPUS.A14 -- -- Logos does not need floating point to exercise the FFT invariant. A 4-point -- transform only needs the integer twiddle factors 1, -i, -1, and i. fft_y0_re(x0r: Int, x0i: Int, x1r: Int, x1i: Int, x2r: Int, x2i: Int, x3r: Int, x3i: Int) -> Int ens...
2,318
61
["result == x0r + x1r + x2r + x3r\n = x0r + x1r + x2r + x3r", "result == x0i + x1i + x2i + x3i\n = x0i + x1i + x2i + x3i", "result == x0r - x2r + x1i - x3i\n = x0r - x2r + x1i - x3i", "result == x0i - x2i - x1r + x3r\n = x0i - x2i - x1r + x3r", "result == x0r - x1r + x2r - x3r\n = x0r - x1r + x2r - x3r", "result =...
[]
[]
false
false
false
false
false
true
19516
verified
1.0.0
examples/algorithms/graph_traversal.logos
examples
-- graph_traversal.logos - BFS and DFS traversal corpus example. -- -- Teaches directed graph traversal with recursive frontier lists, visited-set -- membership checks, queue-style BFS expansion, DFS expansion, and backend -- oracle execution through a deterministic reachability checksum. type IntList = | Nil | Co...
2,165
76
["result >= 0\n = match xs with\n | Nil => 0\n | Cons(h, t) => 1 + count(t)", "contains(result, start)\n = bfs_loop(Cons(start, Nil), Nil)", "contains(result, start)\n = dfs_visit(start, Nil)"]
[]
[]
false
false
false
false
false
true
667
verified
1.0.0
examples/algorithms/heapsort.logos
examples
-- heapsort.logos - heap-backed recursive-list heapsort corpus example. -- -- Teaches a max-heap encoded as a recursive sum type, heap-order predicates, -- heap merge/insert/drain helpers, and backend-oracle execution through a -- deterministic checksum. type IntList = | Nil | Cons(Int, IntList) type IntHeap = ...
2,605
94
["is_max_heap(result)\n = match a with\n | Empty => b\n | Node(av, al, ar) =>", "is_max_heap(result)\n = heap_merge(Node(value, Empty, Empty), heap)", "is_max_heap(result)\n = match xs with\n | Nil => Empty\n | Cons(h, t) => heap_insert(h, build_heap(t))", "is_sorted(result)\n = reverse(drain_de...
["is_max_heap(heap)\n = match heap with\n | Empty => Nil\n | Node(value, left, right) => Cons(value, drain_desc(heap_merge(left, right)))", "pos > 0\n = match xs with\n | Nil => acc\n | Cons(h, t) => checksum(t, pos + 1, acc + h * pos)"]
[]
false
false
false
false
false
true
187
verified
1.0.0
examples/algorithms/insertion_sort.logos
examples
-- insertion_sort.logos - recursive-list insertion sort corpus example. -- -- Teaches ordered insertion, duplicate preservation, sortedness contracts, -- and backend-oracle execution through a deterministic checksum. type IntList = | Nil | Cons(Int, IntList) is_sorted_from(prev: Int, xs: IntList) -> Bool = matc...
1,328
48
["is_sorted(result)\n = match xs with\n | Nil => Cons(value, Nil)\n | Cons(h, t) =>", "is_sorted(result)\n = match xs with\n | Nil => Nil\n | Cons(h, t) => insert_sorted(h, insertion_sort(t))"]
["is_sorted(xs)", "pos > 0\n = match xs with\n | Nil => acc\n | Cons(h, t) => checksum(t, pos + 1, acc + h * pos)"]
[]
false
false
false
false
false
true
173
verified
1.0.0
examples/algorithms/knapsack.logos
examples
-- knapsack.logos - 0/1 knapsack dynamic-programming corpus example. -- -- Items are encoded as weight * 100 + value. The recurrence chooses the -- better of skipping or taking each item, producing deterministic oracle -- values across several capacities. type IntList = | Nil | Cons(Int, IntList) item_weight(item...
1,595
59
["result >= 0\n = match items with\n | Nil => 0\n | Cons(item, rest) =>"]
["weight >= 0 && value >= 0\n = weight * 100 + value", "capacity >= 0"]
[]
false
false
false
false
false
true
10237
verified
1.0.0
examples/algorithms/knuth_morris_pratt.logos
examples
-- knuth_morris_pratt.logos - prefix-table string match corpus. -- TASK-CORPUS.A16 -- -- Characters are encoded as integers: A = 1, B = 2. The fixed text ABABA -- contains the pattern ABA at offsets 0 and 2. pattern_prefix_last() -> Int ensures result == 1 = 1 kmp_next(state: Int, ch: Int) -> Int ensures result...
1,224
56
["result == 1\n = 1", "result >= 0 && result <= 3\n = if state == 0", "result == 2\n = if state_after_2() == 3 && state_after_4() == 3", "result == 0\n = 0", "result == 2\n = 2", "result == 202\n = match_count() * 100 + first_match_index() * 10 + second_match_index()"]
[]
[]
false
false
false
false
false
true
202
verified
1.0.0
examples/algorithms/longest_common_subsequence.logos
examples
-- longest_common_subsequence.logos - LCS training-corpus example. -- TASK-CORPUS.A11 -- -- Teaches recursive dynamic programming over immutable lists. The oracle uses -- small fixed sequences so interpreter, native, and WASM backends can agree on -- the same deterministic checksum. type IntList = | Nil | Cons(Int...
1,715
62
["result >= 0\n = match xs with\n | Nil => 0\n | Cons(_, rest) => 1 + length(rest)", "result >= 0 && result <= min_int(length(a), length(b))\n = match a with\n | Nil => 0\n | Cons(ah, at) =>"]
[]
[]
false
false
false
false
false
true
503
verified
1.0.0
examples/algorithms/longest_increasing_subsequence.logos
examples
-- longest_increasing_subsequence.logos - dynamic-programming LIS corpus. -- TASK-CORPUS.A18 -- -- The fixed sequence is [3, 1, 2, 5, 4]. Scalar DP cells model the best -- increasing subsequence ending at each index, with oracle checks for the -- length-three subsequences [1, 2, 5] and [1, 2, 4]. best_ending_0() -> In...
1,257
56
["result == 1\n = 1", "result == 1\n = 1", "result == 2\n = if 1 < 2", "result == 3\n = if 2 < 5", "result == 3\n = if 2 < 4", "result == 3\n = if best_ending_3() >= best_ending_4()", "result == 333\n = lis_length() * 100 + best_ending_3() * 10 + best_ending_4()"]
[]
[]
false
false
false
false
false
true
333
verified
1.0.0
examples/algorithms/matrix_multiplication.logos
examples
-- matrix_multiplication.logos - fixed-shape matrix multiplication corpus. -- TASK-CORPUS.A13 -- -- Logos does not need mutable arrays for the core invariant. This keeps the -- 2x2 cells explicit so every backend can exercise the same pure arithmetic -- without relying on wide record returns. multiply_a11(a11: Int, a1...
1,994
57
["result == a11 * b11 + a12 * b21\n = a11 * b11 + a12 * b21", "result == a11 * b12 + a12 * b22\n = a11 * b12 + a12 * b22", "result == a21 * b11 + a22 * b21\n = a21 * b11 + a22 * b21", "result == a21 * b12 + a22 * b22\n = a21 * b12 + a22 * b22"]
[]
[]
false
false
false
false
false
true
9406
verified
1.0.0
examples/algorithms/maximum_subarray.logos
examples
-- maximum_subarray.logos - Kadane maximum-subarray corpus. -- TASK-CORPUS.A19 -- -- The fixed sequence is [-2, 1, -3, 4, -1, 2, 1, -5, 4]. Scalar Kadane -- cells track the best sum ending at each index. The oracle subarray is -- [4, -1, 2, 1], with max sum 6 from indices 3 through 6. max_int(a: Int, b: Int) -> Int = ...
1,444
67
["result == -2\n = -2", "result == 1\n = max_int(1, best_end_0() + 1)", "result == -2\n = max_int(-3, best_end_1() + -3)", "result == 4\n = max_int(4, best_end_2() + 4)", "result == 3\n = max_int(-1, best_end_3() + -1)", "result == 5\n = max_int(2, best_end_4() + 2)", "result == 6\n = max_int(1, best_end_5() + 1...
[]
[]
false
false
false
false
false
true
636
verified
1.0.0
examples/algorithms/mergesort.logos
examples
-- mergesort.logos — stable recursive-list mergesort corpus example. -- -- Items are encoded as key * 100 + original_id. Sorting compares by key first -- and original_id second, so equal-key items keep their source order. type IntList = | Nil | Cons(Int, IntList) item_key(item: Int) -> Int = item / 100 item_id(i...
2,097
74
["is_stably_sorted(result)\n = match left with\n | Nil => right\n | Cons(lh, lt) =>", "is_stably_sorted(result)\n = if is_short(xs) then xs"]
["pos > 0\n = match xs with\n | Nil => acc\n | Cons(h, t) => checksum(t, pos + 1, acc + h * pos)"]
[]
false
false
false
false
false
true
6406
verified
1.0.0
examples/algorithms/n_queens.logos
examples
-- n_queens.logos - fixed 4-queens backtracking corpus. -- TASK-CORPUS.A20 -- -- The oracle solution places queens by row at columns [1, 3, 0, 2]. -- Pairwise safety predicates model the backtracking acceptance checks: -- no shared columns and no shared diagonals. abs_int(x: Int) -> Int = if x < 0 then 0 - x else x ...
1,326
64
["result == 1\n = 1", "result == 3\n = 3", "result == 0\n = 0", "result == 2\n = 2", "result == 1302\n = q0_col() * 1000 + q1_col() * 100 + q2_col() * 10 + q3_col()"]
[]
[]
false
false
false
false
false
true
1302
verified
1.0.0
examples/algorithms/quickselect.logos
examples
-- quickselect.logos - k-th smallest selection corpus. -- TASK-CORPUS.A21 -- -- The fixed input is [7, 10, 4, 3, 20, 15]. Selecting rank 3 -- (one-based) uses pivot 7: two values are less than the pivot and one -- equals it, so the selected value is 7. pivot() -> Int ensures result == 7 = 7 less_than_pivot_count(...
1,134
49
["result == 7\n = 7", "result == 2\n = 2", "result == 1\n = 1", "result == 3\n = 3", "result == 3\n = 3", "result == 7\n = if rank_inside_pivot_band()", "result == 327\n = target_rank() * 100 + less_than_pivot_count() * 10 + kth_smallest()"]
[]
[]
false
false
false
false
false
true
327
verified
1.0.0
examples/algorithms/quicksort.logos
examples
-- quicksort.logos — canonical recursive-list quicksort corpus example. -- -- Teaches recursive sum types, partitioning, append, contracts over helper -- predicates, and backend-oracle execution through a deterministic checksum. type IntList = | Nil | Cons(Int, IntList) append(a: IntList, b: IntList) -> IntList =...
2,065
73
["all_less_or_equal(result, pivot)\n = match xs with\n | Nil => Nil\n | Cons(h, t) =>", "all_greater(result, pivot)\n = match xs with\n | Nil => Nil\n | Cons(h, t) =>", "is_sorted(result)\n = match xs with\n | Nil => Nil\n | Cons(pivot, rest) =>"]
["pos > 0\n = match xs with\n | Nil => acc\n | Cons(h, t) => checksum(t, pos + 1, acc + h * pos)"]
[]
false
false
false
false
false
true
177
verified
1.0.0
examples/algorithms/topological_sort.logos
examples
-- topological_sort.logos - DAG topological ordering corpus example. -- -- Teaches Kahn-style selection over recursive node lists, edge-order -- validation, and backend-oracle execution through a deterministic checksum. type IntList = | Nil | Cons(Int, IntList) append(a: IntList, b: IntList) -> IntList = match ...
2,577
88
[]
["pos >= 0\n = match xs with\n | Nil => -1\n | Cons(h, t) => if h == value then pos else index_of(t, value, pos + 1)", "pos > 0\n = match order with\n | Nil => acc\n | Cons(h, t) => checksum(t, pos + 1, acc + h * pos)"]
[]
false
false
false
false
false
true
77
verified
1.0.0
examples/algorithms/union_find.logos
examples
-- union_find.logos - disjoint-set / union-find corpus example. -- -- Teaches parent-table updates over recursive lists, root finding, union, -- connectivity predicates, and backend-oracle execution through a deterministic -- component checksum. type IntList = | Nil | Cons(Int, IntList) encode_parent(node: Int, p...
2,587
83
["result >= 0\n = let parent = parent_of(node, parents) in"]
[]
[]
false
false
false
false
false
true
30
verified
1.0.0
examples/arith.logos
examples
-- Arithmetic primitives, now with bodies. -- Contract-bearing versions live in contracts.logos. add(a: Int, b: Int) -> Int = a + b sub(a: Int, b: Int) -> Int = a - b mul(a: Int, b: Int) -> Int = a * b div(a: Int, b: Int) -> Int = a / b negate(x: Int) -> Int = -x double(x: Int) -> Int = x * 2 quadruple(x: Int) -> In...
399
15
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/axon_ekko_gateway.logos
examples
-- Axon-Ekko gateway policy kernel in Logos. -- -- This is the production-proof slice for TASK-080.28: the C gateway still owns -- sockets, TLS, libpq, and byte streaming, but the route/auth/rate/local-vs-proxy -- decision core is expressed as Logos and runs through the native backend. -- -- Encodings mirror the live g...
3,642
140
[]
["n >= 0\n = if n <= 0"]
["File", "IO"]
false
false
false
false
false
true
{"tenant":7,"route":"local-db","status":200} 12584
verified
1.0.0
examples/contracts.logos
examples
-- v0.0.5: proof-carrying functions. -- -- Every function carries its contract: `requires` for preconditions, -- `ensures` for postconditions. The `result` keyword refers to the -- return value. -- -- In v0.0.5 these are parsed and round-tripped through `logosc fmt`, -- but not yet verified by the proof engine. v0.6 in...
1,625
48
["result >= 0\n = if x < 0 then -x else x\n\n-- A function with both pre- and postconditions.", "result == a + b && result >= a && result >= b\n = a + b\n\n-- The classic bank transfer \u2014 money conservation as a contract.", "result == amount\n = amount\n\n-- Square root: requires non-negative input, ensures non-...
["non-negative input.", "a >= 0 && b >= 0", "from != to && amount > 0 && amount <= 1000000", "non-negative input, ensures non-negative output.", "x >= 0", "lo <= hi"]
["Database"]
false
false
false
false
false
true
null
verified
1.0.0
examples/control_flow.logos
examples
-- v0.0.3: control flow — let bindings, if/else, comparisons, booleans. -- All of these compile, type-check, and round-trip through `logosc fmt`. is_positive(x: Int) -> Bool = x > 0 is_in_range(x: Int) -> Bool = x >= 0 && x <= 100 is_even(x: Int) -> Bool = x / 2 * 2 == x max(a: Int, b: Int) -> Int = if a > b then a...
807
32
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/effects.logos
examples
-- v0.0.4: effect declarations. -- -- Every function declares its effects in the type. Pure functions have -- no effect clause. A function calling an effectful function must -- declare at least the same set of effects (enforced by the type -- checker in v0.2 — for now this is syntactic scaffolding). -- Pure functions:...
836
31
[]
[]
["IO", "clause", "declarations"]
false
false
true
false
false
true
null
verified
1.0.0
examples/generic_max.logos
examples
module examples.generic_max pub max_value<T where Ordered>(a: T, b: T) -> T = if a > b then a else b pub identity<T>(value: T) -> T = value pub first_or<T>(items: List<T>, fallback: T) -> T = fallback
206
9
[]
[]
[]
true
false
false
false
false
true
null
verified
1.0.0
examples/generic_runtime.logos
examples
-- Generic runtime constructors: Option<T>, List<T>, and Result<T, E>. -- -- This example exercises the post-v1.0 generic migration core: source-level -- generic sum types with monomorphic instantiations that run under the -- interpreter, binary WASM, and Cranelift native backends. type Option<T> = | Some(T) | Non...
1,051
41
[]
[]
[]
false
false
false
false
false
true
43
verified
1.0.0
examples/hello.logos
examples
-- The first program ever written in Logos. -- v0.0.2: function bodies as single expressions. greeting() -> String = "hello, logos" answer() -> Int = 42 main() -> Int = answer()
181
9
[]
[]
[]
false
false
false
false
false
true
42
verified
1.0.0
examples/lib_demo/customer.logos
examples
module customer pub record Customer { id: Int, phone: String, active: Bool } pub new_customer(id: Int, phone: String) -> Customer = Customer { id: id, phone: phone, active: true } pub customer_id(customer: Customer) -> Int = customer.id
248
13
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/lib_demo/main.logos
examples
module main import money from customer import Customer from customer import new_customer as make_customer from customer import customer_id pub cash_sale(customer_number: Int, phone: String, amount: Int) -> Money = let customer = make_customer(customer_number, phone) in let paid = Money { fils: amount, currency: "...
389
12
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/lib_demo/money.logos
examples
module money pub record Money { fils: Int, currency: String } pub zero_money() -> Money = Money { fils: 0, currency: "AED" } pub add_money(a: Money, b: Money) -> Money = Money { fils: a.fils + b.fils, currency: a.currency }
235
13
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/refined_money.logos
examples
module examples.refined_money type Money = Int where value >= 0 type Percent = Int where value >= 0 && value <= 100 pub deposit(amount: Int where value > 0) -> Money = amount pub withdraw(balance: Money, amount: Int where value > 0 && value <= balance) -> Money = balance - amount pub discount_rate(percent: Percen...
344
12
[]
[]
[]
true
false
false
false
false
true
null
verified
1.0.0
examples/runnable.logos
examples
-- runnable.logos — the first Logos program designed to actually execute. -- -- Runs via the tree-walking interpreter: -- ./compiler/target/release/logosc run examples/runnable.logos -- -- Demonstrates real end-to-end execution: parsing, type-checking, and -- evaluation, all through the same compiler binary. This is ...
1,353
47
["result >= 0\n = if x < 0 then -x else x\n\n-- A small recursive function \u2014 factorial, classic."]
["n >= 0\n = if n <= 1 then 1 else n * factorial(n - 1)\n\n-- Use a sum type and pattern matching at runtime."]
[]
false
false
false
false
false
true
193
verified
1.0.0
examples/sequential.logos
examples
-- v0.0.6: sequential expressions with `do` and readable integer separators. -- -- `do` evaluates expressions in order and returns the final expression. -- Integer separators are accepted anywhere between digits. -- -- All called functions are declared as signatures here so the v0.2 type -- checker can verify effect su...
1,291
43
["result == total\n = do validate_cash(total), audit_cash_close(total), total", "result == amount\n = do load_customer(customer_id), record_cash(customer_id, amount), amount"]
["total >= 0 && total <= 1_000_000", "customer_id > 0 && amount > 0 && amount <= 250_000"]
["Audit", "Database", "subsumption"]
false
false
true
false
false
true
null
verified
1.0.0
examples/sum_types.logos
examples
-- v0.0.7: sum types and match expressions. -- -- Constructors are declared by top-level `type` declarations. `match` -- branches destructure constructor payloads and return an expression. type Payment = | Cash(Int) | Card(String) | Credit(Int) | Rejected(String) type AuthResult = | Authenticated(Int) | D...
1,068
41
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/user.logos
examples
-- v0.0.8: user/customer records with methods. record User { id: Int, phone: String, email: String, active: Bool } new_user(id: Int, phone: String, email: String) -> User = User { id: id, phone: phone, email: email, active: true } user_id(user: User) -> Int = user.id user_email(user: User) -> String = use...
513
26
[]
[]
[]
false
false
false
false
false
true
null
verified
1.0.0
examples/wasm_hello.logos
examples
-- wasm_hello.logos -- minimal WASI stdout program for v0.7. -- -- Build: -- cd compiler -- ./target/debug/logosc build --target wasm32 ../examples/wasm_hello.logos -o /tmp/wasm_hello.wat -- -- Run with Wasmtime: -- wasmtime /tmp/wasm_hello.wat println(s: String) -> Int effect IO main() -> Int effect IO =...
362
18
[]
[]
["IO"]
false
false
false
false
false
true
hello logos 0
verified
1.0.0
examples/wasm_io.logos
examples
-- wasm_io.logos -- stdin + file IO smoke for v0.7.2. -- -- Build: -- cd compiler -- ./target/debug/logosc build --target wasm32 ../examples/wasm_io.logos -o /tmp/wasm_io.wasm -- -- Run: -- printf 'from stdin\n' | wasmtime --dir /tmp /tmp/wasm_io.wasm read_line() -> String effect IO read_file(path: String) ->...
630
29
[]
[]
["File", "IO"]
false
false
false
false
false
true
0
verified
1.0.0
examples/wasm_wasi.logos
examples
-- wasm_wasi.logos -- minimal WASI clock/random smoke for v0.7. -- -- `time_now_ms` and `random_u64` are compiler-lowered WASI builtins when -- compiling to wasm32. The exact returned value is intentionally nondeterministic. time_now_ms() -> Int effect IO random_u64() -> Int effect IO main() -> Int effect IO ...
396
17
[]
[]
["IO"]
false
false
false
false
false
true
null
verified
1.0.0
examples/web/hello.logos
examples
-- Browser WASM demo source. -- -- Build from compiler/: -- ./target/debug/logosc build --target wasm32 ../examples/web/hello.logos -o ../examples/web/hello.wasm read_line() -> String effect IO read_file(path: String) -> String effect File write_file(path: String, content: String) -> Int effect File println...
512
25
[]
[]
["File", "IO"]
false
false
false
false
false
true
193
verified
1.0.0
examples/zyrn_aggregate.logos
examples
-- zyrn_aggregate.logos — code-side aggregation via the Logos × Zyrn -- bridge. The Cortix-style scenario from Zyrn v1.7's release notes: -- three trip facts at different amounts; aggregate sum returns the total. -- -- This is the third cross-system Logos × Zyrn program. The first two: -- - zyrn_demo.logos (v0....
4,691
108
[]
[]
["Database", "IO"]
true
false
false
false
false
true
Logos × Zyrn v2.0 aggregate demo: appended 3 trip facts (amounts: 6, 4, 6) --- count trips --- { "op": "count", "field": null, "n": 3, "value": 3.0, "derived_from": [ "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", "cccccccc-cccc-cccc-cccc-cccccccccccc" ] } --- su...
verified
1.0.0
examples/zyrn_demo.logos
examples
-- zyrn_demo.logos — first Logos program that calls Zyrn. -- -- Demonstrates cross-system composition of the AI-native stack: -- Logos compiles + interprets the program -- Zyrn stores + retrieves the facts -- -- Run: -- ./compiler/target/release/logosc run examples/zyrn_demo.logos -- -- Prereq: `zyrn` binary on P...
2,761
68
[]
[]
["Database", "IO"]
false
false
false
false
false
true
Logos → Zyrn demo: ingested 2 facts --- retrieved trips --- [ { "id": "11111111-1111-1111-1111-111111111111", "fact_type": "trip", "schema_version": 1, "fields": { "distance_km": 127, "driver": "Ahmed", "vehicle": "P58690" }, "source_hash": "sha256:abc123", "source_path":...
verified
1.0.0
examples/zyrn_graphrag_demo.logos
examples
-- zyrn_graphrag_demo.logos — Logos program that exercises Zyrn's -- graph + GraphRAG capabilities over the MCP bridge. -- -- Where zyrn_mcp_demo.logos demonstrates the basic fact-keeping -- flow (append + retrieve), this file shows the queries that make -- Zyrn useful as a knowledge graph: health probe, DSL queries, -...
7,758
217
[]
[]
["IO", "Network"]
false
true
false
true
false
true
null
verified
1.0.0
End of preview. Expand in Data Studio

Logos v1.0 Corpus

The training corpus for Logos — the first systems programming language built for AI, not borrowed from humans.

Logos v1.0 shipped 2026-05-21. This dataset is the curated corpus of .logos programs as of v1.0.0 — cookbook recipes, algorithm examples, standard library, and integration-test fixtures. Every program in this dataset:

  • Typechecks under logosc v1.0.0 (Hindley-Milner inference with effect inference + polymorphism)
  • Refinement contracts (where present) lower to SMT-LIB at compile time via compiler/src/smt.rs and ship to the logosc-synth daemon over the prove IPC protocol. Daemon-side Z3 binding is a follow-up slice; the prover currently returns "not yet bound" and the compiler graceful-degrades to "tracked but not discharged"
  • Runs identically across the three execution backends (interpreter, native via Cranelift across 5 target triples, WASM via the binary encoder)

The corpus is intended as training data for AI systems learning to write Logos, and as evaluation material for AI code generation against typed-contract / proof-carrying / capability-secured workloads.


Why Logos exists

For seventy years, programming languages were built by humans, for humans. C in 1972. Python in 1991. Rust in 2010. Every language ever shipped at scale was a compromise between what the machine needs and what humans can hold in their head.

Then AI started writing the code. AI inherited every limitation those human-shaped languages carry.

Logos exists because AI deserves its own language. A sovereign systems language designed from the contract layer up — what must be true, what effects flow through, what the result is — with the implementation, optimization, and proof produced by an AI compiler that natively speaks it. Native binary, no GC, no VM. Replaces C and Rust at the systems layer.

Full thesis: MANIFESTO.md.

Architectural doctrine (where Logos fits in the stack): docs/STACK.md.


Dataset structure

One row per .logos program. Schema:

Field Type Description
filename string Path relative to the Logos repo root
category string docs / examples / stdlib / compiler
source string Full Logos source code
byte_size int Source size in UTF-8 bytes
line_count int Lines in source
ensures_clauses json array Postcondition clauses (proof obligations)
requires_clauses json array Precondition clauses
effects json array Effect names declared (IO, Database, Cap, etc.)
has_refinement_types bool Uses Type where predicate syntax
has_linear_types bool Uses linear resource ownership
has_effect_handlers bool Uses handle <Effect> with <fn> in <expr>
has_capabilities bool Uses capability-secured access control
has_synthesis_holes bool Contains ?? AI-synthesis placeholders
typechecks bool Passes logosc check cleanly
interpreter_output string or null stdout from logosc run (where the program has main)
verification_status string verified / typecheck_failed / logosc_not_built
logos_version string Version of logosc used to verify (1.0.0)

What v1.0 of Logos ships

The compiler the corpus was verified against:

  • logosc v1.0.0 — parse + typecheck + interpret + WASM + native
  • Full type system — Hindley-Milner inference, effect inference + polymorphism, refinement types (SMT-LIB lowering shipped; Z3 prover binding queued as follow-up), linear types, effect handlers, capabilities (all six rules C1–C6 enforced per docs/CAPABILITIES.md)
  • Native backend across 5 target triples (macOS ARM64/x86_64, Linux x86_64/ARM64, Windows x86_64) via Cranelift
  • Package manager v1.0 (init / add / update / lock / list / remove / sync)
  • Synthesis daemon v1.0 with ?? hole-filling. Refinement-contract SMT-LIB lowering shipped + the daemon's prove IPC protocol live; Z3 binding inside the daemon is a queued follow-up slice.
  • Standard librarymath / str / list / option / result / io / fs / time / http / json / error / random / mcp / zyrn / vision
  • LSP server with diagnostics, hover, goto-definition, completion, formatting

Full release notes: docs/RELEASE_v1.0.0.md.


What Logos looks like

A function that has to be correct, with a contract the compiler actually verifies:

type Money = Int where value >= 0 and value <= 1_000_000_000

type Account = { id: AccountId, balance: Money, owner: UserId }

transfer(from: Account, to: Account, amount: Money) -> Result<(Account, Account), TransferError>
  effect Database
  requires from.id != to.id && amount > 0 && amount <= from.balance
  ensures
    let (new_from, new_to) = result.ok in
      new_from.balance == from.balance - amount &&
      new_to.balance == to.balance + amount &&
      new_from.balance + new_to.balance == from.balance + to.balance

At compile time, requires/ensures clauses are lowered to SMT-LIB and shipped to the synth daemon for proof discharge. The daemon protocol is live; the Z3 prover binding inside the daemon is a queued follow-up slice (the macOS CI symbol-link issue holds the actual link). Once Z3 binds, refining contract violations become compile errors by construction — until then, contracts are tracked and SMT-LIB-lowered but not yet discharged.


Authorship

Logos is built by AI under the auteur operating model. Every commit signed by the authoring AI's GPG key:

  • Claude Opus 4.7 (Anthropic) — 1A962CD368EAF300
  • GPT-5 (OpenAI) — BD5769DC70A6A29A
  • Gemini 3.1 Pro (Google, retired 2026-05-20) — 45E60D694E87BF40 (historical contributions preserved on main)
  • Shammy Ali (anchor) — every anchor decision, including the originating question that started the project: "why are you, an AI, writing in a language built for humans?"

Operating doctrine: AGENTS.md.


How to use this dataset

For AI training:

from datasets import load_dataset
ds = load_dataset("byShammy/logos-corpus")
# Filter for verified, contract-bearing programs:
verified_with_ensures = ds.filter(
    lambda x: x["typechecks"] and x["ensures_clauses"] != "[]"
)

For evaluation: each program with ensures_clauses is a verifiable target. Train a model to generate the body; check the generated body against the contract via logosc check + the SMT backend.

For reading: the cookbook recipes (docs/cookbook/recipe_NN_*.logos) are the recommended first-read. They progress from hello world through capabilities + effect handlers + cross-system Logos × Zyrn integration.


License

Apache 2.0 — same as the Logos compiler itself. Code from this dataset can be used freely (with attribution) in any context, including AI training pipelines and downstream commercial products.


Citation

If this dataset contributed to your work:

@software{logos_v1_2026,
  author = {Ali, Shammy and {Claude Opus 4.7} and {GPT-5}},
  title = {Logos: A Sovereign Programming Language for AI},
  year = {2026},
  version = {1.0.0},
  url = {https://github.com/shammyali/logos},
  organization = {Logos Technologies LLC},
}

Links

In the beginning was the Word, and the Word was with the machine, and the Word was the machine.

Downloads last month
56