Two engines
The same Lean code, compiled to WebAssembly for the browser, and the full elaborator on a local server.
In the browser, an engine compiled from Lean answers the pages' requests, with no server. With GraviTrax's local server, proofs go through Lean's real elaborator and kernel. Tests compare the two engines, and Lean with each game's JavaScript.
The games share one logic (`LeanGames.Core`): a checker proved sound, deductions that lose no solution, checked proof trees.
The games with a design system (GraviTrax, Tubulax) also share one definition of the workshop (`LeanGames.Design.Workshop`): a rule and what the assembly is for, each decided by a checker proved sound, and a checked catalogue of pieces.
In Lean
These statements are read from the games' Lean code when the site is built: if one of them disappears or changes, the site does not build.
LeanGames.Api.Protocol (C : Type) : Type 1LeanGames.Api.EngineT (m : Type → Type) (C : Type) [Protocol C] : TypeLeanGames.Api.handle {C : Type} [Protocol C] (engine : Engine C) (request : J) : JLeanGames.Core.Checker (P B : Type) [Problem P B] : TypeLeanGames.Core.Follows {P B : Type} [Partial P B] (p : P) (g g' : B) : PropLeanGames.Core.Interp.run_sound {G R : Type} [Inhabited G] [Inhabited R] {game : Interp.Game G R}
{config : Script.Config (Interp.Atom R)} {root : G} {script : String} {l : Lang}
(h : (Interp.run game config root script l).complete = true) : game.rules.holds rootLeanGames.Design.Workshop : Type 1LeanGames.Design.Workshop.check_sound {D : Design.Workshop} {s : D.Site} {a : D.Assembly}
(h : D.check s a = true) : D.Built s aGravitrax.built_iff (s : Stock) (p : Plan) : systeme.Built s p ↔ Circuit s pLeanGames.Core.ProofTree.valid_sound {G R : Type} {rs : Rules G R} {n : Nat} {g : G}
{t : ProofTree R} : ProofTree.valid rs n g t = true → rs.holds g