{ "cells": [ { "cell_type": "markdown", "id": "31f7a2f6-4a03-47fa-848c-a2e05bc91090", "metadata": {}, "source": [ "# Extracting macro-dynamics\n", "\n", "We use the termites model to show how macro-dynamics can be extracted.\n", "\n", "First, we load the model and build its state-space as a single-node component-graph `g`. Then, we define our target formula: all kind of termites are present." ] }, { "cell_type": "code", "execution_count": 1, "id": "56c4c490-2e5a-4ff3-8ddd-0a0563f3982f", "metadata": {}, "outputs": [], "source": [ "%run -m ecco rr-termites.rr\n", "g = model()\n", "phi = \"(Rp & Sd & Wk)\"" ] }, { "cell_type": "markdown", "id": "717e08ea-f7a9-4afc-a997-d8f82a0bda2f", "metadata": {}, "source": [ "Then, we split against two properties: `phi` itself, and `f\"EF{phi}\"` (where `f\"...{phi}...\"` allows in Python to insert formula `phi` into another string)." ] }, { "cell_type": "code", "execution_count": 2, "id": "3c2fb4f1-fc6f-4946-a77c-e73336593b4b", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "3897ff12514f4922b554d1baaab17d88", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(Accordion(children=(VBox(children=(HBox(children=(Dropdown(description='layout', index=3, optio…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "g1 = g.split(phi=phi, EF_phi=f\"EF{phi}\")\n", "g1" ] }, { "cell_type": "code", "execution_count": 3, "id": "3a6bd2b5-bc62-45b6-9b35-45760026ebd3", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | traps | \n", "size | \n", "consts | \n", "HASNO | \n", "HAS | \n", "CONTAINS | \n", "ISIN | \n", "EQUALS | \n", "
---|---|---|---|---|---|---|---|---|
node | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
1 | \n", "() | \n", "12 | \n", "(Ec+, Fg+, Md+, Rp+, Sd+, Wk+) | \n", "(DEAD, INIT) | \n", "(scc) | \n", "(hull) | \n", "(EF_phi, HULL) | \n", "(phi) | \n", "
3 | \n", "(1) | \n", "34 | \n", "(Rp+) | \n", "(DEAD, phi) | \n", "(HULL) | \n", "(INIT, hull, scc) | \n", "(EF_phi) | \n", "() | \n", "
4 | \n", "() | \n", "68 | \n", "(Rp-, Wk-) | \n", "(EF_phi, HULL, INIT, hull, phi, scc) | \n", "() | \n", "(DEAD) | \n", "() | \n", "() | \n", "