Skip to main content

Typed DSL for Compositional Game Theory — define, verify, and report on open game patterns

Project description

gds-games

PyPI Python License

Typed DSL for compositional game theory, built on gds-framework.

What is this?

gds-games extends the GDS framework with game-theoretic vocabulary — open games, strategic interactions, and compositional game patterns. It provides:

  • 6 atomic game types — DecisionGame, CovariantFunction, ContravariantFunction, DeletionGame, DuplicationGame, CounitGame
  • Pattern composition — Sequential, Parallel, Feedback, and Corecursive composition operators
  • IR compilation — Flatten game patterns into JSON-serializable intermediate representation
  • 13 verification checks — Type matching (T-001..T-006) and structural validation (S-001..S-007)
  • 7 Markdown report templates — System overview, verification summary, state machine, interface contracts, and more
  • 6 Mermaid diagram generators — Structural, hierarchy, flow topology, architecture views
  • CLIogs compile, ogs verify, ogs report

Architecture

gds-framework (pip install gds-framework)
│
│  Domain-neutral composition algebra, typed spaces,
│  state model, verification engine, flat IR compiler.
│
└── gds-games (pip install gds-games)
    │
    │  Game-theoretic DSL: OpenGame types, Pattern composition,
    │  compile_to_ir(), domain verification, reports, visualization.
    │
    └── Your application
        │
        │  Concrete pattern definitions, analysis notebooks,
        │  verification runners.

Quick Start

uv add gds-games
# or: pip install gds-games
from ogs.dsl.games import DecisionGame, CovariantFunction
from ogs.dsl.pattern import Pattern
from ogs import compile_to_ir, verify

# Define atomic games with typed signatures (x=input, y=output, r=utility, s=coutility)
sensor = CovariantFunction(name="Sensor", x="observation", y="signal")
agent = DecisionGame(name="Agent", x="signal", y="action", r="reward", s="experience")

# Compose sequentially (auto-wires by token matching)
game = sensor >> agent

# Wrap in a Pattern and compile to IR
pattern = Pattern(name="Simple Decision", game=game)
ir = compile_to_ir(pattern)

# Run verification checks
report = verify(ir)
print(f"{report.checks_passed}/{report.checks_total} checks passed")

License

Apache-2.0


Built with Claude Code. All code is test-driven and human-reviewed.

Credits & Attribution

Author: Rohan MehtaBlockScience

Theoretical foundation: Dr. Michael Zargham and Dr. Jamsheed ShorishGeneralized Dynamical Systems, Part I: Foundations (2021).

Architectural inspiration: Sean McOwenMSML and bdp-lib.

Contributors:

  • Michael Zargham — Project direction, GDS theory guidance, and technical review (BlockScience).
  • Peter Hacker — Code auditing and review (BlockScience).

Lineage: Part of the cadCAD ecosystem for Complex Adaptive Dynamics.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gds_games-0.2.0.tar.gz (60.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gds_games-0.2.0-py3-none-any.whl (60.0 kB view details)

Uploaded Python 3

File details

Details for the file gds_games-0.2.0.tar.gz.

File metadata

  • Download URL: gds_games-0.2.0.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gds_games-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2615996556b6acbf12768355b534129a56af2120429f3aebe71491380b715224
MD5 a964a95aae0b1a2587c5d2d821f22571
BLAKE2b-256 04d4961e28a8f4b1a50b7da4c017aee98fa36c3cc7f1a695003f3f67b196b25b

See more details on using hashes here.

File details

Details for the file gds_games-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gds_games-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 60.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for gds_games-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ed448cee73e49c91e7612d33544afc129becd3a18f180c73ffc3e6ee8b6dc9c
MD5 460aaa8388e3937b4f0ee5123554f04a
BLAKE2b-256 63a1e6e0eacc9570750b84aa518e538c221481eb44f2711cfdc8a14e1010fc99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page