File: .lake/packages/proofwidgets/ProofWidgets/Component/PenroseDiagram.lean

full_name: ProofWidgets.Penrose.DiagramProps.maxOptSteps
code: structure 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
goal: Nat

full_name: ProofWidgets.Penrose.instInhabitedDiagramProps
code: structure 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
goal: Inhabited ProofWidgets.Penrose.DiagramProps

full_name: ProofWidgets.Penrose.DiagramProps
code: structure 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
goal: Type

full_name: ProofWidgets.Penrose.DiagramProps.sub
code: structure 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
goal: String

full_name: ProofWidgets.Penrose.DiagramProps.dsl
code: structure 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
goal: String

full_name: ProofWidgets.Penrose.DiagramProps.embeds
code: structure 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
goal: Array (String × ProofWidgets.Html)

full_name: ProofWidgets.Penrose.DiagramProps.sty
code: structure 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
goal: String

full_name: ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.instRpcEncodableDiagramProps.enc._@..lake.packages.proofwidgets.ProofWidgets.Component.PenroseDiagram._hyg.4
code: RpcEncodable
goal: ProofWidgets.Penrose.DiagramProps → StateM Lean.Server.RpcObjectStore Lean.Json

full_name: ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.instFromJsonRpcEncodablePacket
code: RpcEncodable
goal: Lean.FromJson ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.RpcEncodablePacket✝

full_name: ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.instRpcEncodableDiagramProps.dec._@..lake.packages.proofwidgets.ProofWidgets.Component.PenroseDiagram._hyg.4
code: RpcEncodable
goal: Lean.Json → ExceptT String (ReaderT Lean.Server.RpcObjectStore Id) ProofWidgets.Penrose.DiagramProps

full_name: ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.instToJsonRpcEncodablePacket
code: RpcEncodable
goal: Lean.ToJson ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.RpcEncodablePacket✝

full_name: ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.instRpcEncodableDiagramProps
code: RpcEncodable
goal: Lean.Server.RpcEncodable ProofWidgets.Penrose.DiagramProps

full_name: ProofWidgets.Penrose.ProofWidgets.Penrose.DiagramProps.RpcEncodablePacket._@..lake.packages.proofwidgets.ProofWidgets.Component.PenroseDiagram._hyg.4
code: RpcEncodable
goal: Type

full_name: ProofWidgets.Penrose.Diagram
code: /-- 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 object `x` in the substance program.
The object `x` can be of any type but *must* be assigned an `x.textBox : Rectangle` field
in the style program.
This rectangle will be replaced with the HTML tree.
Its dimensions will be overridden in the style program
to match those of the HTML node.

The following additional constants are prepended to the style program:
```penrose
theme {
  color foreground
  color tooltipBackground
  color tooltipForeground
  color tooltipBorder
}
```
and can be accessed as, for example, `theme.foreground` in the provided `sty` in order to match
the editor theme. -/
@[widget_module]
def Diagram : Component DiagramProps 
goal: ProofWidgets.Component ProofWidgets.Penrose.DiagramProps

full_name: ProofWidgets.Penrose.DiagramState
code: structure 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 : HashMap String (String × Html) := .empty
goal: Type

full_name: ProofWidgets.Penrose.DiagramState.sub
code: structure 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 : HashMap String (String × Html) := .empty
goal: String

full_name: ProofWidgets.Penrose.DiagramState.embeds
code: structure 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 : HashMap String (String × Html) := .empty
goal: Lean.HashMap String (String × ProofWidgets.Html)

full_name: ProofWidgets.Penrose.DiagramBuilderM
code: /-- A monad to easily build Penrose diagrams in. -/
abbrev DiagramBuilderM 
goal: Type

full_name: ProofWidgets.Penrose.DiagramBuilderM.buildDiagram
code: /-- Assemble the diagram using the provided domain and style programs.

`none` is returned iff nothing was added to the diagram. -/
def buildDiagram (dsl sty : String) (maxOptSteps : Nat := 500) : DiagramBuilderM (Option Html) 
goal: ProofWidgets.Penrose.DiagramBuilderM (Option ProofWidgets.Html)

full_name: ProofWidgets.Penrose.DiagramBuilderM.addEmbed
code: /-- Add an object `nm` of Penrose type `tp`,
labelled by `h`, to the substance program. -/
def addEmbed (nm : String) (tp : String) (h : Html) : DiagramBuilderM Unit 
goal: ProofWidgets.Penrose.DiagramBuilderM Unit

full_name: ProofWidgets.Penrose.DiagramBuilderM.addExpr
code: /-- Add an object of Penrose type `tp`,
corresponding to (and labelled by) the expression `e`,
to the substance program.
Return its Penrose name. -/
def addExpr (tp : String) (e : Expr) : DiagramBuilderM String 
goal: ProofWidgets.Penrose.DiagramBuilderM String

full_name: ProofWidgets.Penrose.DiagramBuilderM.addInstruction
code: /-- Add an instruction `i` to the substance program. -/
def addInstruction (i : String) : DiagramBuilderM Unit 
goal: ProofWidgets.Penrose.DiagramBuilderM Unit

full_name: ProofWidgets.Penrose.DiagramBuilderM.run
code: def run (x : DiagramBuilderM α) : MetaM α 
goal: Lean.MetaM α

full_name: ProofWidgets.PenroseDiagramProps
code: /-- Abbreviation for backwards-compatibility. -/
abbrev PenroseDiagramProps 
goal: Type

full_name: ProofWidgets.PenroseDiagram
code: /-- Abbreviation for backwards-compatibility. -/
abbrev PenroseDiagram 
goal: ProofWidgets.Component ProofWidgets.Penrose.DiagramProps