Skip to content

Commit 537952b

Browse files
committed
Reap failed goals and children (TODO: This uses [owise]
1 parent fed7bf9 commit 537952b

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

prover/strategies/core.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,37 @@ completed, its result is replaced in the parent goal and the subgoal is removed.
9595
<strategy> goalStrat(ID) => RStrat ... </strategy>
9696
...
9797
</goal>
98-
( <goal> <id> ID </id>
99-
<active> true:Bool </active>
100-
<parent> PID </parent>
101-
<strategy> RStrat:TerminalStrategy </strategy>
102-
...
103-
</goal> => .Bag
104-
)
98+
<goal> <id> ID </id>
99+
<active> true:Bool => false </active>
100+
<parent> PID </parent>
101+
<strategy> (.K => #reap?) ~> RStrat:TerminalStrategy </strategy>
102+
...
103+
</goal>
105104
...
106105
</prover>
106+
107+
syntax KItem ::= "#reap?" // if goal failed prune goal and children
108+
rule <strategy> (#reap? => #reap) ~> fail </strategy>
109+
rule <strategy> (#reap? => .K ) ~> success </strategy>
110+
111+
syntax KItem ::= "#reap" // (always) prune goal and children
112+
rule <goal>
113+
<id> PID </id>
114+
<strategy> #reap ~> RStrat:TerminalStrategy </strategy>
115+
...
116+
</goal>
117+
<goal>
118+
<parent> PID </parent>
119+
<strategy> (.K => #reap) ~> Strat:Strategy </strategy>
120+
...
121+
</goal>
122+
rule <prover>
123+
<goal>
124+
<strategy> #reap ~> Strat:Strategy </strategy>
125+
...
126+
</goal> => .Bag
127+
...
128+
</prover> [owise]
107129
```
108130

109131
Proving a goal may involve proving other subgoals:

0 commit comments

Comments
 (0)