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.1.1.tar.gz (60.7 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.1-py3-none-any.whl (59.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gds_games-0.1.1.tar.gz
  • Upload date:
  • Size: 60.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gds_games-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c2aa1395e6d8d8d4c5c123e63ef01b86b2ccc25138a5a9c3a4840b74867323ce
MD5 47dbcc0c12ed7cd538126a10ac8757db
BLAKE2b-256 ffb9bb5cb69af6e477da0951a65bdbc880e43c91f90af4209fe6d229a3e5d345

See more details on using hashes here.

Provenance

The following attestation bundles were made for gds_games-0.1.1.tar.gz:

Publisher: publish.yml on BlockScience/gds-games

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: gds_games-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 59.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gds_games-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2af9012a88d9621875931f210a541c944dfe3b61391dfdd1b6fa43a7f5c5d91a
MD5 e314e26effecd09b52ce8c8db048a350
BLAKE2b-256 73b14de4c19da598b6933dbe238a1288a44e8dfbf9cbf0a72b48a57362a0b573

See more details on using hashes here.

Provenance

The following attestation bundles were made for gds_games-0.1.1-py3-none-any.whl:

Publisher: publish.yml on BlockScience/gds-games

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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