initial go

This commit is contained in:
mehbark 2025-09-18 14:17:02 -04:00
commit f056628881
Signed by: mbk
GPG key ID: E333EC1335FFCCDB
7 changed files with 59 additions and 0 deletions

14
.github/workflows/lean_action_ci.yml vendored Normal file
View file

@ -0,0 +1,14 @@
name: Lean Action CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: leanprover/lean-action@v1

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.lake

30
Main.lean Normal file
View file

@ -0,0 +1,30 @@
inductive Op : (inp out : Array (Type u)) → Type (u+1) where
| push (a : α) : Op #[] #[α]
| pop {α : Type u} : Op #[α] #[]
| dup {α : Type u} : Op #[α] #[α, α]
| swap {α β : Type u} : Op #[α, β] #[β, α]
| call (f : α → β) : Op #[α] #[β]
| seq (a : Op i o) (b : Op o o') : Op i o'
instance : HAndThen (Op i o) (Op o o') (Op i o') where
hAndThen a b := Op.seq a (b ())
abbrev Stack : Array Type → Type
| ⟨[]⟩ => Unit
| ⟨[t]⟩ => t
| ⟨t::ts⟩ => t × Stack ⟨ts⟩
#reduce (types := true) Stack #[Nat, Int, Int]
def Op.run : Op i o → Stack i → Stack o
| push x, () => x
| pop, _ => ()
| dup, x => (x, x)
| swap, (a, b) => (b, a)
| call f, x => f x
| seq a b, s => b.run (a.run s)
#eval Op.push 1 >> Op.call Nat.succ |>.run ()
def main : IO Unit :=
IO.println s!"Hello, world!"

1
README.md Normal file
View file

@ -0,0 +1 @@
# puyo

5
lake-manifest.json Normal file
View file

@ -0,0 +1,5 @@
{"version": "1.1.0",
"packagesDir": ".lake/packages",
"packages": [],
"name": "puyo",
"lakeDir": ".lake"}

7
lakefile.toml Normal file
View file

@ -0,0 +1,7 @@
name = "puyo"
version = "0.1.0"
defaultTargets = ["puyo"]
[[lean_exe]]
name = "puyo"
root = "Main"

1
lean-toolchain Normal file
View file

@ -0,0 +1 @@
leanprover/lean4:v4.23.0