HoldFastPlayground

HoldFast browser playground

Scope and launch

Open the hosted Playground for Browser mode. It runs entirely in the browser. For Local compiler mode, install the native toolchain, run python tools/run.py holdfast-playground from the repository root and open the printed URL. The page sends source to the authenticated loopback service. Windows runs the compiler in WSL. Use python3 on Linux or in WSL. Add --port 0 to choose an available port. Press Ctrl+C to stop the service.

The hosted site includes Monaco. To use the same editor locally, run python tools/run.py holdfast-site --prepare-monaco before starting the service. It verifies the input archives and builds the editor module, stylesheet, font and worker into a cache shared with WSL. Both pages serve the assets from their own origin and fall back to a plain-text editor if the bundle is missing or fails to load. Shared HTML · Script · Styles · Browser editor asset terms

Use the playground

  1. Choose an example in the editor toolbar or paste a complete module into the editor.
  2. In Console, enter an expression, choose Result type (Nat or bool), and select Run. A suggested expression fills both fields and runs immediately.
  3. Select Compile to see the translation or preview in Gallina. A compiler refusal opens Problems with the diagnostic. Select a located diagnostic to move the editor to its source position.

The console reduces an expression at compile time using the current editor contents. Save those contents with the source download in Tools before closing the page or replacing your work with a different example.

Documentation and discovery

The Playground documentation directory and full documentation index group guides and reference documents by subject. The guides pair HoldFast source with native checks or browser exercises. ?example=<id>#playground selects a catalog example and falls back to the default for unknown IDs.

Pages publishes tracked Markdown under docs/ and the plan as standalone HTML with shared styles and source links. It preserves explicit anchors, rewrites relative links to published routes and renders without JavaScript. Workflow · Plan · Documentation index

The site publishes a Markdown overview for the homepage and an index.md copy alongside each generated HTML article. The overview includes a complete runnable example and explains what Browser, Local compiler, and Rocq replay each check. Both formats resolve links to the published routes. Each HTML page links to its Markdown companion and advertises it with rel="alternate". Each page also points to the curated llms.txt index with rel="describedby". The index links directly to the Playground overview and Markdown documentation. Agent index · llms.txt proposal

Use relative links, keep explicit anchors when renaming headings, and set title and search description with seo-title and description comments before the first heading. Label HoldFast fences hf for custom highlighting. Pinned Pygments handles other recognized languages. Unlabeled and text render plain.

Build into a new directory with python tools/run.py holdfast-site --output out/site. To reproduce the Pages artifact, prepare Monaco and add --require-monaco --minify to the build command. The builder uses the pinned esbuild to minify the app module and both assembled stylesheets. It compacts HTML indentation after rendering each page, preserving code examples and the embedded license notice. The native playground builds on first request and serves from memory. Tool commands

With the bundle prepared, check the editor in an installed Chromium or Edge.

Plain text
python tools/run.py holdfast-site --smoke-browser PATH --browser-sha256 SHA256

The smoke check serves the generated site under a Pages-style subdirectory, checks styling and an actual module worker round trip, and forces editor-load failure in a second browser session. Both sessions compile and evaluate the default example using same-origin assets. Smoke harness

The sitemap lists public canonical URLs. Example URLs share the home canonical.

After deployment, verify HTTP 200 for the sitemap and every listed URL. Match each page's canonical URL to its sitemap entry, then submit in the Search Console URL-prefix property for https://symbiogenesis.github.io/HoldFast/. Search engines read robots.txt above the project directory, at the host root. Public sitemap · Sitemap submission · Crawler file location

Check each guide's crawl and canonical selection in URL Inspection. Compare impressions, clicks and average position by page and query in the Performance report, including borrow checking, graded types, dependent types and formal verification. URL Inspection · Performance report

Dependent mathematics increment

Browser checks pure Nat and bool modules and translates them to Gallina. For supported mathematical examples it evaluates expressions and shows the locations of unchecked proof obligations. Evaluating a closed assertion can expose a false result.

Local compiler parses the full buffer with Menhir and runs the mathematical elaborator, including its checks for contracts, loans, natural usage grades and interface constraints. Use this mode to check the supported concise authoring forms. It shows the pure translation when available and the elaborator's Gallina otherwise. Kernel acceptance requires replay in Rocq. Concise authoring forms · Mathematical elaborator · Source and proof qualification

The playground compiles one buffer. Use the locked package builder for imports from other files. The hosted application target has its own runtime contract. Locked packages · Application profile

With the default example loaded, set the console result type to Nat and run At(VCons(Square(7), VNil<Nat>()), FZero<0>()) to get 49. The native worker requires exactly one synthetic typed constant initializer and refuses declaration injection, runtime dependencies and budget exhaustion.

Browser behavior

The editor updates diagnostics as you type. Edits clear results for the old source, including diagnostics, inspection, console results and the downloadable Gallina translation. Replies bind source and connection. Console replies also bind the expression and result type.

The local Problems panel shows goal position, status, expected type and context. Unproved assertions are marked at assert with their proposition, local facts and exhausted search limit when applicable. When a single guard line changes above an unchanged assertion, the panel can show branch facts lost since the previous successful check. The earlier facts are labeled as history and the current assertion stays unresolved. Premise edits invalidate the result even for identical assertion text. The service checks parser, bytecode interpreter, Python and mathematical frontend inputs around compile and evaluate. The page polls that generation every three seconds. Dependency changes clear diagnostics and output and expire pending replies. Restart to prepare the changed compiler. Named goals

