triz_rule_apply
Apply double-pushout rewriting rules to TRIZ function models: list valid matches or apply a chosen match to delete and create boxes, ports, and wires, returning a type-checked model.
Instructions
Double-pushout rewriting with rules as data. A rule is a span L ← K → R of patterns over the function-model schema (boxes with ports typed by carrier variables, and wires); pass it as rule, or name a built-in evolution-line rule with rule_id: 'mono-bi' (transition to supersystem, mono → bi; apply again for poly), 'feedback' (increasing controllability, self-adjusting with feedback; bind its carrier variable 's' with carriers), or 'working-field' (changing the working field: the matched function re-made on another carrier; bind 'd' with carriers to a carrier other than the matched one; the result's fieldChanges records both carriers' layer and dimension). Each built-in rule cites the evolution-trends.md line it encodes. rule_id 'uneven-development' is a detector, not a rewrite, and takes only the model: the lagging subsystem, a box of the largest harm-loop region that is also on a binding feasibility dimension or limits a deliverable (feasibility finds it unprovidable, or it performs an insufficient function on a product); verdict lagging, none, or undecided (no harm loop, or feasibility undecided). Without match: lists every injective match of L (seed it with at), each verified as a typed homomorphism and marked applicable when the no-identification and no-dangling conditions hold (a deleted box may not lie on a declared flow) and the rule's distinct carrier variables bind different carriers; decided:false if the step budget runs out, complete:false past limit. A rule's forbid holds negative application conditions (Habel–Pennemann): each pattern extends left by id, and a match that extends to an occurrence of one — including any elements the pattern adds — is not applicable; a condition its own step budget cannot decide also refuses the application. With match (a listed match, or your own mapping): checks the match, these conditions, and that a kept box keeps the ports its declared rows name (every port for behavior and transition; the named ports for feasibility), then deletes the image of L \ K, glues R \ K under fresh ids, and returns the new model, which type-checks or the call fails closed; deliverableKeysChanged says a deliverable moved to another port or carrier. A rule application is a structural move, not evidence that it helps: compare the result with triz_function_model compare_to.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | No | Partial match that seeds the search, e.g. { wires: { f: 'w-drive' } } | |
| ids | No | Ids for created elements; default: fresh ids based on the rule's or the copied element's | |
| rule | No | An inline rule; give this or rule_id | |
| limit | No | Most matches to list (default 50) | |
| match | No | The match to apply at; omit to list matches | |
| model | Yes | ||
| rule_id | No | A built-in evolution-line rule, or the 'uneven-development' detector | |
| carriers | No | Carrier variable used only on the right side → model carrier id | |
| max_steps | No | Search step budget (default 100000) |