Lema Lema

The Lema programming language

Four concurrency pillars

Four concurrency models, each with laws you can prove. Compose local guarantees through explicit ownership and protocol rules.

Structured parallelism

Split work across disjoint resources. Prove each task safe, then compose their guarantees.

State-owning actors

Each actor owns its state. Prove one step preserves its rules across every message order in the model.

Session-typed channels

Make the conversation a contract. Prove that each send and receive follows a matching protocol.

Commutative concurrency

Prove independent operations can change order with the same replies and final state. Automatic batching is planned.

Lema setup prompt

Install Lema 0.3.2 and run its HTTPS echo starter on my machine. Comment on your experience as you go.

Use only public instructions and downloads from https://www.lema-lang.org/docs/tutorials/get-started/ and its linked setup/requirements pages. Do not assume access to the Lema source repository or ask me to install Rust.

## Check this machine

- Inspect the operating system, architecture, existing Lema installations and PATH. Use the published qualified Apple Silicon macOS or Linux x86_64 requirements. On another host, report the limitation before installing anything.
- Preserve existing projects, runtime configuration and unrelated services. Create the echo project in a new directory; if that name exists, choose a separate directory rather than overwrite it.
- Install or reuse the documented OpenSSL and TLS 1.3 curl tools. On Linux, bubblewrap must come from the OS package manager at /usr/bin/bwrap. Do not weaken ownership, sandbox or quarantine checks.

## Install and set up Lema

Use one public method. If Homebrew is already the preferred package manager, use:
brew tap lorenalabs/lema https://brew.lema-lang.org/homebrew-lema.git
if brew help trust >/dev/null 2>&1; then
  brew trust --formula lorenalabs/lema/lema
fi
brew install lorenalabs/lema/lema

Otherwise download and run the public installer:
curl --proto '=https' --tlsv1.2 -fsSLo install-lema.sh https://www.lema-lang.org/install.sh
sh install-lema.sh

Follow its printed PATH instruction. Keep lema and lema-vm-runner paired. Run lema --version, lema build-info --check-worker, then lema setup. Report the installed version and location, selected runtime configuration, worker check and library-pack result. Continue only when setup exits successfully and prints setup complete. Report a failed download or runtime check; do not silently use --no-pack to get past it.

## Run and test HTTPS

Run lema new echo in the chosen parent directory, enter the new echo project, then run lema run echo. Wait for the serving line, which follows the worker's bind, and copy the exact curl command Lema prints. On macOS this may use an absolute Homebrew curl path. Send the request twice and confirm both return POST /hello, request headers and hi.

The request uses --noproxy '*', HTTP/1.1 and TLS 1.3, with -k only for the local self-signed development certificate. Do not write TCP, TLS or HTTP framing code yourself. If the port is occupied, report it and choose a free development port with lema dev-cert echo --port PORT; do not kill an unrelated process.

## Exercise the edit loop and hand over

Stop the app with Ctrl-C. Change the successful branch of respond in Handler.lean to return Hello from Lema followed by a newline, as shown in the tutorial. Run lema add Handler.lean, then lema test Handler.report with the tutorial's explicit --expect oracle including that newline. Restart lema run echo, wait for serving, and repeat the printed request to confirm the changed response.

Leave the app running when successful. Give me its URL, project path and stop instructions, and explain that Ctrl-C stops the app while lema stop manages the background codebase server. Summarize installed tools, versions, locations, PATH changes and any remaining blockers. Distinguish what Lean checked from what these requests and the handler test exercised. Explain the explicit app/server restart needed after an update.