gpt4 book ai didi

prolog - 扩展统一,SICStus 风格

转载 作者:行者123 更新时间:2023-12-03 13:59:07 24 4
gpt4 key购买 nike

我想了解 SICStus 风格的可扩展统一。
User's Manual on library(atts) 指出:

Module:verify_attributes(-Var, +Value, -Goals) hook

...
verify_attributes/3 may invoke arbitrary Prolog goals, but Var should not be bound by it. Binding Var will result in undefined behavior.
...
In the case when a single unification binds multiple attributed variables, first all such bindings are undone, then the following actions are carried out for each relevant variable:

  1. For each relevant module M, M:verify_attributes/3 is called, collecting a list of returned Goals.
  2. The variable binding is redone.
  3. Any Goals are called.
  4. Any goals blocked on the variable, that has now become unblocked, are called.

到目前为止,我对上述内容提出了以下解释:
  • 不同verify_attribute/3处理程序迷上了 Var ,见Var的相同状态: 所有人都看到它“pre_unify”。
  • verify_attribute/3不得绑定(bind) Var ,但它可能会绑定(bind)其他属性变量。
  • 这些绑定(bind)也将被延迟,以便处理程序不仅看到 Var 的相同状态, 但属于 全部 涉及的属性变量。
    上面的 Action 列表需要“5.强制属性变量的任何延迟绑定(bind)”。

  • 我是否朝着正确的方向前进——是 这个什么是“完成,然后撤消,然后重做”?
    请帮忙!

    最佳答案

    该机制最初由 Christian Holzbaur 设计,并由您真正实现。关于。你的解释:

    Different verify_attribute/3 handlers hooked on Var, see the samestate of Var: All see it "pre_unify".


    对。

    verify_attribute/3 must not bind Var, but it may bind otherattributed variables.


    对。

    These bindings are to be delayed, too, so that the handlers not onlysee the same state of Var, but of all attributed variables involved.


    错误的。如果它绑定(bind)其他属性变量,则整个扩展统一机制会在这些变量上递归调用。

    Above list of actions entails "5. Force any delayed bindings ofattributed variables."


    错误的。

    关于prolog - 扩展统一,SICStus 风格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64786512/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com