Monarch supplies lexical highlighting. A separate pure LSP session syncs versioned overlays for hover, definition, references, symbols, inlay hints and semantic tokens. Formatting returns a version-bound edit. Source-derived content renders as text. Compile and evaluate survive Monaco failure. Language server

Repair an inline assertion

In the local Playground, replace the editor contents with the proof repair example and select Compile. Once the check succeeds, replace enabled && Flip(Flip(flag)) == flag with enabled in the guard of EnabledFlag. Leave the assertion as written. Compile again and read the assertion's current context in Problems. The earlier branch fact from the conjunction appears below it as history.

Change the assertion to assert Flip(Flip(flag)) == flag by DoubleNegation(flag); and compile again. The lemma proves double negation by cases, so the check succeeds under the shorter guard and the history clears. The diagnostic-session control replays the saved repair in Rocq with proof search off. Replay control · Fedorin on proof repair

Local transport

The server binds IPv4 loopback, checks exact Host and any supplied Origin, and builds an in-memory site-file allowlist at first request. It applies no-store, no-referrer and framing protections. The page removes the startup URL's random bearer token fragment and sends the token on every same-origin API request. Clients supply source text only, with no executable or disk path selection.

Send API requests as UTF-8 JSON POSTs with Content-Type: application/json and Authorization: Bearer TOKEN.

Path Request Successful response
/api/session {} { "session": "opaque-id" }
/api/compiler-generation {} Prepared compiler input digest generation and Boolean current
/api/close { "session": "opaque-id" } { "closed": true } (idempotent)
/api/lsp { "session": "opaque-id", "message": LSP_OBJECT } { "messages": [LSP_OBJECT] }
/api/compile { "source": "UTF-8 text" } ok, sourceHash, module, gallina, editorServices, findings
/api/evaluate { "source": "UTF-8 text", "expression": "text", "valueType": "Nat or bool" } ok, sourceHash, valueType, value (decimal or Boolean text)
/api/authoring { "source": "UTF-8 text" } ok, sourceHash, findings, bindingPreview

Successful compile replies can include checkedAssertions, an ordered list of inline assertion locations and contexts. Entries have line, column, expected and branchFacts. Positions use one-based compiler coordinates. The list is advisory and can omit locations that exceed diagnostic limits.

Compiler refusals return ok: false, the source hash, and an error object with kind, message, line and column. Compile refusals also return editorServices. Named-goal refusals carry an ordered goals array. Its entries have name, line, column, status, nullable expected and context. An unresolved inline assertion can carry assertionGoal with status, expected, context and optional branchFacts. Its location comes from the error object and identifies the assert keyword. The goal stays unresolved when the error kind is limit. A loan or cleanup refusal can carry loanConflict with conflictSpans (pairs of UTF-8 byte offsets) and exitObligations (descriptions of checks still required on exit). Loan diagnostics

HTTP 200 compile and evaluation replies, including compiler refusals, carry the prepared input digest in the X-HoldFast-Compiler-Generation header. Expression diagnostics identify expression context. Transport refusals use an unsuccessful HTTP status and an error string.

A finding has code, message, line and column. Compilation returns mathematical lint findings in source order, with at most 8,192 entries. Malformed, unordered, duplicate or oversized findings fail result validation. Advisory findings do not prevent Gallina output.

The server handles requests sequentially and bounds HTTP read time, request and response sizes, open sessions and idle lifetime. Closing or reconnecting releases the preceding session. Isolated compiler workers have bounded input, output and time. The server validates request shapes and checks the prepared parser and response bindings before publishing compile and evaluation results. Server · Worker

Authoring and inspection increment

For supported pure source, select Format to apply canonical layout, Inspect to see symbols and references, or open the style panel to check naming, documentation and Boolean comparisons. A style check can preview explicit let bindings for bare typed declarations. Review the candidate and select Apply preview to edit the buffer. Use Tools to undo the latest tool edit. Formatting checks token and comment preservation, documentation attachment and idempotence before returning an edit. The inspector uses exact UTF-16 ranges for navigation. Authoring contract

Extended expression examples

The examples and console exercise Boolean logic, comparisons, guarded natural subtraction and Nat.SaturatingSub. Pure expressions

Division and remainder examples

The arithmetic example exercises grouping, precedence and guards for natural division and remainder. The guard establishes a nonzero divisor before the operation runs. Operation semantics

Acceptance

The published page controls check routes, canonical URLs, the sitemap, internal links and fragments, code rendering, and Markdown discovery and link resolution for the homepage and documentation. The HTTP controls exercise authentication, session isolation, real editor requests, bounded failures and stale-result handling. The mathematical controls exercise compile/evaluate, injection refusal, response validation and the browser assets. They check a proof through the native HTTP worker with sufficient and exhausted search budgets, a changed premise, and an explicit repair under the same limit. Rocq independently replays the emitted assertions. The browser control checks historical facts across a guard edit, and clears the comparison after a dependency change or an edit outside that guard. The controls require every built-in example to pass the browser and native mathematical lints, as well as the pure authoring lints where the pure compiler supports the example. Browser interaction and independent editor interoperability use their own checks. Local validation · Editor qualification