Use Command Mode in the REPL
masterIn command mode, you send complete Lean commands (such as declarations) using a JSON object with a cmd key.
To maintain state across commands, include the env field in your request. The env value must be the numeric label received in the env field of a previous response. If the env field is omitted, a new environment is created. Note that import commands can only be used when no env field is specified.
Response Fields:
env: A numeric label for theEnvironmentafter your command.messages: A list of messages (errors, warnings, etc.) generated during processing.sorries: A list ofsorrylocations in the command, including their expected type and aproofStatenumeric label used for Tactic mode.
{ "cmd" : "def f := 2" }
{ "cmd" : "example : f = 2 := rfl", "env" : 1 }