Merge pull request 'Remove the obsolete name field from proof tree structure' (#11) from misc/cleanup into dev
Reviewed-on: #11
This commit is contained in:
commit
dea63ac5ea
|
@ -134,7 +134,7 @@ def execute (command: Commands.Command): MainM Lean.Json := do
|
||||||
match expr? with
|
match expr? with
|
||||||
| .error error => return .error error
|
| .error error => return .error error
|
||||||
| .ok expr =>
|
| .ok expr =>
|
||||||
let tree ← ProofTree.create (str_to_name <| args.name.getD "Untitled") expr
|
let tree ← ProofTree.create expr
|
||||||
-- Put the new tree in the environment
|
-- Put the new tree in the environment
|
||||||
let nextTreeId := state.proofTrees.size
|
let nextTreeId := state.proofTrees.size
|
||||||
set { state with proofTrees := state.proofTrees.push tree }
|
set { state with proofTrees := state.proofTrees.push tree }
|
||||||
|
|
|
@ -128,7 +128,6 @@ structure OptionsPrint where
|
||||||
abbrev OptionsPrintResult := Options
|
abbrev OptionsPrintResult := Options
|
||||||
|
|
||||||
structure ProofStart where
|
structure ProofStart where
|
||||||
name: Option String -- Identifier of the proof
|
|
||||||
-- Only one of the fields below may be populated.
|
-- Only one of the fields below may be populated.
|
||||||
expr: Option String -- Proof expression
|
expr: Option String -- Proof expression
|
||||||
copyFrom: Option String -- Theorem name
|
copyFrom: Option String -- Theorem name
|
||||||
|
@ -140,7 +139,7 @@ structure ProofTactic where
|
||||||
-- Identifiers for tree, state, and goal
|
-- Identifiers for tree, state, and goal
|
||||||
treeId: Nat
|
treeId: Nat
|
||||||
stateId: Nat
|
stateId: Nat
|
||||||
goalId: Option Nat
|
goalId: Option Nat -- Defaults to 0
|
||||||
tactic: String
|
tactic: String
|
||||||
deriving Lean.FromJson
|
deriving Lean.FromJson
|
||||||
structure ProofTacticResult where
|
structure ProofTacticResult where
|
||||||
|
|
|
@ -30,21 +30,17 @@ structure ProofState where
|
||||||
parent : Option Nat := none
|
parent : Option Nat := none
|
||||||
parentGoalId : Nat := 0
|
parentGoalId : Nat := 0
|
||||||
structure ProofTree where
|
structure ProofTree where
|
||||||
-- All parameters needed to run a `TermElabM` monad
|
|
||||||
name: Name
|
|
||||||
|
|
||||||
-- Set of proof states
|
-- Set of proof states
|
||||||
states : Array ProofState := #[]
|
states : Array ProofState := #[]
|
||||||
|
|
||||||
abbrev M := Elab.TermElabM
|
abbrev M := Elab.TermElabM
|
||||||
|
|
||||||
def ProofTree.create (name: Name) (expr: Expr): M ProofTree := do
|
def ProofTree.create (expr: Expr): M ProofTree := do
|
||||||
let expr ← instantiateMVars expr
|
let expr ← instantiateMVars expr
|
||||||
let goal := (← Meta.mkFreshExprMVar expr (kind := MetavarKind.synthetic))
|
let goal := (← Meta.mkFreshExprMVar expr (kind := MetavarKind.synthetic))
|
||||||
let savedStateMonad: Elab.Tactic.TacticM Elab.Tactic.SavedState := MonadBacktrack.saveState
|
let savedStateMonad: Elab.Tactic.TacticM Elab.Tactic.SavedState := MonadBacktrack.saveState
|
||||||
let savedState ← savedStateMonad { elaborator := .anonymous } |>.run' { goals := [goal.mvarId!]}
|
let savedState ← savedStateMonad { elaborator := .anonymous } |>.run' { goals := [goal.mvarId!]}
|
||||||
return {
|
return {
|
||||||
name := name,
|
|
||||||
states := #[{
|
states := #[{
|
||||||
savedState := savedState,
|
savedState := savedState,
|
||||||
goals := [goal.mvarId!]
|
goals := [goal.mvarId!]
|
||||||
|
|
|
@ -22,7 +22,6 @@ def start_proof (start: Start): M (LSpec.TestSeq × Option ProofTree) := do
|
||||||
match cInfo? with
|
match cInfo? with
|
||||||
| .some cInfo =>
|
| .some cInfo =>
|
||||||
let state ← ProofTree.create
|
let state ← ProofTree.create
|
||||||
(name := str_to_name "TestExample")
|
|
||||||
(expr := cInfo.type)
|
(expr := cInfo.type)
|
||||||
return (testSeq, Option.some state)
|
return (testSeq, Option.some state)
|
||||||
| .none =>
|
| .none =>
|
||||||
|
@ -43,7 +42,6 @@ def start_proof (start: Start): M (LSpec.TestSeq × Option ProofTree) := do
|
||||||
return (testSeq, Option.none)
|
return (testSeq, Option.none)
|
||||||
| .ok expr =>
|
| .ok expr =>
|
||||||
let state ← ProofTree.create
|
let state ← ProofTree.create
|
||||||
(name := str_to_name "TestExample")
|
|
||||||
(expr := expr)
|
(expr := expr)
|
||||||
return (testSeq, Option.some state)
|
return (testSeq, Option.some state)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue