Skip to content

Commit 89bebf8

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

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

prover/strategies/core.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,44 @@ 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+
<id> ID </id>
125+
<strategy> #reap ~> Strat:Strategy </strategy>
126+
...
127+
</goal> => .Bag
128+
...
129+
</prover>
130+
requires notBool hasChildren(ID)
131+
132+
syntax Bool ::= hasChildren(GoalId) [function]
133+
rule [[ hasChildren(ID) => true ]]
134+
<parent> ID </parent>
135+
rule hasChildren(ID) => false [owise]
107136
```
108137

109138
Proving a goal may involve proving other subgoals:

0 commit comments

Comments
 (0)