{"id":21340040,"url":"https://github.com/imandra-ai/verified-react","last_synced_at":"2025-07-12T14:32:51.648Z","repository":{"id":41802253,"uuid":"152997489","full_name":"imandra-ai/verified-react","owner":"imandra-ai","description":"Automated reasoning for React/ReasonML","archived":false,"fork":false,"pushed_at":"2023-01-04T21:39:44.000Z","size":1353,"stargazers_count":111,"open_issues_count":15,"forks_count":4,"subscribers_count":17,"default_branch":"master","last_synced_at":"2023-11-07T17:15:24.226Z","etag":null,"topics":["imandra","react","reason-react","reasonml"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imandra-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-14T16:59:07.000Z","updated_at":"2023-10-17T22:33:34.000Z","dependencies_parsed_at":"2023-02-02T21:01:18.837Z","dependency_job_id":null,"html_url":"https://github.com/imandra-ai/verified-react","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Fverified-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Fverified-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Fverified-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imandra-ai%2Fverified-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imandra-ai","download_url":"https://codeload.github.com/imandra-ai/verified-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225824980,"owners_count":17529905,"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","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":["imandra","react","reason-react","reasonml"],"created_at":"2024-11-22T00:48:52.350Z","updated_at":"2024-11-22T00:48:53.261Z","avatar_url":"https://github.com/imandra-ai.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VerifiedReact\n\n[![Build Status](https://travis-ci.org/AestheticIntegration/verified-react.svg?branch=master)](https://travis-ci.org/AestheticIntegration/verified-react)\n\nWelcome to VerifiedReact! This is work in progress - stay in touch via [@VerifiedByAI](https://www.twitter.com/verifiedbyai), or come chat with us on [Discord](https://discord.gg/byQApJ3).\n\nFor an overview, read our Medium post [Introducing Verified React](https://medium.com/imandra/introducing-verified-react-9c2ef03f821b).\n\n![Verified React logo](/verified-react-logo.png)\n\n## Ideas, aims and progress so far\n\n- [x] Stage 1  (Counter, TicTacToe)\n  - [x] Simpler automation of Imandra:\n    - added `imandra-http-server` as an alternative to `imandra-repl` to allow automation via an HTTP api, bundled with the [Imandra installer](https://docs.imandra.ai/imandra-docs/notebooks/installation-simple/). Previously you could automate our `imandra-repl` process via stdin/stdout, but having an HTTP interface to the Imandra client naturally makes life a lot easier. `imandra-http-server` is built using our `Imandra_client` OCaml library, which we're hoping to make available as an `opam` package in the future, so OCaml users can use the Imandra client directly from their code.\n    - added [`bs-imandra-client`](https://github.com/AestheticIntegration/bs-imandra-client) - bucklescript bindings to that HTTP api to be used when running on Node\n  - [x] Allow export of export of core logic verified with Imandra to code that can be compiled to executable JS\n    - Imandra comes with a prelude of pre-verified functions for use from `.iml` (Imandra-ml) or `.ire` (Imandra-reason) code. When you're done reasoning and want to compile the verified module into a larger program, you need a `.ml` version of the prelude to compile alongside your module. Previously this was available to compile as native OCaml package, but we've now also included an initial amended version that compiles to javascript via the bucklescript compiler too, which can be `npm installed` from the [`imandra-prelude`](https://github.com/AestheticIntegration/imandra-prelude) repo.\n  - [x] Automation of verification goals via `jest`, via `imandra-http-server`. See:\n    - `examples/simple/__tests__/Counter_Goals.ml`\n    - `examples/tictactoe/__tests__/TicTacToe_Logic_Goals.re`\n    - `examples/todomvc/__tests__/TodoMvc_Model_Goals.re`\n  - [x] Hook verified state machine up to React reducer component. See:\n    - `examples/tictactoe/TicTacToe.re`\n\n- [ ] Stage 2\n  - [x] [Viewing instances](#viewing-instances) - also see [our blog post](https://medium.com/imandra/constraint-solving-your-uis-8933f4cf8927)\n  - [x] TodoMVC as a larger example\n  - [ ] Decomposition visualisation\n\n- [ ] Stage 3\n  - [ ] Collecting React reducer events from React unit test runs\n  - [ ] Map reducer events back to state machine events, and visualise coverage on the decomposition\n  - [ ] Coverage report of state space as hit by your jest tests\n\n## Setup\n\nMake sure you have the latest version of `imandra-repl` installed via the [Imandra Installer](https://docs.imandra.ai/imandra-docs/notebooks/installation/), then run\n\n    imandra-repl\n\nand make sure it starts up successfully (i.e. all updates are installed). Once it's started, quit it again with Ctrl-D. Next:\n\n    npm install\n\nto install the bucklescript compiler, `imandra-prelude` and Imandra client bindings for bucklescript. Then:\n\n    npm run watch\n\nYou may see a few errors the first time you run watch - this I believe is due to an issue with `components` in `bsb.exe` as they are a WIP. However, if you run `npm run watch` multiple times, you should stop seeing errors after a few builds, and from then on incremental compilation will work sucessfully.\n\n## The compilation chain\n\nFor runtime:\n\n- `.iml` and `.ire` files are compiled to `.ml` files using `imandra-extract` (which is bundled with the [Imandra Installer](https://docs.imandra.ai/imandra-docs/notebooks/installation/)), and integrated into the build via `bsb` components.\n- `.ml` and `.re` files are compiled to `.bs.js` via `bsb` itself.\n- `Imandra_prelude` is available automatically inside `imandra-http-server`\n- When compiling to javascript, `Imandra_prelude` is provided by [imandra-prelude](https://github.com/AestheticIntegration/imandra-prelude), added as an npm/bucklescript dependency.\n\n## Verification tests:\n\n- Tests are run via Jest on node.js using the compiled runtime JS files.\n- As part of the test run, the Imandra client bucklescript bindings (`bs-imandra-client`) are used to spin up `imandra-http-server` (which is bundled as part of the [Imandra Installer](https://docs.imandra.ai/imandra-docs/notebooks/installation/)), which is an OCaml binary talking to Imandra's reasoning engine in the cloud.\n- The HTTP Imandra client API is used to load `.iml` and `.ire` files into the running `imandra-http-server` OCaml process, and perform verification statements.\n- The verification results are captured and reported back as part of the Jest test run.\n\nTo run the verification goals:\n\n    npm run test\n\n## Viewing instances\n\n[Read our post about viewing instances in your UIs with Imandra](https://medium.com/imandra/constraint-solving-your-uis-8933f4cf8927).\n\nThe TicTacToe example is hooked up to Imandra to allow querying and viewing instances. To start it, from the `verified-react` repo root run:\n\n    imandra-http-server -reason\n\nto start Imandra's http server with `reason` syntax loaded. Then for bucklescript compilation, (in another terminal) run:\n\n    npm install\n    npm run watch\n\nThen, to start the parcel.js dev server, (in another terminal) run:\n\n    npm run watch-tictactoe\n\nYou should now be able to visit `http://localhost:1234` to see/play the TicTacToe game (verified via the `npm run test` Jest tests), and also query for instances from Imandra.\n\n### How it works\n\nThe TicTacToe UI is [wrapped in an InstanceBrowser component](./examples/tictactoe/Index.re), which loads the game logic into Imandra (along with some JSON encoders and decoders) via [`examples/tictactoe/Setup.ire`](examples/tictactoe/Setup.ire).\n\nThe TicTacToe UI component has been edited slightly to allow a default intial state to be passed from its parent via the `customInitialLogicState` prop.\n\nWhen the instance query box's contents change, the query is sent to `imandra-http-server`'s `/instance/by-src` endpoint as a lambda expression, `x : game_state =\u003e \u003cconstraint\u003e`, so an instance of type `game_state` matching the constraint is returned, printed to a JSON string via a serialisation function (`instancePrinterFn`).\n\nThis returned instance is then passed to the `customInitialLogicState` prop and rendered by the UI component.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimandra-ai%2Fverified-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimandra-ai%2Fverified-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimandra-ai%2Fverified-react/lists"}