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 |
examples/zyrn_mcp_demo.logos | examples | -- zyrn_mcp_demo.logos — Logos × Zyrn through the MCP bridge.
--
-- Counterpart to examples/zyrn_demo.logos (CLI subprocess
-- bridge) — shows the same end-to-end fact-keeping flow over the
-- TASK-MCP.05–.08 generic builtins, now using the post-v0.2.9
-- linear capability discipline.
--
-- # Run
--
-- ./compiler-mcp... | 6,176 | 161 | [] | [] | ["IO", "Network"] | false | true | false | true | false | true | null | verified | 1.0.0 |
examples/zyrn_trace.logos | examples | -- zyrn_trace.logos — provenance + head-of-chain demo for the Logos × Zyrn bridge.
--
-- This is the *second* cross-system program (the first was zyrn_demo.logos,
-- which exercised append + retrieve). This one exercises every bridge
-- builtin including the v1.5+ addition `zyrn_retrieve_head`:
--
-- - append the ori... | 5,188 | 110 | [] | [] | ["Database", "IO"] | false | false | false | false | false | true | Logos → Zyrn trace demo:
ingested original + correction
--- all trip facts (retrieve — full history) ---
[
{
"id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
"fact_type": "trip",
"schema_version": 1,
"fields": {
"distance_km": 100,
"driver": "Ahmed",
"vehicle": "P58690"
},
"sour... | verified | 1.0.0 |
stdlib/error.logos | stdlib | -- std.error — error types and propagation primitives.
--
-- Logos uses Result types (std.result) for recoverable errors and
-- typed effect handlers (v0.2+) for non-recoverable errors. This
-- module provides the canonical structured error type that stdlib
-- modules return when they fail.
--
-- Once v0.0.8 records sh... | 2,911 | 73 | ["match e with | NotFound(m) => result == true | PermissionDenied(m) => result == false | InvalidInput(m) => result == false | OutOfRange(m) => result == false | OutOfMemory => result == false | Timeout(m) => result == false | NetworkError(m) => result == false | ParseError(m) => result == false | UnknownError(m) => re... | [] | ["handlers"] | false | false | true | false | false | true | null | verified | 1.0.0 |
stdlib/fs.logos | stdlib | -- std.fs — file system operations.
-- All functions declare effect File. Caller propagates it.
--
-- Paths are strings for v0.x; a strongly-typed Path wrapper arrives
-- in v0.1 with refinement types ("Path where is_absolute(value)").
-- Read the contents of a file as a string. Returns the contents or
-- (once Result... | 1,325 | 48 | ["result == 0\n\n-- Append a string to a file. Creates the file if missing.", "result == 0\n\n-- Test existence. Returns true if a file or directory exists at `path`.", "result >= 0\n\n-- Remove a file. Returns 0 on success.", "result == 0\n\n-- Create a directory. Parents are created as needed.", "result == 0\n\n-- Tr... | [] | ["File"] | true | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/http.logos | stdlib | -- std.http — HTTP client primitives.
-- Outgoing requests declare effect Network. Once the type system grows
-- record types (v0.0.8), HttpRequest/HttpResponse become proper records
-- and these signatures get richer.
-- Returns the HTTP status code (200, 404, 500, etc.) of a GET request
-- to the given URL. Body is ... | 1,899 | 45 | ["result >= 100 && result < 600\n\n-- Performs a GET request and returns the response body as a string.\n-- Fails (sum-type-wrapped in v0.1 with Result) if the request errors.", "(code >= 200 && code < 300 && result == true) || ((code < 200 || code >= 300) && result == false)\n = code >= 200 && code < 300\n\n-- True i... | [] | ["Network"] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/io.logos | stdlib | -- std.io — terminal input and output. All functions declare effect IO.
--
-- Pure functions don't belong here. Anything that touches stdin / stdout
-- / stderr is by definition effectful. The effect declaration is what
-- the type system uses to track this through the call graph.
-- Write a string to stdout. No newli... | 1,040 | 37 | ["result == 0\n\n-- Write a string + newline to stdout.", "result == 0\n\n-- Write an integer's decimal representation to stdout.", "result == x\n\n-- Write a string + newline to stderr.", "result == 0\n\n-- Read a single line from stdin. Returns the line WITHOUT the trailing\n-- newline. Behavior on EOF is implementat... | [] | ["IO", "declaration"] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/json.logos | stdlib | -- std.json — JSON parsing and serialization.
-- All operations pure; no effect declarations. JSON values are
-- represented as the JsonValue sum type until v0.0.8 records arrive.
--
-- This module is signature-only in v0.x. Real implementation lands
-- in v0.6 (AI synthesis fills the bodies) and v0.7 (WASM codegen
-- ... | 4,480 | 101 | ["match v with | JsonNull => result == true | JsonBool(b) => result == false | JsonInt(i) => result == false | JsonString(s) => result == false | JsonArrayMarker(n) => result == false | JsonObjectMarker(n) => result == false\n = match v with\n | JsonNull => true\n | JsonBool(b) => false\n | JsonInt(i) =... | ["indent >= 0 && indent <= 8\n\n-- ---- Predicates ----------------------------------------------------------"] | ["declarations"] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/list.logos | stdlib | -- std.list — sequence operations.
--
-- Until v0.1 generics land, the stdlib provides specialized variants per
-- element type. Most useful operations are defined here for Int lists;
-- StrList comes when the corresponding sum-type wrapper exists.
--
-- The IntList type is a cons-list: Nil terminates, Cons(head, tail)... | 5,011 | 149 | ["match xs with | Nil => result == true | Cons(h, t) => result == false\n = match xs with\n | Nil => true\n | Cons(h, t) => false", "result >= 0\n = match xs with\n | Nil => 0\n | Cons(h, t) => 1 + int_list_length(t)", "match xs with | Nil => result == default | Cons(h, t) => result == h\n = matc... | ["n >= 0", "n >= 0\n = if n <= 0 then Nil", "n >= 0", "n >= 0", "n >= 0"] | [] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/math.logos | stdlib | -- std.math — pure arithmetic, transcendental functions, integer operations.
--
-- Every function in this module is PURE — no effect clause.
-- Contracts are written to express the strongest provable property.
-- Bodies are deferred to v0.7+ codegen; v0.6 AI synthesis will fill them.
--
-- Conventions for this module:
... | 4,234 | 114 | ["result >= 0\n = if x < 0 then -x else x", "result == -x\n = -x", "(result == a || result == b) && result <= a && result <= b\n = if a < b then a else b", "(result == a || result == b) && result >= a && result >= b\n = if a > b then a else b", "result >= lo && result <= hi\n = if x < lo then lo else if x > hi the... | ["lo <= hi", "b != 0", "b != 0", "b != 0\n = if int_mod(a, b) == 0 then a / b", "b > 0", "exp >= 0\n = if exp == 0 then 1"] | ["clause"] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/mcp.logos | stdlib | -- std.mcp — generic MCP (Model Context Protocol) bridge builtins.
--
-- Four primitives that let a Logos program speak JSON-RPC 2.0 over
-- HTTP to ANY MCP-compatible server. Zyrn v2.4.1+ is the first
-- real consumer (see stdlib/zyrn.logos for the typed wrappers);
-- future MCP servers (Linear, Slack, GitHub) reach t... | 5,150 | 113 | ["result == 0\n"] | [] | ["Network"] | true | true | true | true | false | true | null | verified | 1.0.0 |
stdlib/option.logos | stdlib | -- std.option — Option-equivalent sum type and combinators.
--
-- Until v0.1 ships generics, this module provides specialized variants
-- per element type. When `Option<T>` arrives in v0.1, IntOption / StrOption
-- get unified in a single coordinated migration commit.
--
-- The semantics match the canonical Option / Ma... | 2,489 | 74 | ["match opt with | Some(x) => result == true | None => result == false\n = match opt with\n | Some(x) => true\n | None => false", "match opt with | Some(x) => result == false | None => result == true\n = match opt with\n | Some(x) => false\n | None => true\n\n-- Returns the contained Int, or the p... | [] | [] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/random.logos | stdlib | -- std.random — seeded pseudo-random number generation.
-- All RNG operations declare effect Random. Deterministic given the
-- same seed; suitable for reproducible test data, NOT for cryptography.
--
-- For cryptographic randomness, use std.crypto (v0.4) when it lands.
-- That module declares effect Crypto and reads f... | 2,966 | 72 | ["result >= low && result < high\n = low + int_euclid_mod(rng_next(state), high - low)\n\n-- Returns a pseudo-random boolean by sampling the next state and\n-- checking parity of the low byte.", "result == 0 || result == 1\n = if int_euclid_mod(rng_next(state), 1_000_000) < probability_per_million", "result >= 0 && r... | ["low < high", "probability_per_million >= 0 && probability_per_million <= 1_000_000", "b > 0", "low < high"] | ["Crypto", "Random"] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/result.logos | stdlib | -- std.result — Result-equivalent sum type and combinators.
--
-- Until v0.1 ships generics, this module provides specialized variants
-- for the common error and success-value type combinations. When
-- `Result<T, E>` lands in v0.1, these get unified.
--
-- The semantics match the canonical Result / Either pattern:
--... | 3,351 | 95 | ["match r with | OkInt(x) => result == true | ErrStr(e) => result == false\n = match r with\n | OkInt(x) => true\n | ErrStr(e) => false", "match r with | OkInt(x) => result == false | ErrStr(e) => result == true\n = match r with\n | OkInt(x) => false\n | ErrStr(e) => true\n\n-- Returns the Ok valu... | [] | ["Database"] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/str.logos | stdlib | -- std.str — string primitives.
--
-- All functions are PURE. Strings are immutable, so every operation that
-- "modifies" a string returns a new one. Length is measured in bytes
-- for now; Unicode grapheme cluster counting comes once Unicode lands.
--
-- The contracts express invariants that any correct implementatio... | 3,809 | 98 | ["result >= 0\n\n-- Concatenation. The length of the result equals the sum of inputs' lengths.", "string_length(result) == string_length(a) + string_length(b)\n\n-- Substring extraction. `from` and `len` must be non-negative; `from + len`\n-- must not exceed the length of `s`. The result has exactly `len` bytes.", "str... | ["from >= 0 && len >= 0 && from + len <= string_length(s)", "n >= 0"] | [] | false | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/time.logos | stdlib | -- std.time — clock reads, durations, formatting.
-- All clock reads declare effect Time. Pure arithmetic on durations does not.
--
-- Time is represented as Int milliseconds since Unix epoch (1970-01-01 UTC)
-- for v0.x. Refinement-type-bounded variants ("Time where value >= 0")
-- arrive in v0.1.
-- Current wall-clo... | 1,384 | 46 | ["result >= 0\n\n-- Current monotonic time in nanoseconds since process start.\n-- Useful for measuring durations without wall-clock drift.", "result >= 0\n\n-- ---- Duration arithmetic (pure) ------------------------------------------\n\n-- Convert seconds to milliseconds.", "result == s * 1_000\n = s * 1_000\n\n-- C... | [] | ["Time"] | true | false | false | false | false | true | null | verified | 1.0.0 |
stdlib/vision.logos | stdlib | -- std.vision — typed surface for computer-vision pipelines.
--
-- The architectural shape this enables is the "YOLO + verification +
-- Zyrn supersession" pattern that solves the systems problem that
-- killed earlier vision pipelines: probabilistic detector output
-- treated as ground truth, two-store sync drift, no ... | 9,342 | 208 | [] | ["threshold >= 0 && threshold <= 100\n\n-- Verify a single detection with a more expensive / higher-fidelity\n-- model. The canonical use case is \"YOLO produced a high-confidence\n-- detection of an important class; verify with a vision LLM before\n-- committing to the claim record.\" Returns the verifier's verdict in... | ["Network"] | true | true | false | false | false | true | null | verified | 1.0.0 |
stdlib/zyrn.logos | stdlib | -- std.zyrn — typed wrappers over the generic MCP bridge for Zyrn.
--
-- Zyrn is the AI-native fact-keeping graph database (zyrn v2.4.1+
-- locked protocol with Logos v0.8.x). These 16 wrappers give Logos
-- programs ergonomic, named-tool access to Zyrn's MCP server
-- without the program having to hand-roll JSON param... | 8,727 | 210 | [] | ["top_k > 0\n\n-- Compute the n-hop neighborhood of a starting fact in the graph.\n-- Used by demos that need to visualize provenance trees.\n--\n-- MCP tool: `neighborhood`\n-- Returns: JSON array of fact objects within `hops` of `fact_id`.", "hops >= 0\n\n-- Aggregate facts of a given type by a field path. Returns co... | ["Network", "annotation"] | false | true | false | true | false | true | null | verified | 1.0.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.