Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c2e3087
for running on Anne's PC
claude Dec 6, 2025
aa78834
trying to make it work on my machine. now to vitruv issues anymore, i…
AnneKoziolek Dec 6, 2025
b5bfe6f
version that almost works on Anne's machine (16 paths), removed "iter…
AnneKoziolek Dec 7, 2025
5706342
fixed domain constrant upper bound, now getting 25 paths
AnneKoziolek Dec 7, 2025
c3a7b61
enable debug output
AnneKoziolek Dec 7, 2025
8e0ec87
testing whether tags survive boxing and unboxing -- looks good!
AnneKoziolek Dec 7, 2025
f2c5e7a
working on calling symbolic comparison from the reaction
AnneKoziolek Dec 7, 2025
1856989
new script to start things with flags
AnneKoziolek Dec 7, 2025
b8d0eb9
added tagging to reaction. Still need to work with that in the path e…
AnneKoziolek Dec 7, 2025
9ebcc25
remove manual constraints. Now the exploration runs, but generates to…
AnneKoziolek Dec 8, 2025
d480347
exploring paths based on constraints collected from Reaction
AnneKoziolek Dec 8, 2025
09a729c
add more to gitignore
AnneKoziolek Dec 19, 2025
56def08
fix task type - merge changes from CoCoPath main to here
IngridJiang Dec 16, 2025
25e4427
Merge remote-tracking branch 'upstream/main' into anne
AnneKoziolek Dec 19, 2025
2f5e422
copy new Amalthea Ascet generated source to here and successfully ran…
AnneKoziolek Dec 19, 2025
906bf36
debug output by class
AnneKoziolek Dec 19, 2025
dea839c
clean up reaction s file, it had dubplicated rows (but does not seem …
AnneKoziolek Dec 19, 2025
9100ec4
more debug output and a plan to do tags and comparisons in reaction
AnneKoziolek Dec 19, 2025
e27d5d5
working on gettings tags, variable names and constraints from reactio…
AnneKoziolek Dec 19, 2025
36794b4
working version that collects constraints based on tags and variable …
AnneKoziolek Dec 19, 2025
eac6c7d
refactoring AutomaticVitruvPathExploration and AutomaticVitruvMulti…
AnneKoziolek Dec 19, 2025
c6c6316
Let claude update the documentation, did not check all of it
AnneKoziolek Dec 19, 2025
e318cc1
removed another dependency on hardcoded variable name
AnneKoziolek Dec 19, 2025
f15eb80
working on two variable case
AnneKoziolek Dec 19, 2025
ee8c9ea
working on multivar case
AnneKoziolek Dec 19, 2025
5912c7f
better solve constraints to get next value.
AnneKoziolek Dec 19, 2025
1e2ecf9
one of the two variables is explored, now need to add the second one.…
AnneKoziolek Dec 19, 2025
6f40710
working on exploring the two values
AnneKoziolek Dec 19, 2025
02cf899
two variable case now works as well
AnneKoziolek Dec 20, 2025
3f910ca
now also output variable names on console and in json
AnneKoziolek Dec 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
383 changes: 383 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions COCOPATH_TECHNICAL_REPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,20 @@ CocoPath is a **concolic execution framework** for systematically exploring exec
```
INPUT: Initial value (e.g., user_choice = 0)
[PathExplorer creates tagged Integer with label]
Tag stores: variable name + symbolic expression
[PathExplorer passes concrete value to executor]
No tagging at this level
[Tagged value passed to execution wrapper]
[Vitruvius reaction receives concrete value]
[Execution wrapper reads tag] ← NEW: Tag Reading Step
Extracts: varName = tag.getLabels()[0]
Extracts: symbolicExpr = GaletteSymbolicator.getExpressionForTag(tag)
[Reaction calls GaletteSymbolicator.getOrMakeSymbolicInt]
Creates tag with qualified name: "CreateAscetTaskRoutine:execute:userChoice"
Reuses tag on subsequent iterations
Adds domain constraint automatically
[Tag propagates through execution via Galette shadow stack]
[Tagged value used in reaction]
[Constraints collected using tag-derived variable name]
PathUtils.addIntDomainConstraint(varName, 0, 5) ← Uses extracted varName
PathUtils.addSwitchConstraint(varName, concreteValue)
[Reaction calls SymbolicComparison.symbolicVitruviusChoice]
Records switch constraint with qualified name from tag
[PathConditionWrapper stores constraints]
Expand Down Expand Up @@ -775,7 +775,8 @@ For path (i, j):
**Collection Timeline** (per execution):
```
T0: PathExplorer creates Map<String,Object> inputs
{user_choice_1: taggedInt₁, user_choice_2: taggedInt₂}
{user_choice_1: concreteInt₁, user_choice_2: concreteInt₂}
(No tagging - reactions handle it)

T1: Reset PathConditionWrapper

Expand Down
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ This framework provides **concolic execution** (combined concrete + symbolic exe
- **Location**: `knarr-runtime/src/main/java/edu/neu/ccs/prl/galette/concolic/knarr/runtime/`
- **Key Classes**:
- `GaletteSymbolicator` - Creates symbolic values with tags
- `PathUtils` - Manual constraint collection API
- `addIntDomainConstraint(varName, min, max)` - manually Define valid value ranges
- `addSwitchConstraint(varName, value)` - Record executed path for switch case
- `getCurPC()` - Retrieve current path condition
- `getOrMakeSymbolicInt(qualifiedName, value, min, max)` - Create or reuse tag with domain constraint
- Tag reuse across iterations using qualified names (e.g., "CreateAscetTaskRoutine:execute:userChoice")
- `SymbolicComparison` - Records switch constraints from reactions
- `symbolicVitruviusChoice(selected, min, max)` - Records the actual choice made
- `PathExplorer` - Automatic path exploration orchestration
- `PathUtils` - Retrieves current path condition (`getCurPC()`)
- `ConstraintSolver` - Negates and solves constraints using GREEN/Z3

#### GreenSolver
Expand Down Expand Up @@ -160,6 +161,43 @@ amalthea-acset-integration/ # Vitruvius example
3. **Python 3.x** (for dependency switching)


### Helper Classes

- **`AutomaticVitruvPathExplorationHelper`** - Shared utilities for path exploration
- `verifyInstrumentation()` - Checks that Galette instrumentation is working
- `initializeEMF()` - Initializes EMF resource factories
- `loadVitruviusTestClass()` - Loads the Vitruvius Test class
- `createWorkingDirectory()` - Creates output directories
- `exportSingleVarResults()` - Exports single-variable exploration results
- `exportMultiVarResults()` - Exports multi-variable exploration results

### Syncing Generated Reactions (After Upstream Changes)

When the upstream Amalthea-acset project changes (e.g., renaming InterruptTask to InitTask), you need to sync the generated reactions code:

```bash
# 1. Build external Amalthea-acset to generate new reactions
cd /path/to/Amalthea-acset
mvn clean generate-sources

# 2. Copy generated reactions to internal project
cd knarr-runtime
./copy-generated-reactions.sh

# Or with custom paths:
./copy-generated-reactions.sh --external-path /path/to/Amalthea-acset

# 3. Build internal project with updated reactions
cd ../amalthea-acset-integration
mvn clean compile -Dcheckstyle.skip=true
```

The `copy-generated-reactions.sh` script:
- Copies generated reactions from `Amalthea-acset/consistency/target/generated-sources/reactions/mir/`
- To `amalthea-acset-integration/consistency/src/main/java/mir/`
- Creates backups of existing files
- Supports custom paths with `--external-path` and `--internal-path` flags

### Quick Start

```bash
Expand Down
68 changes: 47 additions & 21 deletions WORKFLOW_DIAGRAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
│ │ ├─ Create PathExplorer │ │
│ │ └─ Call exploreInteger() │ │
│ │ │ │
│ │ executeVitruvWithInput(testInstance, taggedInteger) │ │
│ │ ├─ [T3] PathUtils.addIntDomainConstraint("user_choice", 0, 5) │ │
│ │ │ → PC = [(0 <= user_choice < 5)] │ │
│ │ ├─ [T4] insertTask.invoke(testInstance, workDir, taggedInteger) │ │
│ │ ├─ [T5] PathUtils.addSwitchConstraint("user_choice", value) │ │
│ │ │ → PC += [user_choice == N] │ │
│ │ └─ [T6] return PathUtils.getCurPC() │ │
│ │ executeVitruvWithInput(testInstance, concreteInteger) │ │
│ │ ├─ [T3] insertTask.invoke(testInstance, workDir, concreteInteger)│ │
│ │ │ → Triggers Vitruvius reaction │ │
│ │ │ → Reaction calls GaletteSymbolicator.getOrMakeSymbolicInt│ │
│ │ │ → Creates/reuses tag + adds domain constraint │ │
│ │ │ → Reaction calls SymbolicComparison.symbolicVitruviusChoice│ │
│ │ │ → Records switch constraint │ │
│ │ └─ [T4] return PathUtils.getCurPC() │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
Expand All @@ -36,16 +37,15 @@
│ │ │ │ │
│ │ ├─ LOOP: while (hasUnexploredPaths && iteration < MAX) │ │
│ │ │ │ │ │
│ │ │ ├─ [T0] Create tagged Integer │ │
│ │ │ │ GaletteSymbolicator.tagInteger(value, varName) │ │
│ │ │ │ → Tagged(concrete=N, symbolic=α, label=varName) │ │
│ │ │ ├─ [T0] Pass concrete value to executor │ │
│ │ │ │ (No tagging - reactions handle it) │ │
│ │ │ │ │ │
│ │ │ ├─ [T1] Reset PC: PathUtils.getCurPC().clear() │ │
│ │ │ ├─ [T1] Reset PC: PathUtils.resetPC() │ │
│ │ │ │ │ │
│ │ │ ├─ [T2-T6] Execute: executor(taggedInteger) │ │
│ │ │ ├─ [T2-T4] Execute: executor(concreteInteger) │ │
│ │ │ │ → Returns PathConditionWrapper │ │
│ │ │ │ │ │
│ │ │ ├─ [T7] Store PathRecord {inputs, constraints, time} │ │
│ │ │ ├─ [T5] Store PathRecord {inputs, constraints, time} │ │
│ │ │ │ │ │
│ │ │ ├─ Find unexplored constraint to negate │ │
│ │ │ │ │ │
Expand Down Expand Up @@ -101,12 +101,14 @@
┌──────────────────────────────────────▼──────────────────────────────────────┐
│ TAG PROPAGATION LAYER (Galette) │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ GaletteSymbolicator.java │ │
│ │ GaletteSymbolicator.java (Called from Reactions) │ │
│ │ │ │
│ │ tagInteger(int value, String label) │ │
│ │ ├─ Create Tag(label, IntVariable(label)) │ │
│ │ ├─ Associate tag with Integer object │ │
│ │ └─ return Tagged Integer │ │
│ │ getOrMakeSymbolicInt(qualifiedName, value, min, max) │ │
│ │ ├─ Check labelToTag map for existing tag │ │
│ │ ├─ If exists: reuse tag (tag reuse across iterations) │ │
│ │ ├─ If new: create Tag + IntVariable + domain constraint │ │
│ │ ├─ Apply tag with Tainter.setTag(value, tag) │ │
│ │ └─ Return tagged integer │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
Expand Down Expand Up @@ -265,13 +267,37 @@ START: PathExplorer.exploreInteger("user_choice", 0, executor)
END: Return List<PathRecord> with 5 paths
```

## 3. Constraint Collection Timeline (Single Iteration)
## 3. Vitruvius Reaction Flow (NEW - Tag Creation in Reactions)

```
┌────────────────────────────────────────────────────────────────────────┐
│ Vitruvius Reaction Execution │
│ │
│ 1. UserInteraction.startInteraction() returns concrete value │
│ ↓ │
│ 2. Reaction calls GaletteSymbolicator.getOrMakeSymbolicInt() │
│ - qualifiedName: "CreateAscetTaskRoutine:execute:userChoice" │
│ - Creates tag on first iteration │
│ - Reuses tag on subsequent iterations │
│ - Adds domain constraint [min, max] │
│ ↓ │
│ 3. Tagged value returned to reaction │
│ ↓ │
│ 4. Reaction calls SymbolicComparison.symbolicVitruviusChoice() │
│ - Records switch constraint for specific choice │
│ - Uses qualified name from tag │
│ ↓ │
│ 5. Reaction executes appropriate transformation │
└────────────────────────────────────────────────────────────────────────┘
```

## 4. Constraint Collection Timeline (Single Iteration)

```
Time Event Location PC State
─────────────────────────────────────────────────────────────────────────────────────
T0 Create tagged Integer PathExplorer:69 []
GaletteSymbolicator.tagInteger(0, "user_choice")
T0 Pass concrete value PathExplorer:69 []
executor.execute(0) (no tagging yet)

T1 Reset PC PathExplorer:71 []
PathUtils.getCurPC().clear()
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import tools.vitruv.dsls.reactions.runtime.state.ReactionExecutionState;
import tools.vitruv.dsls.reactions.runtime.structure.ReactionsImportPath;

/**
* Generated Java Code from Reactions DSL.
*
*/
@SuppressWarnings("all")
public class Amalthea2ascetChangePropagationSpecification extends AbstractReactionsChangePropagationSpecification
implements ChangePropagationSpecification {
Expand Down
Loading
Loading