Add sub_all_clause

This commit is contained in:
Emi Simpson 2023-03-05 21:22:29 -05:00
parent 46bbcca1b8
commit ad4ed220b6
Signed by: Emi
GPG key ID: A12F2C2FFDC3D847

13
ir.py
View file

@ -181,6 +181,19 @@ Applies every substitution to the term in order
kismesis(Karkat(), Karkat()) kismesis(Karkat(), Karkat())
""" """
sub_all_clause: Callable[[Substitutions, Clause], Clause] = uncurry2(c(p_map, cur2(sub_all))) #type:ignore
"""
Perform a series of substitutions on every term in a list
Effectively calls `sub_all()` on every element of the list.
>>> sub_all_clause(
... [Subst('x1', IRVar('Dave')), Subst('x2', IRProp('Karkat'))],
... [IRProp('dating', [IRVar('x1'), IRVar('x2')]), IRVar('x1')],
... )
[dating(Dave(),Karkat()), Dave()]
"""
def unify(t1: IRTerm, t2: IRTerm) -> Result[Substitutions, UnificationError]: def unify(t1: IRTerm, t2: IRTerm) -> Result[Substitutions, UnificationError]:
""" """
Attempt to find a substitution that unifies two terms Attempt to find a substitution that unifies two terms