
occurs.pl -- Finding and counting sub-termsThis is a SWI-Prolog implementation of the corresponding Quintus library, based on the generalised arg/3 predicate of SWI-Prolog.
contains_term(+Sub, +Term) is semidet
contains_var(+Sub, +Term) is det
free_of_term(+Sub, +Term)
free_of_var(+Sub, +Term)
occurrences_of_term(+SubTerm, +Term, ?Count)
occurrences_of_var(+SubTerm, +Term, ?Count)
sub_term(-Sub, +Term)
sub_var(-Sub, +Term)
sub_term_shared_variables(+Sub, +Term, -Vars) is detAn example use-case is refactoring a large clause body by introducing intermediate predicates. This predicate can be used to find the arguments that must be passed to the new predicate.
term_replace_(+From, +To, +TermIn, -TermOut, +Done)[private]
intersection_eq(+Small, +Big, -Shared) is det[private]
count(:Goal, -Count)[private]