{"id":13442883,"url":"https://github.com/affeldt-aist/monae","last_synced_at":"2025-08-20T00:38:08.020Z","repository":{"id":39420093,"uuid":"143658169","full_name":"affeldt-aist/monae","owner":"affeldt-aist","description":"Monadic effects and equational reasoning in Rocq","archived":false,"fork":false,"pushed_at":"2025-07-19T10:14:22.000Z","size":5089,"stargazers_count":72,"open_issues_count":20,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-19T11:24:02.909Z","etag":null,"topics":["math-comp","mathcomp","monad-transformers","monadic-effects","monads","nondeterminism","probabilistic-programming","ssreflect"],"latest_commit_sha":null,"homepage":"","language":"Rocq Prover","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/affeldt-aist.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-08-06T00:36:18.000Z","updated_at":"2025-07-19T09:49:12.000Z","dependencies_parsed_at":"2023-12-14T03:22:00.641Z","dependency_job_id":"ddc6f2be-155a-4565-9dd4-14adc860e520","html_url":"https://github.com/affeldt-aist/monae","commit_stats":{"total_commits":614,"total_committers":9,"mean_commits":68.22222222222223,"dds":0.3143322475570033,"last_synced_commit":"ed161f29c5e31f3567e53f319ce0aca595e1b1cb"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/affeldt-aist/monae","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affeldt-aist%2Fmonae","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affeldt-aist%2Fmonae/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affeldt-aist%2Fmonae/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affeldt-aist%2Fmonae/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/affeldt-aist","download_url":"https://codeload.github.com/affeldt-aist/monae/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/affeldt-aist%2Fmonae/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271247062,"owners_count":24725902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["math-comp","mathcomp","monad-transformers","monadic-effects","monads","nondeterminism","probabilistic-programming","ssreflect"],"created_at":"2024-07-31T03:01:52.663Z","updated_at":"2025-08-20T00:38:08.008Z","avatar_url":"https://github.com/affeldt-aist.png","language":"Rocq Prover","funding_links":[],"categories":["Coq","Projects","Rocq Prover"],"sub_categories":["Type Theory and Mathematics"],"readme":"\u003c!---\nThis file was generated from `meta.yml`, please do not edit manually.\nFollow the instructions on https://github.com/coq-community/templates to regenerate.\n---\u003e\n# Monadic effects and equational reasoning in Rocq\n\n[![Docker CI][docker-action-shield]][docker-action-link]\n\n[docker-action-shield]: https://github.com/affeldt-aist/monae/actions/workflows/docker-action.yml/badge.svg?branch=master\n[docker-action-link]: https://github.com/affeldt-aist/monae/actions/workflows/docker-action.yml\n\n\n\n\nThis Coq library contains a hierarchy of monads with their laws used\nin several examples of monadic equational reasoning.\n\n## Meta\n\n- Author(s):\n  - Reynald Affeldt (initial)\n  - David Nowak (initial)\n  - Takafumi Saikawa (initial)\n  - Jacques Garrigue\n  - Ayumu Saito\n  - Celestine Sauvage\n  - Kazunari Tanaka\n- License: [LGPL-2.1-or-later](LICENSE)\n- Compatible Coq versions: Coq 8.19-8.20\n- Additional dependencies:\n  - [MathComp ssreflect](https://math-comp.github.io)\n  - [MathComp fingroup](https://math-comp.github.io)\n  - [MathComp algebra](https://math-comp.github.io)\n  - [MathComp solvable](https://math-comp.github.io)\n  - [MathComp field](https://math-comp.github.io)\n  - [MathComp analysis](https://github.com/math-comp/analysis)\n  - [Infotheo](https://github.com/affeldt-aist/infotheo)\n  - [Paramcoq](https://github.com/coq-community/paramcoq)\n  - [Hierarchy Builder](https://github.com/math-comp/hierarchy-builder)\n  - [Coq-Equations](https://github.com/mattam82/Coq-Equations)\n- Coq namespace: `monae`\n- Related publication(s):\n  - [A hierarchy of monadic effects for program verification using equational reasoning](https://staff.aist.go.jp/reynald.affeldt/documents/monae.pdf) doi:[10.1007/978-3-030-33636-3_9](https://doi.org/10.1007/978-3-030-33636-3_9)\n  - [Extending Equational Monadic Reasoning with Monad Transformers](https://drops.dagstuhl.de/opus/volltexte/2021/13881/) doi:[10.4230/LIPIcs.TYPES.2020.2](https://doi.org/10.4230/LIPIcs.TYPES.2020.2)\n  - [A Trustful Monad for Axiomatic Reasoning with Probability and Nondeterminism](https://arxiv.org/abs/2003.09993) doi:[10.1017/S0956796821000137](https://doi.org/10.1017/S0956796821000137)\n  - [Towards a practical library for monadic equational reasoning in Coq](https://staff.aist.go.jp/reynald.affeldt/documents/monae-mpc2022.pdf) doi:[10.1007/978-3-031-16912-0_6](https://doi.org/10.1007/978-3-031-16912-0_6)\n  - [Environment-friendly monadic equational reasoning for OCaml](https://coq-workshop.gitlab.io/2023/abstracts/coq2023_monadic-reasoning.pdf) \n  - [A practical formalization of monadic equational reasoning in dependent-type theory](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/B59B87DE000F48B9807F24AEDB11452E/S0956796824000157a.pdf/a-practical-formalization-of-monadic-equational-reasoning-in-dependent-type-theory.pdf) doi:[10.1017/S0956796824000157](https://doi.org/10.1017/S0956796824000157)\n\n## Building and installation instructions\n\nThe easiest way to install the latest released version of Monadic effects and equational reasoning in Rocq\nis via [OPAM](https://opam.ocaml.org/doc/Install.html):\n\n```shell\nopam repo add coq-released https://coq.inria.fr/opam/released\nopam install coq-monae\n```\n\nIt installs two directories in `coq/user-contrib`: `monae` and\n`monaeImpredicativeSet`.\n\nTo instead build and install manually (with GNU `make`), do:\n``` shell\ngit clone https://github.com/affeldt-aist/monae.git\ncd monae\nmake -j 4\nmake install\n```\n\n## Overview\n\nThis repository contains a formalization of monads including examples\nof monadic equational reasoning and several models. This includes for\nexample the formalization of the following papers:\n- [Gibbons and Hinze, Just do It: Simple Monadic Equational Reasoning, ICFP 2011] (except Sect. 10.2)\n- [Gibbons, Unifying Theories of Programming with Monads, UTP 2012] (up to Sect. 7.2)\n- [Mu, Equational Reasoning for Non-determinism Monad: A Case study of Spark Aggregation, TR-IIS-19-002, Academia Sinica]\n- [Mu, Calculating a Backtracking Algorithm: An exercise in Monadic Program Derivation, TR-IIS-29-003, Academia Sinica]\n- [Mu, Functional Pearls: Reasoning and Derivation of Monadic Programs, A case study of non-determinism and state, 2017]\n  + This is a draft paper. In the first release, we formalized this draft up to Sect. 5.\n    The contents have been since superseded by [mu2019tr2] and [mu2019tr3].\n- [Mu and Chiang, Deriving Monadic Quicksort (Declarative Pearl), 2020]\n\nThis library has been applied to other formalizations:\n- application to program semantics (see file `smallstep.v`)\n- formalization of monad composition [Jones and Duponcheel, Composing Monads, Yale RR 1993] (Sections 2 and 3)\n- formalization of monad transformers [Jaskelioff, Modular Monad Transformers, ESOP 2009] (up to Sect. 4)\n  + completed with details from [Jaskelioff, Lifting of Operations in Modular Monadic Semantics, PhD 2009]\n  + see directory `impredicative_set` for the formalization of [Jaskelioff, Modular Monad Transformers, ESOP 2009] (from Sect. 5)\n- formalization of the geometrically convex monad (main reference:\n  [Cheung, Distributive Interaction of Algebraic Effects, PhD Thesis, U. Oxford, 2017])\n\n![Available monads](./hier.png \"Available Monads\")\n\n## Files\n\n- core:\n  + [preamble.v](./theories/core/preamble.v): simple additions to base libraries\n  + [hierarchy.v](./theories/core/hierarchy.v): hierarchy of monadic effects\n  + [category.v](./theories/core/category.v): formalization of concrete categories (generalization of the bottom layers of `hierarchy.v`)\n  + [monad_transformer.v](./theories/core/monad_transformer.v): monad transformers\n    * completed by `ifmt_lifting.v` and `iparametricity_codensity.v` in the directory `impredicative_set`\n      - the directory `impredicative_set` contains a lighter version of Monae where monads live in `Set` and that compiles with the `impredicative-set` option of Rocq\n- libraries for each monad theory:  \n  + [monad_lib.v](./theories/lib/monad_lib.v): basic lemmas about monads\n  + [alt_lib.v](./theories/lib/alt_lib.v): lemmas about the nondeterminism monad\n  + [fail_lib.v](./theories/lib/fail_lib.v): lemmas about the fail monad and related monads\n  + [state_lib.v](./theories/lib/state_lib.v): lemmas about state-related monads\n  + [array_lib.v](./theories/lib/array_lib.v): lemmas about the array monad\n  + [trace_lib.v](./theories/lib/trace_lib.v): lemmas about about the state-trace monad\n  + [proba_lib.v](./theories/lib/proba_lib.v): lemmas about the probability monad\n  + [typed_store_lib.v](./theories/lib/typed_store_lib.v): derived definitions and lemmas about about the typed store monad\n- models of monads:\n  + [monad_model.v](./theories/models/monad_model.v): concrete models of monads\n  + [proba_monad_model.v](./theories/models//proba_monad_model.v): model of the probability monad\n  + [gcm_model.v](./theories/models//gcm_model.v): model of the geometrically convex monad\n  + [altprob_model.v](./theories/models//altprob_model.v): model of a monad that mixes non-deterministic choice and probabilistic choice\n  + [typed_store_model.v](./theories/models//typed_store_model.v): alternative model of the typed store monad\n- applications:\n  + [example_relabeling.v](./theories/applications/example_relabeling.v): tree relabeling\n  + [example_monty.v](./theories/applications/example_monty.v): Monty Hall problem\n  + [example_spark.v](./theories/applications/example_spark.v): Spark aggregation\n  + [example_iquicksort.v](./theories/applications/example_iquicksort.v): in-place quicksort\n  + [example_quicksort.v](./theories/applications/example_quicksort.v): functional quicksort\n  + [example_nqueens.v](./theories/applications/example_nqueens.v): the n-queens puzzle\n  + [example_typed_store.v](./theories/applications/example_typed_store.v): ML programs with references\n  + [example_transformer.v](./theories/applications/example_transformer.v): monad transformers\n  + [smallstep.v](./theories/applications/smallstep.v): semantics for an imperative language, with equivalence operational semantics/denotation and sample imperative programs\n  + [monad_composition.v](./theories/applications/monad_composition.v): composing monads\n  + [category_ext.v](./theories/applications/category_ext.v): experimental library about categories\n\n## About Installation with Windows 11\n\nInstallation of monae on Windows is less simple.\nFirst install infotheo following the [instructions for Windows 11](https://github.com/affeldt-aist/infotheo).\nOnce infotheo is installed (with opam), do:\n- `opam install coq-monae` or `git clone git@github.com:affeldt-aist/monae.git; opam install .`\n\n## Original License\n\nBefore version 0.2, monae was distributed under the terms of the `GPL-3.0-or-later` license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faffeldt-aist%2Fmonae","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faffeldt-aist%2Fmonae","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faffeldt-aist%2Fmonae/lists"}