Dataset Viewer
Auto-converted to Parquet Duplicate
statement
stringlengths
1
1.08k
proof
stringlengths
0
2.65k
type
stringclasses
10 values
symbolic_name
stringlengths
1
55
library
stringclasses
9 values
filename
stringclasses
39 values
imports
listlengths
0
4
deps
listlengths
0
8
docstring
stringlengths
0
1.82k
source_url
stringclasses
1 value
commit
stringclasses
1 value
widgetDir : FilePath
"widget"
def
widgetDir
Root
lakefile.lean
[ "Lake" ]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Lake.Package.widgetDir (pkg : Package) : FilePath
pkg.dir / widgetDir
def
Lake.Package.widgetDir
Root
lakefile.lean
[ "Lake" ]
[ "widgetDir" ]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Lake.Package.runNpmCommand (pkg : Package) (args : Array String) : LogIO Unit
-- Running `cmd := "npm.cmd"` directly fails on Windows sometimes -- (https://github.com/leanprover-community/ProofWidgets4/issues/97) -- so run in PowerShell instead (`cmd.exe` also doesn't work.) if Platform.isWindows then proc { cmd := "powershell" args := #["-Command", "npm.cmd"] ++ args ...
def
Lake.Package.runNpmCommand
Root
lakefile.lean
[ "Lake" ]
[ "widgetDir" ]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
widgetJsAllTarget (pkg : Package) (isDev : Bool) : FetchM (Job Unit)
do let srcs ← widgetJsSrcs.fetch let rollupConfig ← widgetRollupConfig.fetch let tsconfig ← widgetTsconfig.fetch let widgetPackageLock ← widgetPackageLock.fetch srcs.bindM (sync := true) fun _ => rollupConfig.bindM (sync := true) fun _ => tsconfig.bindM (sync := true) fun _ => widgetPackageLock.mapM fun...
def
widgetJsAllTarget
Root
lakefile.lean
[ "Lake" ]
[]
Target to build all widget modules from `widgetJsSrcs`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
RequestId
Nat
abbrev
ProofWidgets.RequestId
Root
ProofWidgets/Cancellable.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
CancellableTask where task : Task (Except RequestError (LazyEncodable Json)) /- Note: we cannot just `IO.cancel task` because it is a result of `map`. See https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Should.20cancelling.20a.20purely.20mapped.20task.20cancel.20the.20original.3F -/ cancel : ...
structure
ProofWidgets.CancellableTask
Root
ProofWidgets/Cancellable.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
mkCancellable [RpcEncodable β] (handler : α → RequestM (RequestTask β)) : α → RequestM (RequestTask RequestId)
fun a => do RequestM.asTask do let t ← handler a let t' := t.mapCheap (·.map rpcEncode) runningRequests.modifyGet fun (id, m) => (id, (id+1, m.insert id ⟨t'.task, t.cancel⟩))
def
ProofWidgets.mkCancellable
Root
ProofWidgets/Cancellable.lean
[]
[]
Transforms a request handler returning `β` into one that returns immediately with a `RequestId`. The ID uniquely identifies the running request: its results can be retrieved using `checkRequest`, and it can be cancelled using `cancelRequest`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
cancelRequest (rid : RequestId) : RequestM (RequestTask Unit)
do RequestM.asTask do let t? ← runningRequests.modifyGet fun (id, m) => (m[rid]?, (id, m.erase rid)) if let some t := t? then t.cancel
def
ProofWidgets.cancelRequest
Root
ProofWidgets/Cancellable.lean
[]
[]
Cancel the request with ID `rid`. Does nothing if `rid` is invalid.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
CheckRequestResponse | running | done (result : LazyEncodable Json) deriving RpcEncodable
inductive
ProofWidgets.CheckRequestResponse
Root
ProofWidgets/Cancellable.lean
[]
[]
The status of a running cancellable request.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
checkRequest (rid : RequestId) : RequestM (RequestTask CheckRequestResponse)
do RequestM.asTask do let (_, m) ← runningRequests.get match m[rid]? with | none => throw $ RequestError.invalidParams s!"Request '{rid}' has already finished, or the ID is invalid." | some t => if !(← IO.hasFinished t.task) then return .running runningRequests.modify...
def
ProofWidgets.checkRequest
Root
ProofWidgets/Cancellable.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
cancellableSuffix : Name
`_cancellable
def
ProofWidgets.cancellableSuffix
Root
ProofWidgets/Cancellable.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LazyEncodable α
StateM RpcObjectStore α
abbrev
ProofWidgets.LazyEncodable
Root
ProofWidgets/Compat.lean
[]
[]
See `RpcEncodable`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ExprWithCtx where ci : Elab.ContextInfo lctx : LocalContext linsts : LocalInstances expr : Expr deriving TypeName
structure
ProofWidgets.ExprWithCtx
Root
ProofWidgets/Compat.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ExprWithCtx.runMetaM (e : ExprWithCtx) (x : Expr → MetaM α) : IO α
e.ci.runMetaM {} $ Meta.withLCtx e.lctx e.linsts (x e.expr)
def
ProofWidgets.ExprWithCtx.runMetaM
Root
ProofWidgets/Compat.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ExprWithCtx.save (e : Expr) : MetaM ExprWithCtx
return { ci := { ← CommandContextInfo.save with } lctx := ← getLCtx linsts := ← Meta.getLocalInstances expr := e }
def
ProofWidgets.ExprWithCtx.save
Root
ProofWidgets/Compat.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
joinArrays {m} [Monad m] [MonadRef m] [MonadQuotation m] (arr : Array Term) : m Term
do if h : 0 < arr.size then arr.foldlM (fun x xs => `($x ++ $xs)) arr[0] (start := 1) else `(#[])
def
ProofWidgets.Util.joinArrays
Root
ProofWidgets/Util.lean
[]
[]
Sends `#[a, b, c]` to `` `(term| $a ++ $b ++ $c)``
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
foldInlsM {m} [Monad m] (arr : Array (α ⊕ β)) (f : Array α → m β) : m (Array β)
do let mut ret : Array β := #[] let mut pending_inls : Array α := #[] for c in arr do match c with | .inl ci => pending_inls := pending_inls.push ci | .inr cis => if pending_inls.size ≠ 0 then ret := ret.push <| ← f pending_inls pending_inls := #[] ret := ret.push cis ...
def
ProofWidgets.Util.foldInlsM
Root
ProofWidgets/Util.lean
[]
[]
Collapse adjacent `inl (_ : α)`s into a `β` using `f`. For example, `#[.inl a₁, .inl a₂, .inr b, .inl a₃] ↦ #[← f #[a₁, a₂], b, ← f #[a₃]]`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
delabListLiteral {α} (elem : DelabM α) : DelabM (Array α)
go #[] where go (acc : Array α) : DelabM (Array α) := do match_expr ← getExpr with | List.nil _ => return acc | List.cons _ _ _ => let hd ← withNaryArg 1 elem withNaryArg 2 $ go (acc.push hd) | _ => failure
def
Lean.PrettyPrinter.Delaborator.delabListLiteral
Root
ProofWidgets/Util.lean
[]
[]
Delaborate the elements of a list literal separately, calling `elem` on each.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
delabArrayLiteral {α} (elem : DelabM α) : DelabM (Array α)
do match_expr ← getExpr with | List.toArray _ _ => withNaryArg 1 <| delabListLiteral elem | _ => failure
def
Lean.PrettyPrinter.Delaborator.delabArrayLiteral
Root
ProofWidgets/Util.lean
[]
[]
Delaborate the elements of an array literal separately, calling `elem` on each.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
annotateTermLikeInfo (stx : TSyntax n) : DelabM (TSyntax n)
do let stx ← annotateCurPos ⟨stx⟩ addTermInfo (← getPos) stx (← getExpr) pure ⟨stx⟩
def
Lean.PrettyPrinter.Delaborator.annotateTermLikeInfo
Root
ProofWidgets/Util.lean
[]
[]
A copy of `Delaborator.annotateTermInfo` for other syntactic categories.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
withAnnotateTermLikeInfo (d : DelabM (TSyntax n)) : DelabM (TSyntax n)
do let stx ← d annotateTermLikeInfo stx
def
Lean.PrettyPrinter.Delaborator.withAnnotateTermLikeInfo
Root
ProofWidgets/Util.lean
[]
[]
A copy of `Delaborator.withAnnotateTermInfo` for other syntactic categories.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MonadSaveCtx (m : Type → Type) (n : outParam <| Type → Type) where /-- Transform an action `x : m α` into an action `m (n α)` that - saves the current context/state of `m`; and - returns an action `y : n α` that would use the saved context/state if run. Note that because `y` no longer has access to `m`'s stat...
class
MonadSaveCtx
Root
ProofWidgets/Util.lean
[]
[]
Certain monad transformers such as `ReaderT` and `StateT`/`StateRefT` provide additional *context* (read-only) and *state* (mutable). `MonadSaveCtx m n` means that `m` is a stack of contexts/states on top of `n`. It provides a way to suspend an `m`-action by saving the "current" value of this stack. For example, `m = ...
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Component (Props : Type) extends Widget.Module where /-- Which export of the module to use as the component function. -/ «export» : String
"default"
structure
ProofWidgets.Component
Component
ProofWidgets/Component/Basic.lean
[]
[]
A component is a widget module with a `default` or named export which is a [React component](https://react.dev/learn/your-first-component). Every component definition must be annotated with `@[widget_module]`. This makes it possible for the infoview to load the component. ## Execution environment The JS environment i...
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveCodeProps where fmt : Widget.CodeWithInfos deriving Server.RpcEncodable
structure
ProofWidgets.InteractiveCodeProps
Component
ProofWidgets/Component/Basic.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveCode : Component InteractiveCodeProps
where javascript := " import { InteractiveCode } from '@leanprover/infoview' import * as React from 'react' export default function(props) { return React.createElement(InteractiveCode, props) }"
def
ProofWidgets.InteractiveCode
Component
ProofWidgets/Component/Basic.lean
[]
[]
Present pretty-printed code as interactive text. The most common use case is to instantiate this component from a `Lean.Expr`. To do so, you must eagerly pretty-print the `Expr` using `Widget.ppExprTagged`. See also `InteractiveExpr`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveExprProps where expr : Server.WithRpcRef ExprWithCtx deriving Server.RpcEncodable
structure
ProofWidgets.InteractiveExprProps
Component
ProofWidgets/Component/Basic.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ppExprTagged : InteractiveExprProps → Server.RequestM (Server.RequestTask Widget.CodeWithInfos)
| ⟨ref⟩ => Server.RequestM.asTask <| ref.val.runMetaM Widget.ppExprTagged
def
ProofWidgets.ppExprTagged
Component
ProofWidgets/Component/Basic.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveExpr : Component InteractiveExprProps
where javascript := include_str ".." / ".." / "widget" / "js" / "interactiveExpr.js"
def
ProofWidgets.InteractiveExpr
Component
ProofWidgets/Component/Basic.lean
[]
[]
Lazily pretty-print and present a `Lean.Expr` as interactive text. This component is preferrable over `InteractiveCode` when the `Expr` will not necessarily be displayed in the UI (e.g. it may be hidden by default), in which case laziness saves some work. On the other hand if the `Expr` will likely be shown and you ar...
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveMessageProps where msg : Server.WithRpcRef MessageData deriving Server.RpcEncodable
structure
ProofWidgets.InteractiveMessageProps
Component
ProofWidgets/Component/Basic.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveMessage : Component InteractiveMessageProps
where javascript := " import { InteractiveMessageData } from '@leanprover/infoview' import * as React from 'react' export default function(props) { return React.createElement(InteractiveMessageData, props) } "
def
ProofWidgets.InteractiveMessage
Component
ProofWidgets/Component/Basic.lean
[]
[]
Present a structured Lean message.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MarkdownDisplay.Props where contents : String deriving ToJson, FromJson
structure
ProofWidgets.MarkdownDisplay.Props
Component
ProofWidgets/Component/Basic.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MarkdownDisplay : Component MarkdownDisplay.Props
where javascript := " import { Markdown } from '@leanprover/infoview' import * as React from 'react' export default (props) => React.createElement(Markdown, props) "
def
ProofWidgets.MarkdownDisplay
Component
ProofWidgets/Component/Basic.lean
[]
[]
Render a given string as Markdown. LaTeX is supported with MathJax: use `$...$` for inline math, and `$$...$$` for displayed math. Example usage: ```lean <MarkdownDisplay contents={"$a + b = c$"} /> ```
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Lean.MessageData.ofComponent [Server.RpcEncodable Props] (c : ProofWidgets.Component Props) (p : Props) (alt : String) : CoreM MessageData
do let wi ← Widget.WidgetInstance.ofHash c.javascriptHash (Server.RpcEncodable.rpcEncode p) return .ofWidget wi alt
def
Lean.MessageData.ofComponent
Component
ProofWidgets/Component/Basic.lean
[]
[ "ProofWidgets.Component" ]
Construct a structured message from a ProofWidgets component. For the meaning of `alt`, see `MessageData.ofWidget`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
FilterDetailsProps where /-- Contents of the `<summary>`. -/ summary : Html /-- What is shown in the filtered state. -/ filtered : Html /-- What is shown in the non-filtered state. -/ all : Html /-- Whether to start in the filtered state. -/ initiallyFiltered : Bool
true deriving Server.RpcEncodable
structure
ProofWidgets.FilterDetailsProps
Component
ProofWidgets/Component/FilterDetails.lean
[]
[]
Props for the `FilterDetails` component.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
FilterDetails : Component FilterDetailsProps
where javascript := include_str ".." / ".." / "widget" / "js" / "filterDetails.js"
def
ProofWidgets.FilterDetails
Component
ProofWidgets/Component/FilterDetails.lean
[]
[]
The `FilterDetails` component is like a `<details>` HTML element, but also has a filter button that allows you to switch between filtered and unfiltered states.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
mkCircle (attrs : Array (String × Json) := #[]) : Html
<circle r={5} fill="var(--vscode-editor-background)" stroke="var(--vscode-editor-foreground)" strokeWidth={.num 1.5} {...attrs} />
def
ProofWidgets.GraphDisplay.mkCircle
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
A themed `<circle>` SVG element, with optional extra attributes.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
BoundingShape where /-- A circle of fixed radius. -/ | circle (radius : Float) : BoundingShape /-- A rectangle of fixed dimensions. -/ | rect (width height : Float) : BoundingShape deriving Inhabited, FromJson, ToJson
inductive
ProofWidgets.GraphDisplay.BoundingShape
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Vertex where /-- Identifier for this vertex. Must be unique. -/ id : String /-- The label is drawn at the vertex position. This must be an SVG element. Use `<foreignObject>` to draw non-SVG elements. -/ label : Html
mkCircle boundingShape : BoundingShape := .circle 5 /-- Details are shown below the graph display after the vertex label has been clicked. See also `Props.showDetails`. -/ details? : Option Html := none deriving Inhabited, RpcEncodable
structure
ProofWidgets.GraphDisplay.Vertex
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Edge where /-- Source vertex. Must match the `id` of one of the vertices. -/ source : String /-- Target vertex. Must match the `id` of one of the vertices. -/ target : String /-- Extra attributes to set on the SVG `<line>` element representing this edge. See also `Props.defaultEdgeAttrs`. -/ attrs : Array...
#[] /-- If present, the label is shown over the edge midpoint. This must be an SVG element. Use `<foreignObject>` to draw non-SVG elements. -/ label? : Option Html := none /-- Details are shown below the graph display after the edge has been clicked. See also `Props.showDetails`. -/ details? : Option Ht...
structure
ProofWidgets.GraphDisplay.Edge
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceCenterParams where x? : Option Float
none y? : Option Float := none strength? : Option Float := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceCenterParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceCollideParams where radius? : Option Float
none strength? : Option Float := none iterations? : Option Nat := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceCollideParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceLinkParams where distance? : Option Float
none strength? : Option Float := none iterations? : Option Nat := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceLinkParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceManyBodyParams where strength? : Option Float
none theta? : Option Float := none distanceMin? : Option Float := none distanceMax? : Option Float := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceManyBodyParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceXParams where x? : Option Float
none strength? : Option Float := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceXParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceYParams where y? : Option Float
none strength? : Option Float := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceYParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceRadialParams where radius : Float x? : Option Float
none y? : Option Float := none strength? : Option Float := none deriving Inhabited, FromJson, ToJson
structure
ProofWidgets.GraphDisplay.ForceRadialParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ForceParams where | center : ForceCenterParams → ForceParams | collide : ForceCollideParams → ForceParams | link : ForceLinkParams → ForceParams | manyBody : ForceManyBodyParams → ForceParams | x : ForceXParams → ForceParams | y : ForceYParams → ForceParams | radial : ForceRadialParams → ForceParams der...
inductive
ProofWidgets.GraphDisplay.ForceParams
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
Settings for the simulation of forces on vertices. See https://d3js.org/d3-force.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Props where vertices : Array Vertex /-- At most one edge may exist between any two vertices. Self-loops are allowed, but (TODO) are currently not rendered well. -/ edges : Array Edge /-- Attributes to set by default on `<line>` elements representing edges. -/ defaultEdgeAttrs : Array (String × Json)
#[ ("fill", "var(--vscode-editor-foreground)"), ("stroke", "var(--vscode-editor-foreground)"), ("strokeWidth", 2), ("markerEnd", "url(#arrow)") ] /-- Which forces to apply to the vertices. Most force parameters are optional, using default values if not specified. -/ forces : Array ForceParams :=...
structure
ProofWidgets.GraphDisplay.Props
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
GraphDisplay : Component GraphDisplay.Props
where javascript := include_str ".." / ".." / "widget" / "js" / "d3Graph.js"
def
GraphDisplay
Component
ProofWidgets/Component/GraphDisplay.lean
[]
[]
Display a graph with an interactive force simulation.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
HtmlDisplayProps where html : Html deriving RpcEncodable
structure
ProofWidgets.HtmlDisplayProps
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
HtmlDisplay : Component HtmlDisplayProps
where javascript := include_str ".." / ".." / "widget" / "js" / "htmlDisplay.js"
def
ProofWidgets.HtmlDisplay
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
HtmlDisplayPanel : Component HtmlDisplayProps
where javascript := include_str ".." / ".." / "widget" / "js" / "htmlDisplayPanel.js"
def
ProofWidgets.HtmlDisplayPanel
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
HtmlEval (α : Type u) where eval : α → CommandElabM Html
class
ProofWidgets.HtmlEval
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
Any term `t : α` with a `HtmlEval α` instance can be evaluated in a `#html t` command. This is analogous to how `Lean.MetaEval` supports `#eval`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
evalCommandMHtmlUnsafe (stx : Term) : TermElabM (CommandElabM Html)
do let tp := mkApp (mkConst ``CommandElabM) (mkConst ``Html) Term.evalTerm _ tp stx
def
ProofWidgets.HtmlCommand.evalCommandMHtmlUnsafe
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
evalCommandMHtml : Term → TermElabM (CommandElabM Html)
opaque
ProofWidgets.HtmlCommand.evalCommandMHtml
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
elabHtmlCmd : CommandElab
fun | stx@`(#html $t:term) => do let htX ← liftTermElabM <| evalCommandMHtml <| ← ``(HtmlEval.eval $t) let ht ← htX liftCoreM <| Widget.savePanelWidgetInfo (hash HtmlDisplayPanel.javascript) (return json% { html: $(← rpcEncode ht) }) stx | stx => throwError "Unexpected syntax {stx}."
def
ProofWidgets.HtmlCommand.elabHtmlCmd
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Lean.MessageData.ofHtml (h : ProofWidgets.Html) (alt : String) : CoreM MessageData
MessageData.ofComponent ProofWidgets.HtmlDisplay ⟨h⟩ alt
def
Lean.MessageData.ofHtml
Component
ProofWidgets/Component/HtmlDisplay.lean
[]
[ "ProofWidgets.Html", "ProofWidgets.HtmlDisplay" ]
Construct a structured message from ProofWidgets HTML. For the meaning of `alt`, see `MessageData.ofWidget`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
_root_.Float.toInt (x : Float) : Int
if x >= 0 then x.toUInt64.toNat else -((-x).toUInt64.toNat)
def
Float.toInt
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ActionKind where | timeout | mousedown | mouseup | mousemove -- [note] mouse moves only happen when mouse button is down. deriving ToJson, FromJson, DecidableEq
inductive
ProofWidgets.Svg.ActionKind
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Action where kind : ActionKind id : Option String data : Option Json deriving ToJson, FromJson
structure
ProofWidgets.Svg.Action
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
SvgState (State : Type) where state : State time : Float /-- time in milliseconds -/ selected : Option String mousePos : Option (Int × Int) idToData : List (String × Json) deriving ToJson, FromJson, Server.RpcEncodable
structure
ProofWidgets.Svg.SvgState
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[ "State" ]
The input type `State` is any state the user wants to use and update SvgState in addition automatically handles tracking of time, selection and custom data
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
UpdateParams (State : Type) where elapsed : Float actions : Array Action state : SvgState State mousePos : Option (Float × Float) -- TODO: change to Option (Int × Int) or do we want to support subpixel precision? deriving ToJson, FromJson
structure
ProofWidgets.Svg.UpdateParams
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[ "State" ]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
UpdateResult (State : Type) where html : Html state : SvgState State /-- Approximate number of milliseconds to wait before calling again. -/ callbackTime : Option Float
some 33 deriving Server.RpcEncodable
structure
ProofWidgets.Svg.UpdateResult
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[ "State" ]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveSvg (State : Type) where init : State frame : Svg.Frame update (time_ms Δt_ms : Float) (action : Action) (mouseStart mouseEnd : Option (Svg.Point frame)) (selectedId : Option String) (getSelectedData : (α : Type) → [FromJson α] → Option α) : State → State render (time_ms : ...
structure
ProofWidgets.Svg.InteractiveSvg
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[ "State", "frame", "init" ]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
InteractiveSvg.serverRpcMethod {State : Type} (isvg : InteractiveSvg State) (params : UpdateParams State) : RequestM (RequestTask (UpdateResult State))
do -- Ideally, each action should have time and mouse position attached -- right now we just assume that all actions are uqually spaced within the frame let Δt := (params.elapsed - params.state.time) / params.actions.size.toFloat let idToData : Std.HashMap String Json := HashMap.ofList params.state.idToData ...
def
ProofWidgets.Svg.InteractiveSvg.serverRpcMethod
Component
ProofWidgets/Component/InteractiveSvg.lean
[]
[ "State", "isvg" ]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Lean.Lsp.Position.advance (p : Position) (s : Substring.Raw) : Position
let (nLinesAfter, lastLineUtf16Sz) := s.foldl (init := (0, 0)) fun (n, l) c => if c == '\n' then (n + 1, 0) else (n, l + c.utf16Size.toNat) { line := p.line + nLinesAfter character := (if nLinesAfter == 0 then p.character else 0) + lastLineUtf16Sz }
def
Lean.Lsp.Position.advance
Component
ProofWidgets/Component/MakeEditLink.lean
[]
[ "init" ]
Assuming that `s` is the content of a file starting at position `p`, advance `p` to the end of `s`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MakeEditLinkProps where /-- The edit to perform on the file. -/ edit : Lsp.TextDocumentEdit /-- Which textual range to select after the edit. The range is interpreted in the file that `edit` applies to. If present and `start == end`, the cursor is moved to `start` and nothing is selected. If not present, th...
none /-- The `title` property, if any, to set on the displayed `<a>` link. -/ title? : Option String := none deriving FromJson, ToJson
structure
ProofWidgets.MakeEditLinkProps
Component
ProofWidgets/Component/MakeEditLink.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MakeEditLinkProps.ofReplaceRange' (doc : Server.DocumentMeta) (range : Lsp.Range) (newText : String) (newSelection? : Option Lsp.Range := none) : MakeEditLinkProps
let edit := { textDocument := { uri := doc.uri, version? := doc.version } edits := #[{ range, newText }] } if newSelection?.isSome then { edit, newSelection? } else let endPos := range.start.advance newText.toRawSubstring { edit, newSelection? := some { start := endPos, «end» := e...
def
ProofWidgets.MakeEditLinkProps.ofReplaceRange'
Component
ProofWidgets/Component/MakeEditLink.lean
[]
[]
Replace `range` with `newText`. If `newSelection?` is absent, place the cursor at the end of the new text. If `newSelection?` is present, make the specified selection instead. See also `MakeEditLinkProps.ofReplaceRange`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MakeEditLinkProps.ofReplaceRange (doc : Server.DocumentMeta) (range : Lsp.Range) (newText : String) (newSelection? : Option (String.Pos.Raw × String.Pos.Raw) := none) : MakeEditLinkProps
ofReplaceRange' doc range newText (newSelection?.map fun (s, e) => let ps := range.start.advance (newText.toRawSubstring.extract 0 s) let pe := ps.advance (newText.toRawSubstring.extract s e) { start := ps, «end» := pe })
def
ProofWidgets.MakeEditLinkProps.ofReplaceRange
Component
ProofWidgets/Component/MakeEditLink.lean
[]
[]
Replace `range` with `newText`. If `newSelection?` is absent, place the cursor at the end of the new text. If `newSelection?` is present, select the range it specifies within `newText`. See also `MakeEditLinkProps.ofReplaceRange'`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
MakeEditLink : Component MakeEditLinkProps
where javascript := include_str ".." / ".." / "widget" / "js" / "makeEditLink.js"
def
ProofWidgets.MakeEditLink
Component
ProofWidgets/Component/MakeEditLink.lean
[]
[]
A link that, when clicked, makes the specified edit and potentially moves the cursor or makes a selection.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
ofRpcMethodTemplate
include_str ".." / ".." / "widget" / "js" / "ofRpcMethod.js"
def
ProofWidgets.ofRpcMethodTemplate
Component
ProofWidgets/Component/OfRpcMethod.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
"mk_rpc_widget%" fn:term : term <= expectedType => do let α ← mkFreshExprMVar (some (.sort .one)) (userName := `α) let compT ← mkAppM ``Component #[α] if !(← isDefEq expectedType compT) then throwError "expected type{indentD expectedType}\nis not of the form{indentD compT}" let arr ← mkArrow α (← mkAppM ``R...
fn then let cancellableNm := nm ++ cancellableSuffix if (← existsBuiltinRpcProcedure cancellableNm) || userRpcProcedures.contains (← getEnv) cancellableNm then -- Use the cancellable variant if possible. let code : StrLit := quote $ ofRpcMethodTemplate |>.replace "$RPC_METHOD" (toString canc...
elab
mk_rpc_widget%
Component
ProofWidgets/Component/OfRpcMethod.lean
[]
[ "fn" ]
The elaborator `mk_rpc_widget%` allows writing certain widgets in Lean instead of JavaScript. Specifically, it translates an RPC method of type `MyProps → RequestM (RequestTask Html)` into a widget component of type `Component MyProps`. Even more specifically, we can write: ```lean open Lean Server structure MyProps ...
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
DiagramProps where embeds : Array (String × Html) dsl : String sty : String sub : String /-- Maximum number of optimization steps to take before showing the diagram. Optimization may converge earlier, before taking this many steps. -/ maxOptSteps : Nat
500 deriving Inhabited, RpcEncodable
structure
ProofWidgets.Penrose.DiagramProps
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Diagram : Component DiagramProps
where javascript := include_str ".." / ".." / "widget" / "js" / "penroseDisplay.js"
def
ProofWidgets.Penrose.Diagram
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Displays the given diagram using [Penrose](https://penrose.cs.cmu.edu/). The website contains explanations of how to write domain (`dsl`), style (`sty`), and substance (`sub`) programs. The diagram may also contain embedded HTML trees which are specified in `embeds`. Each embed is HTML together with the name of an obj...
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
DiagramState where /-- The Penrose substance program. Note that `embeds` are added lazily at the end. -/ sub : String
"" /-- Components to display as labels in the diagram, stored in the map as name ↦ (type, html). -/ embeds : Std.HashMap String (String × Html) := ∅
structure
ProofWidgets.Penrose.DiagramState
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
DiagramBuilderM
StateT DiagramState MetaM
abbrev
ProofWidgets.Penrose.DiagramBuilderM
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
A monad to easily build Penrose diagrams in.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
buildDiagram (dsl sty : String) (maxOptSteps : Nat := 500) : DiagramBuilderM (Option Html)
do let st ← get if st.sub == "" && st.embeds.isEmpty then return none let mut sub := "AutoLabel All\n" let mut embedHtmls := #[] for (n, (tp, h)) in st.embeds.toArray do sub := sub ++ s!"{tp} {n}\n" embedHtmls := embedHtmls.push (n, h) -- Note: order matters here, embed variables are declared fi...
def
ProofWidgets.Penrose.DiagramBuilderM.buildDiagram
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Assemble the diagram using the provided domain and style programs. `none` is returned iff nothing was added to the diagram.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
addEmbed (nm : String) (tp : String) (h : Html) : DiagramBuilderM Unit
do modify fun st => { st with embeds := st.embeds.insert nm (tp, h) }
def
ProofWidgets.Penrose.DiagramBuilderM.addEmbed
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Add an object `nm` of Penrose type `tp`, labelled by `h`, to the substance program.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
addExpr (tp : String) (e : Expr) : DiagramBuilderM String
do let nm ← toString <$> Lean.Meta.ppExpr e let h := <InteractiveCode fmt={← Widget.ppExprTagged e} /> addEmbed nm tp h return nm
def
ProofWidgets.Penrose.DiagramBuilderM.addExpr
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Add an object of Penrose type `tp`, corresponding to (and labelled by) the expression `e`, to the substance program. Return its Penrose name.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
addInstruction (i : String) : DiagramBuilderM Unit
do modify fun st => { st with sub := st.sub ++ s!"{i}\n" }
def
ProofWidgets.Penrose.DiagramBuilderM.addInstruction
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Add an instruction `i` to the substance program.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
run (x : DiagramBuilderM α) : MetaM α
x.run' {}
def
ProofWidgets.Penrose.DiagramBuilderM.run
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
PenroseDiagramProps
Penrose.DiagramProps
abbrev
PenroseDiagramProps
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Abbreviation for backwards-compatibility.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
PenroseDiagram
Penrose.Diagram
abbrev
PenroseDiagram
Component
ProofWidgets/Component/PenroseDiagram.lean
[]
[]
Abbreviation for backwards-compatibility.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Recharts : Widget.Module
where javascript := include_str ".." / ".." / "widget" / "js" / "recharts.js"
def
ProofWidgets.Recharts.Recharts
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineChartLayout where | horizontal | vertical deriving FromJson, ToJson
inductive
ProofWidgets.Recharts.LineChartLayout
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineChartSyncMethod where | index | value deriving FromJson, ToJson
inductive
ProofWidgets.Recharts.LineChartSyncMethod
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineChartMargin where top : Nat
5 right : Nat := 5 bottom : Nat := 5 left : Nat := 5 deriving FromJson, ToJson
structure
ProofWidgets.Recharts.LineChartMargin
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineChartProps where layout : LineChartLayout
.horizontal syncId? : Option String := none syncMethod? : Option LineChartSyncMethod := some .index width : Nat height : Nat data : Array Json margin : LineChartMargin := {} deriving FromJson, ToJson
structure
ProofWidgets.Recharts.LineChartProps
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineChart : Component LineChartProps
where javascript := Recharts.javascript «export» := "LineChart"
def
ProofWidgets.Recharts.LineChart
Component
ProofWidgets/Component/Recharts.lean
[]
[]
See https://recharts.org/en-US/api/LineChart.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
AxisType where /-- Treat values as numbers: spacing on axis by numeric difference. -/ | number /-- Treat values as categorical: equal spacing between values. -/ | category deriving FromJson, ToJson
inductive
ProofWidgets.Recharts.AxisType
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
AxisProps where dataKey? : Option Json
none domain? : Option (Array Json) := none allowDataOverflow : Bool := false /-- How values along this axis should be interpreted. The Recharts default is `category`. -/ type : AxisType := .number -- TODO: There are many more props deriving FromJson, ToJson
structure
ProofWidgets.Recharts.AxisProps
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
XAxis : Component AxisProps
where javascript := Recharts.javascript «export» := "XAxis"
def
ProofWidgets.Recharts.XAxis
Component
ProofWidgets/Component/Recharts.lean
[]
[]
See https://recharts.org/en-US/api/XAxis.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
YAxis : Component AxisProps
where javascript := Recharts.javascript «export» := "YAxis"
def
ProofWidgets.Recharts.YAxis
Component
ProofWidgets/Component/Recharts.lean
[]
[]
See https://recharts.org/en-US/api/YAxis.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineType where | basis | basisClosed | basisOpen | linear | linearClosed | natural | monotoneX | monotoneY | monotone | step | stepBefore | stepAfter deriving FromJson, ToJson
inductive
ProofWidgets.Recharts.LineType
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
LineProps where type : LineType
.linear dataKey : Json stroke : String dot? : Option Bool := none -- TODO: There are many more props deriving FromJson, ToJson
structure
ProofWidgets.Recharts.LineProps
Component
ProofWidgets/Component/Recharts.lean
[]
[]
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
Line : Component LineProps
where javascript := Recharts.javascript «export» := "Line"
def
ProofWidgets.Recharts.Line
Component
ProofWidgets/Component/Recharts.lean
[]
[]
See https://recharts.org/en-US/api/Line.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
IO.forceThunk (t : Thunk α) : BaseIO α
return t.get
opaque
IO.forceThunk
Component
ProofWidgets/Component/RefreshComponent.lean
[]
[]
An effectful wrapper around `Thunk.get` analogous to `IO.wait`. Unlike `Thunk.get`, the compiler should never move this out of a `do` block.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
VersionedHtml where html : Html idx : Nat deriving RpcEncodable
structure
ProofWidgets.RefreshComponent.VersionedHtml
Component
ProofWidgets/Component/RefreshComponent.lean
[]
[]
A HTML tree together with a version number. We use this to check whether the tree currently on display is up to date.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
RefreshState where /-- The HTML tree to display, stored as a delayed computation. We only force the thunk when the client requests it. This means that if several updates arrive in quick succession, only the ones that the client actually sees will be computed. -/ curr : Thunk Html /-- Version of the current...
structure
ProofWidgets.RefreshComponent.RefreshState
Component
ProofWidgets/Component/RefreshComponent.lean
[]
[]
The server-side state of a `RefreshComponent`.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
RefreshRef where ref : IO.Ref RefreshState deriving TypeName
structure
ProofWidgets.RefreshComponent.RefreshRef
Component
ProofWidgets/Component/RefreshComponent.lean
[]
[]
A reference to a `RefreshState`. Only exists because `TypeName` is not derivable for compound types.
https://github.com/leanprover-community/ProofWidgets4
85bb7e7637e84a7d9803be7d954579fdae42c64b
End of preview. Expand in Data Studio

Lean4-ProofWidgets

Structured dataset from ProofWidgets4 — Interactive proof widgets.

Source

Schema

Column Type Description
statement string Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof
proof string Verbatim proof/body, empty if the declaration has none
type string Declaration keyword
symbolic_name string Declaration identifier
library string Sub-library
filename string Repository-relative source path
imports list[string] File-level Require/Import modules
deps list[string] Intra-corpus identifiers referenced
docstring string Preceding documentation comment, empty if absent
source_url string Upstream repository
commit string Upstream commit extracted

Statistics

  • Entries: 306
  • With proof: 244 (79.7%)
  • With docstring: 92 (30.1%)
  • Libraries: 9

By type

Type Count
def 206
structure 59
inductive 17
abbrev 8
elab 5
opaque 4
class 3
axiom 2
macro 1
theorem 1

Example

mkCancellable [RpcEncodable β] (handler : α → RequestM (RequestTask β)) :
    α → RequestM (RequestTask RequestId)
fun a => do
  RequestM.asTask do
    let t ← handler a
    let t' := t.mapCheap (·.map rpcEncode)
    runningRequests.modifyGet fun (id, m) =>
      (id, (id+1, m.insert id ⟨t'.task, t.cancel⟩))
  • type: def | symbolic_name: ProofWidgets.mkCancellable | ProofWidgets/Cancellable.lean

Use

Each declaration is split into a statement (signature/claim) and a proof (body) that are disjoint and together form the complete declaration, for proof modeling, autoformalization, retrieval, and dependency analysis via deps.

Citation

@misc{lean4_proofwidgets_dataset,
  title  = {Lean4-ProofWidgets},
  author = {Norton, Charles},
  year   = {2026},
  note   = {Extracted from https://github.com/leanprover-community/ProofWidgets4, commit 85bb7e7637e8},
  url    = {https://huggingface.co/datasets/phanerozoic/Lean4-ProofWidgets}
}
Downloads last month
69

Collection including phanerozoic/Lean4-ProofWidgets