2D, 3D, game, games, online game, game development, game engine, programming, OpenGL, Open AI, math, graphics, design, graphic, graphics, game development, game engine, programming, web development, web art, web graphic, arts, tutorial, tutorials,
sâmbătă, 21 noiembrie 2026
News : Gemini 4 Neon ski simulator based on real Mont Blanc terrain.
Gemini 4 Neon coded a ski simulator based on real Mont Blanc terrain.
Built in @Antigravity with custom shaders and zero pre-made 3D models, it renders carved snow and avalanches live.
See the official website.
Lean 4 : Testing simple FASM assembly with Lean 4.
This Lean 4 program parses, simulates, and formally verifies a simple x86-64 FASM assembly routine.
First, it reads the raw assembly text, strips out comments and headers, and extracts 5 executable instructions: loading 10 into rax, adding 25 to rax, moving the result into rdi, setting rax to 60 (the Linux sys_exit syscall number), and triggering syscall. Next, it executes those 5 instructions on a virtual machine model and proves mathematically that adding any two numbers leaves their exact sum in rax.
The output confirms the execution succeeded. Parsed ops count: 5 means all 5 instructions were recognized cleanly. The final machine state shows rax holds 60 (the exit syscall code), rdi holds 35 (the result of 10 + 25), and exited is true. Finally, exit code (rdi): 35 confirms the assembly routine computed the right answer and terminated cleanly.
Note that the "No connection to Lean" line in your editor simply means the web server briefly timed out after printing the result—your code compiled and evaluated properly.
-- Testing simple program FASM with Lean 4
inductive Reg where
| RAX
| RDI
deriving Repr, DecidableEq
inductive FasmOp where
| movImm (dst : Reg) (val : Int)
| addImm (dst : Reg) (val : Int)
| movReg (dst src : Reg)
| syscallExit
deriving Repr
structure Machine where
rax : Int := 0
rdi : Int := 0
exited : Bool := false
deriving Repr
def getReg (m : Machine) : Reg → Int
| .RAX => m.rax
| .RDI => m.rdi
def setReg (m : Machine) (r : Reg) (v : Int) : Machine :=
match r with
| .RAX => { m with rax := v }
| .RDI => { m with rdi := v }
def step (m : Machine) : FasmOp → Machine
| .movImm dst val => setReg m dst val
| .addImm dst val => setReg m dst (getReg m dst + val)
| .movReg dst src => setReg m dst (getReg m src)
| .syscallExit =>
if m.rax == 60 then
{ m with exited := true }
else
m
def exec (ops : List FasmOp) (init : Machine := {}) : Machine :=
ops.foldl step init
def trimWs (s : String) : String :=
let cs := s.toList
let leftTrimmed := cs.dropWhile Char.isWhitespace
let rightTrimmed := leftTrimmed.reverse.dropWhile Char.isWhitespace
String.ofList rightTrimmed.reverse
def normalizeWs (s : String) : String :=
let cleaned := trimWs s
let noTabs := cleaned.replace "\t" " "
let tokens := noTabs.splitOn " " |>.filter (fun p => !p.isEmpty)
String.intercalate " " tokens
def parseReg? (s : String) : Option Reg :=
match normalizeWs s |>.toLower with
| "rax" => some .RAX
| "rdi" => some .RDI
| _ => none
def parseLine? (line : String) : Option FasmOp :=
let rawBeforeComment := (line.splitOn ";").head!
let codePart := normalizeWs rawBeforeComment
if codePart.isEmpty || codePart.endsWith ":" || codePart.startsWith "format " ||
codePart.startsWith "entry " || codePart.startsWith "segment " then
none
else if codePart == "syscall" then
some .syscallExit
else if codePart.startsWith "mov " then
let rest := normalizeWs (codePart.drop 4).toString
let args := rest.splitOn "," |>.map normalizeWs
match args with
| [d, s] =>
match parseReg? d, s.toInt? with
| some reg, some imm => some (.movImm reg imm)
| _, _ =>
match parseReg? d, parseReg? s with
| some r1, some r2 => some (.movReg r1 r2)
| _, _ => none
| _ => none
else if codePart.startsWith "add " then
let rest := normalizeWs (codePart.drop 4).toString
let args := rest.splitOn "," |>.map normalizeWs
match args with
| [d, s] =>
match parseReg? d, s.toInt? with
| some reg, some imm => some (.addImm reg imm)
| _, _ => none
| _ => none
else
none
def parseFasm (src : String) : List FasmOp :=
(src.splitOn "\n").filterMap parseLine?
theorem fasm_add_general (a b : Int) :
(exec [.movImm .RAX a, .addImm .RAX b]).rax = a + b := by
simp [exec, step, setReg, getReg]
theorem fasm_add_correct :
(exec [.movImm .RAX 10, .addImm .RAX 25]).rax = 35 := by
simpa using fasm_add_general 10 25
def sampleFasm : String :=
"format ELF64 executable 3\n" ++
"entry _start\n" ++
"segment readable executable\n" ++
"_start:\n" ++
"\tmov rax, 10\n" ++
" add rax, 25\n" ++
" mov rdi, rax\n" ++
" mov rax, 60\n" ++
" syscall\n"
def testFasmInLean : IO Unit := do
let ops := parseFasm sampleFasm
let finalState := exec ops {}
IO.println s!"Parsed ops count: {ops.length}"
IO.println s!"Final machine state: {repr finalState}"
IO.println s!"Exit code (rdi): {finalState.rdi}, Exited: {finalState.exited}"
#eval testFasmInLean
Lean 4 : Gordon Growth model example.
Lean 4 is an open-source programming language and interactive proof assistant where mathematics and code become the exact same thing.
Unlike traditional languages like Python or C++ that simply run instructions, Lean is built on dependent type theory. This allows you to write mathematical statements as types and construct their proofs as programs. A tiny, strict verification engine checks every single logical step—if you skip a step, miss an edge case, or make a false assumption, the code simply refuses to compile.
This makes Lean 4 especially valuable in modern AI research. While an AI can easily generate a plausible-sounding proof in plain English that hides a subtle flaw, Lean acts as an incorruptible referee, forcing the model to prove every deduction down to the foundational axioms. Beyond formal verification, Lean 4 also compiles to fast C code, making it a capable functional programming language for building real-world software, tools, and simulations.
In short: if your code compiles in Lean 4, your logic is 100% bulletproof. See the online tool.
-- Gordon Growth Model (Constant-Growth Dividend Discount Model) in Lean 4
-- Formula: P0 = D1 / (r - g), where D1 = D0 * (1 + g) and r > g
structure GordonParams where
d0 : Float -- Last annual dividend per share
g : Float -- Constant annual dividend growth rate (e.g., 0.04 for 4%)
r : Float -- Required annual return / discount rate (e.g., 0.09 for 9%)
deriving Repr
-- Next year's expected dividend: D1 = D0 * (1 + g)
def expectedDividend (p : GordonParams) : Float :=
p.d0 * (1.0 + p.g)
-- Intrinsic value P0 = D1 / (r - g) when r > g
def gordonFairValue (p : GordonParams) : Option Float :=
let spread := p.r - p.g
if spread > 0.0 then
some (expectedDividend p / spread)
else
none
-- Implied required return r = (D1 / P0) + g for a given market price p0 > 0
def impliedReturn (d1 p0 g : Float) : Option Float :=
if p0 > 0.0 then
some ((d1 / p0) + g)
else
none
-- Formal algebraic proof:
-- (a + b) - (a + c) = b - c (useful for comparing spread changes: r2 - r1)
theorem spread_difference (a b c : Int) : (a + b) - (a + c) = b - c := by
omega
def runGordonDemo : IO Unit := do
-- Example: D0 = $2.00, growth g = 5% (0.05), required return r = 9% (0.09)
-- D1 = 2.00 * 1.05 = 2.10; spread = 0.09 - 0.05 = 0.04 => Fair Value = 2.10 / 0.04 = $52.50
let p : GordonParams := { d0 := 2.0, g := 0.05, r := 0.09 }
let d1 := expectedDividend p
IO.println s!"Expected Dividend D1: {d1}"
match gordonFairValue p with
| some fairVal =>
IO.println s!"Gordon Fair Value P0: {fairVal}"
match impliedReturn d1 fairVal p.g with
| some impR => IO.println s!"Implied Return r check: {impR}"
| none => IO.println "Invalid price for implied return"
| none =>
IO.println "Invalid parameters: require r > g"
#eval runGordonDemo
Tool : Spck Editor / Git Client ... android editor
• Remote Terminal: touch scrolling in full-screen apps, an Enter button for confirmations, and typing fixes.
• Remote CLI: PIN-protected connections, color-coded ping, better reconnection and status warnings.
• Premium Fast Lane: direct WebRTC connections, 2× faster than relay on average.
• Git: fix incorrect status for local projects.
• UI: fix the Translucent Background setting
Official documentation for Spck Editor — a mobile-first code editor with project management, Git integration, syntax highlighting, and a remote CLI for local development. Drive local AI coding agents (Claude Code, Codex, Gemini CLI) from your phone over the Agent Client Protocol (ACP). ...
Abonați-vă la:
Postări (Atom)