diff --git a/server/GameServer/Commands.lean b/server/GameServer/Commands.lean index ab1618c..92be107 100644 --- a/server/GameServer/Commands.lean +++ b/server/GameServer/Commands.lean @@ -275,7 +275,8 @@ Only the existing statement will be available in later levels: let thmStatement ← `(theorem $(mkIdent defaultDeclName) $sig $val) elabCommand thmStatement else - let thmStatement ← `(theorem $(mkIdent name.getId) $sig $val) + -- logInfo attr + let thmStatement ← `( theorem $(mkIdent name.getId) $sig $val) elabCommand thmStatement | none => let thmStatement ← `(theorem $(mkIdent defaultDeclName) $sig $val) @@ -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 -/ def GameLevel.getInventory (level : GameLevel) : InventoryType → InventoryInfo diff --git a/server/index.mjs b/server/index.mjs index d26bf22..3750008 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -118,7 +118,7 @@ wss.addListener("connection", function(ws, req) { }); 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', () => { console.log(`[${new Date()}] Socket closed - ${ip}`) diff --git a/server/test/test_statement.lean b/server/test/test_statement.lean index e6df5b2..6dfc33c 100644 --- a/server/test/test_statement.lean +++ b/server/test/test_statement.lean @@ -1,4 +1,5 @@ import GameServer.Commands +--import Game "Test" World "TestW" @@ -6,5 +7,21 @@ Level 1 LemmaDoc add_zero as "add_zero" in "Nat" "(nothing)" -Statement add_zero (attr := simp, to_additive) "test" (n : Nat) : n + 0 = n := by - rfl +@[simp] Statement add_zero "test" (n : Nat) : n + n = n := by + 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