Liking cljdoc? Tell your friends :D

leanfran.core

Embed Lean in Clojure.

deflean takes Lean source, checks it (including every proof) with lake build at macro-expansion time, and defines the Lean functions in the current namespace through code generated by the leanfran CLI.

Embed Lean in Clojure.

`deflean` takes Lean source, checks it (including every proof) with `lake
build` at macro-expansion time, and defines the Lean functions in the current
namespace through code generated by the `leanfran` CLI.
raw docstring

leanfran.dsl

Render Lean source from Clojure data.

Commands, terms, and tactics are written as S-expressions:

(def double [n Nat] Nat (+ n n)) (theorem double_eq [n Nat] (= (double n) (* 2 n)) (by (unfold double) omega))

(lean "...") embeds Lean source verbatim wherever a command, term, or tactic is expected.

Render Lean source from Clojure data.

Commands, terms, and tactics are written as S-expressions:

  (def double [n Nat] Nat (+ n n))
  (theorem double_eq [n Nat] (= (double n) (* 2 n))
    (by (unfold double) omega))

`(lean "...")` embeds Lean source verbatim wherever a command, term, or
tactic is expected.
raw docstring

leanfran.malli

malli instrumentation of leanfran.typed/defn functions from their Lean signatures. malli is the user's dependency; this namespace loads it when called.

malli instrumentation of `leanfran.typed/defn` functions from their Lean
signatures. malli is the user's dependency; this namespace loads it when
called.
raw docstring

leanfran.runtime

Runtime for Clojure code generated from Lean IR.

Functions named lean_* implement the C symbols of Lean's @[extern] declarations, so generated code calls leanfran.runtime/<C symbol>. Value representation:

  • Nat / Int: Long, or clojure.lang.BigInt when it does not fit
  • UInt8..UInt32, Char, Bool, enumerations: Long
  • UInt64 / USize: Long holding the 64-bit pattern
  • Float: Double
  • String: java.lang.String (positions are UTF-8 byte offsets)
  • Array: persistent vector
  • nullary constructors: Long (the constructor index)
  • other constructors: Ctor
  • closures: Closure
Runtime for Clojure code generated from Lean IR.

Functions named `lean_*` implement the C symbols of Lean's `@[extern]`
declarations, so generated code calls `leanfran.runtime/<C symbol>`.
Value representation:

- `Nat` / `Int`: `Long`, or `clojure.lang.BigInt` when it does not fit
- `UInt8`..`UInt32`, `Char`, `Bool`, enumerations: `Long`
- `UInt64` / `USize`: `Long` holding the 64-bit pattern
- `Float`: `Double`
- `String`: `java.lang.String` (positions are UTF-8 byte offsets)
- `Array`: persistent vector
- nullary constructors: `Long` (the constructor index)
- other constructors: `Ctor`
- closures: `Closure`
raw docstring

leanfran.translate

Lean models of Clojure functions defined with leanfran.typed/defn.

models turns the :lean/sig of each function into leanfran.dsl commands: a def whose body is the Clojure body written with the models of clojure.core in Clj. Lean infers the types; the translation only follows the syntax.

Lean models of Clojure functions defined with `leanfran.typed/defn`.

`models` turns the `:lean/sig` of each function into `leanfran.dsl`
commands: a `def` whose body is the Clojure body written with the models of
`clojure.core` in `Clj`. Lean infers the types; the translation only follows
the syntax.
raw docstring

leanfran.typed

Clojure functions with Lean signatures.

(leanfran.typed/defn insert-sorted [x Int xs (List Int)] (List Int) ...)

The function is an ordinary Clojure function. Its signature and body are kept in the var's :lean/sig metadata, from which (clojure insert-sorted) in a deflean block renders a Lean model of the function to prove things about.

Clojure functions with Lean signatures.

  (leanfran.typed/defn insert-sorted [x Int xs (List Int)] (List Int)
    ...)

The function is an ordinary Clojure function. Its signature and body are
kept in the var's `:lean/sig` metadata, from which `(clojure insert-sorted)`
in a `deflean` block renders a Lean model of the function to prove things
about.
raw docstring

leanfran.types

Lean types written as leanfran.dsl terms, and what leanfran derives from them: test.check generators of the Clojure values that correspond to a type, a check of such values, malli schemas, and clj-kondo types.

Structures and enumerations are known by the Lean name they are written with in a deflean block (register-commands!).

Lean types written as `leanfran.dsl` terms, and what leanfran derives from
them: test.check generators of the Clojure values that correspond to a type,
a check of such values, malli schemas, and clj-kondo types.

Structures and enumerations are known by the Lean name they are written
with in a `deflean` block (`register-commands!`).
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close