add Hole and Template skeleton

pull/79/head
Jon Eugster 3 years ago
parent 2a81c67675
commit c6e224dc40

@ -275,6 +275,7 @@ Only the existing statement will be available in later levels:
let thmStatement ← `(theorem $(mkIdent defaultDeclName) $sig $val) let thmStatement ← `(theorem $(mkIdent defaultDeclName) $sig $val)
elabCommand thmStatement elabCommand thmStatement
else else
-- logInfo attr
let thmStatement ← `( theorem $(mkIdent name.getId) $sig $val) let thmStatement ← `( theorem $(mkIdent name.getId) $sig $val)
elabCommand thmStatement elabCommand thmStatement
| none => | none =>
@ -420,6 +421,39 @@ elab "Branch" t:tacticSeq : tactic => do
/-- The tactic block inside `Template` will be copied into the users editor.
Use `Hole` inside the template for a part of the proof that should be replaced
with `sorry`. -/
elab "Template" t:tacticSeq : tactic => do
--let b ← saveState
Tactic.evalTactic t
-- -- Not correct
-- let gs ← Tactic.getUnsolvedGoals
-- if ¬ gs.isEmpty then
-- logWarning "To work as intended, `Template` should contain the entire proof"
-- -- Show an info whether the branch proofs all remaining goals.
-- let gs ← Tactic.getUnsolvedGoals
-- if gs.isEmpty then
-- logInfo "This branch finishes the proof."
-- else
-- logInfo "This branch leaves open goals."
-- let msgs ← Core.getMessageLog
-- b.restore
-- Core.setMessageLog msgs
/-- A hole inside a template proof that will be replaced by `sorry`. -/
elab "Hole" t:tacticSeq : tactic => do
Tactic.evalTactic t
/-! # Make Game -/ /-! # Make Game -/
def GameLevel.getInventory (level : GameLevel) : InventoryType → InventoryInfo def GameLevel.getInventory (level : GameLevel) : InventoryType → InventoryInfo

@ -118,7 +118,7 @@ wss.addListener("connection", function(ws, req) {
}); });
console.log(`[${new Date()}] Number of open sockets - ${socketCounter}`) console.log(`[${new Date()}] Number of open sockets - ${socketCounter}`)
console.log(`[${new Date()}] Free RAM - ${Math.round(os.freemem() / 1024 / 1024)} / ${Math.round(os.totalmem() / 1024 / 1024)} GB`) console.log(`[${new Date()}] Free RAM - ${Math.round(os.freemem() / 1024 / 1024)} / ${Math.round(os.totalmem() / 1024 / 1024)} MB`)
ws.on('close', () => { ws.on('close', () => {
console.log(`[${new Date()}] Socket closed - ${ip}`) console.log(`[${new Date()}] Socket closed - ${ip}`)

@ -1,4 +1,5 @@
import GameServer.Commands import GameServer.Commands
--import
Game "Test" Game "Test"
World "TestW" World "TestW"
@ -6,5 +7,21 @@ Level 1
LemmaDoc add_zero as "add_zero" in "Nat" "(nothing)" LemmaDoc add_zero as "add_zero" in "Nat" "(nothing)"
Statement add_zero (attr := simp, to_additive) "test" (n : Nat) : n + 0 = n := by @[simp] Statement add_zero "test" (n : Nat) : n + n = n := by
rfl sorry
Statement (n : Nat) : 0 + n = n := by
Template
induction n
Hole
simp
simp
NewLemma add_zero
--attribute [simp] add_zero
#print add_zero
theorem xy (n : Nat) : n + n = n := by
simp

Loading…
Cancel
Save