MCPcopy Create free account
hub / github.com/github/gh-aw / termSubsumedBy

Function termSubsumedBy

pkg/workflow/expression_optimizer.go:192–205  ·  view source on GitHub ↗

termSubsumedBy returns true when cand is subsumed by sub, meaning sub |= cand (cand is "more specific"). In a disjunction this makes cand redundant: disj(sub, cand) = sub. Only applies when neither term contains a status func. Example: sub=A, cand=A&&B → every model satisfying A&&B also satisfies A

(cand, sub ConditionNode)

Source from the content-addressed store, hash-verified

190// Example: sub=A, cand=A&&B → every model satisfying A&&B also satisfies A,
191// so A already covers A&&B in a disjunction.
192func termSubsumedBy(cand, sub ConditionNode) bool {
193 if nodesEqual(cand, sub) {
194 return false // identical terms are handled by dedup, not subsumption
195 }
196 if containsStatusFunc(cand) || containsStatusFunc(sub) {
197 return false
198 }
199 for _, ct := range collectAndTerms(cand) {
200 if nodesEqual(ct, sub) {
201 return true
202 }
203 }
204 return false
205}
206
207// --- node-specific optimisers ------------------------------------------------
208

Callers 2

optimizeOrNodeFunction · 0.85
optimizeDisjunctionNodeFunction · 0.85

Calls 3

nodesEqualFunction · 0.85
containsStatusFuncFunction · 0.85
collectAndTermsFunction · 0.85

Tested by

no test coverage detected