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 — Decision, CovariantFunction, ContravariantFunction, FeedbackGame, CorecursiveGame, IdentityGame
  • 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

pip install gds-games
from ogs.dsl.games import Decision, CovariantFunction
from ogs.dsl.composition import Flow
from ogs.dsl.pattern import Pattern
from ogs.dsl.compile import compile_to_ir
from ogs import verify

# Define games
sensor = CovariantFunction(name="Sensor", x="observation", y="signal")
agent = Decision(name="Agent", x="signal", y="action", r="reward", s="experience")

# Compose into a pattern
pattern = Pattern(
    name="Simple Decision",
    games=[sensor, agent],
    flows=[Flow(source="Sensor", target="Agent", label="signal")],
)

# Compile and verify
ir_doc = compile_to_ir(pattern)
report = verify(ir_doc)
print(f"{report.checks_passed}/{report.checks_total} checks passed")

License

Apache-2.0

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.1.0.tar.gz (60.4 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.1.0-py3-none-any.whl (59.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gds_games-0.1.0.tar.gz
  • Upload date:
  • Size: 60.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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":null}

File hashes

Hashes for gds_games-0.1.0.tar.gz
Algorithm Hash digest
SHA256 13804e3224f9b9b2002e319c91e4dc162b2ca062270a9b50a48e3390564444ac
MD5 2de9588ee29e85c0099954a93634f659
BLAKE2b-256 bbf82a998d0a077de27f93686a404ffea2fd5fa3c02713c5f13a25fcd81c715b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gds_games-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 59.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","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":null}

File hashes

Hashes for gds_games-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e81f491f65d2b7321d02072754806de6ca430f40491e6e0b7d7ef14211da6b08
MD5 a19ef20abddb26294158d9fb61e76d92
BLAKE2b-256 b5333ad73d45f730497b74b42dd0278c574cff63ab29dd11c1ecd87c173b1dd4

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