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.3.0.tar.gz (70.3 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.3.0-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gds_games-0.3.0.tar.gz
  • Upload date:
  • Size: 70.3 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.3.0.tar.gz
Algorithm Hash digest
SHA256 bf74712f4fbf6561fa5932b504bd4cf94d4a67650cbad249140c78bee19ea935
MD5 16d3653e567542af9a186dca635e91cf
BLAKE2b-256 f3d7167e8f0e90e7a5a30e67f393a3a1f6f88b4902eabef418b8d65ba7a178c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gds_games-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 65.8 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9e4f53761480aab4e30b4e005dfc46662dde139e7a3103e7f4ca3df0d834cb7
MD5 a2ddf4a8cd2457af24101aafbfc99c0f
BLAKE2b-256 3e6e0f330682ba559b9694b677ae88e64f8d1c5df90083a6f40f92126ca363e9

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