2023-10-25 22:18:59 -07:00
|
|
|
import Pantograph.Protocol
|
2023-11-04 15:00:51 -07:00
|
|
|
import Pantograph.Goal
|
|
|
|
import LSpec
|
2023-10-25 22:18:59 -07:00
|
|
|
|
|
|
|
namespace Pantograph
|
|
|
|
|
|
|
|
namespace Protocol
|
|
|
|
/-- Set internal names to "" -/
|
|
|
|
def Goal.devolatilize (goal: Goal): Goal :=
|
|
|
|
{
|
|
|
|
goal with
|
2023-10-30 14:44:06 -07:00
|
|
|
name := "",
|
2023-10-25 22:18:59 -07:00
|
|
|
vars := goal.vars.map removeInternalAux,
|
|
|
|
}
|
|
|
|
where removeInternalAux (v: Variable): Variable :=
|
|
|
|
{
|
|
|
|
v with
|
|
|
|
name := ""
|
|
|
|
}
|
2023-11-04 15:00:51 -07:00
|
|
|
deriving instance DecidableEq, Repr for Expression
|
|
|
|
deriving instance DecidableEq, Repr for Variable
|
|
|
|
deriving instance DecidableEq, Repr for Goal
|
2023-10-25 22:18:59 -07:00
|
|
|
end Protocol
|
|
|
|
|
2023-11-04 15:00:51 -07:00
|
|
|
def TacticResult.toString : TacticResult → String
|
|
|
|
| .success state => s!".success ({state.goals.length} goals)"
|
|
|
|
| .failure messages =>
|
|
|
|
let messages := "\n".intercalate messages.toList
|
|
|
|
s!".failure {messages}"
|
|
|
|
| .parseError error => s!".parseError {error}"
|
|
|
|
| .indexError index => s!".indexError {index}"
|
|
|
|
|
|
|
|
def assertUnreachable (message: String): LSpec.TestSeq := LSpec.check message false
|
|
|
|
|
2023-10-25 22:18:59 -07:00
|
|
|
end Pantograph
|