Embed Lean in Clojure.
deflean takes Lean source, which leanfran --lang clojure sync checks
(including every proof) and turns into Clojure code next to the namespace, and
defines the Lean functions in the current namespace through that code.
Embed Lean in Clojure. `deflean` takes Lean source, which `leanfran --lang clojure sync` checks (including every proof) and turns into Clojure code next to the namespace, and defines the Lean functions in the current namespace through that code.
While leanfran.cli loads namespaces to translate their functions: the names
of the blocks that may have no code yet, :late, and an atom of the blocks
that were expanded, :expanded, and of those that stopped the load of their
namespaces, :stopped.
While `leanfran.cli` loads namespaces to translate their functions: the names of the blocks that may have no code yet, `:late`, and an atom of the blocks that were expanded, `:expanded`, and of those that stopped the load of their namespaces, `:stopped`.
(block-args args)The options and the body of the arguments after the name of a block.
The options and the body of the arguments after the name of a block.
(block-hash ns-name block opts src)The hash of a block: of its namespace and its Lean module with the options
opts.
The hash of a block: of its namespace and its Lean module with the options `opts`.
The name of the block of the models that leanfran.typed/check runs for the
functions of a namespace.
The name of the block of the models that `leanfran.typed/check` runs for the functions of a namespace.
(check-module ns-name)The Lean module of the models that leanfran.typed/check runs for the
functions of the Clojure namespace ns-name.
The Lean module of the models that `leanfran.typed/check` runs for the functions of the Clojure namespace `ns-name`.
(check-source ns-name)The options and the source of the block check-block of the Clojure namespace
ns-name.
The options and the source of the block `check-block` of the Clojure namespace `ns-name`.
(checks-namespace ns-name)The Lean namespace of the functions that leanfran.typed/check calls for the
Clojure namespace ns-name.
The Lean namespace of the functions that `leanfran.typed/check` calls for the Clojure namespace `ns-name`.
What a block that names Clojure functions opens of Clj.
What a block that names Clojure functions opens of `Clj`.
(deflean block & args)Define the functions of a block of Lean in the current namespace.
(deflean arith (def double [n Nat] Nat (+ n n))
(theorem double_eq [n Nat] (= (double n) (* 2 n))
(by (unfold double) omega)))
The body is a sequence of leanfran.dsl commands; a string in the body is
Lean source taken as is. An optional map before the body takes :imports,
a vector of Lean modules to import, :uses, a vector of other blocks
(ns/block, or block of this namespace) whose definitions the block
uses, and :opens, a vector of Lean namespaces to open. The block becomes
the Lean module returned by module-name, whose definitions are wrapped in a
namespace of the same name.
The macro expands to the code that leanfran --lang clojure sync generated
for the block, and stops compilation when that code is missing or that of
another source. It runs neither Lean nor the compiler, except that
LEANFRAN_AUTO_SYNC=1 runs sync for such code of a block without
(clojure f ...).
Define the functions of a block of Lean in the current namespace.
(deflean arith
(def double [n Nat] Nat
(+ n n))
(theorem double_eq [n Nat] (= (double n) (* 2 n))
(by (unfold double) omega)))
The body is a sequence of `leanfran.dsl` commands; a string in the body is
Lean source taken as is. An optional map before the body takes `:imports`,
a vector of Lean modules to import, `:uses`, a vector of other blocks
(`ns/block`, or `block` of this namespace) whose definitions the block
uses, and `:opens`, a vector of Lean namespaces to open. The block becomes
the Lean module returned by `module-name`, whose definitions are wrapped in a
namespace of the same name.
The macro expands to the code that `leanfran --lang clojure sync` generated
for the block, and stops compilation when that code is missing or that of
another source. It runs neither Lean nor the compiler, except that
`LEANFRAN_AUTO_SYNC=1` runs `sync` for such code of a block without
`(clojure f ...)`.(generated ns-name block opts src)The text of the code that sync generated for a block, if it is the code of this source.
The text of the code that sync generated for a block, if it is the code of this source.
(generated-path ns-name block)The file of the code that leanfran --lang clojure sync generates for a
block, relative to the directory of the classpath that holds the namespace.
The file of the code that `leanfran --lang clojure sync` generates for a block, relative to the directory of the classpath that holds the namespace.
The leanfran --lang clojure --generator-version that the library works
with.
The `leanfran --lang clojure --generator-version` that the library works with.
(lean-function var)The function that runs the Lean code of var, a function of a deflean
block: the one that calls no Clojure function that replaces Lean code.
The function that runs the Lean code of `var`, a function of a `deflean` block: the one that calls no Clojure function that replaces Lean code.
The version of Lean that the library works with.
The version of Lean that the library works with.
(load-used! module)Load the namespaces of the blocks that the block of module uses, whose
deflean stops when its code is out of date.
Load the namespaces of the blocks that the block of `module` uses, whose `deflean` stops when its code is out of date.
(models-module ns-name block)The Lean module that the block block imports for the functions of its
(clojure f ...).
The Lean module that the block `block` imports for the functions of its `(clojure f ...)`.
(module-name ns-name block)Lean module of the block block in the Clojure namespace ns-name.
Lean module of the block `block` in the Clojure namespace `ns-name`.
(options ns block opts body)deflean options of the block block in the namespace ns: :uses of other
blocks (ns/block, or block of the same namespace) becomes imports and
opens of their modules, and a body with (clojure f ...) imports Clj and
the models of the functions.
deflean options of the block `block` in the namespace `ns`: `:uses` of other blocks (`ns/block`, or `block` of the same namespace) becomes imports and opens of their modules, and a body with `(clojure f ...)` imports `Clj` and the models of the functions.
(out-of-date ns-name block)The exception for a block whose generated code is missing or that of another source.
The exception for a block whose generated code is missing or that of another source.
(read-forms text)The forms of the Clojure source text, read without evaluating code.
The forms of the Clojure source `text`, read without evaluating code.
(render ns block body)The body of deflean block block in the namespace ns: :source, its
Lean source, and :parts, the source of each form. Strings are Lean source
(dedented), (clojure f ...) is a comment, since the models of the functions
are in another module, and other forms are commands of leanfran.dsl, whose
structures and enumerations are recorded in leanfran.types/types.
The body of deflean block `block` in the namespace `ns`: `:source`, its Lean source, and `:parts`, the source of each form. Strings are Lean source (dedented), `(clojure f ...)` is a comment, since the models of the functions are in another module, and other forms are commands of `leanfran.dsl`, whose structures and enumerations are recorded in `leanfran.types/types`.
(sha256 s)The SHA-256 hash of the text s.
The SHA-256 hash of the text `s`.
(surroundings module {:keys [imports opens]})The Lean source before and after the body of the module module of a block
with the options opts: [prelude postlude].
The Lean source before and after the body of the module `module` of a block with the options `opts`: `[prelude postlude]`.
(uses ns opts)The blocks of the option :uses of a block in the namespace ns: :ns,
:block and :module.
The blocks of the option `:uses` of a block in the namespace `ns`: `:ns`, `:block` and `:module`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |