Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplification コマンドに --prepare オプションを追加した #48

Merged
merged 3 commits into from
Sep 25, 2024

Conversation

cedretaber
Copy link
Collaborator

@cedretaber cedretaber commented Sep 11, 2024

修正内容: https://hackmd.io/n7zyyweESjap8K8Qxk3kfA

概要

simplification コマンドに --prepare オプションを付けることで、 view がある場合に、その view と同名のΔ述語が存在しているかのように処理される。
詳しくはサンプルコードを見てみてください。

サンプルコード

source x('A':int).
view v('A':int).

+x(A) :- x(A), v(A), A <> 42.
-x(A) :- +x(A), -v(A).
❯ dune exec bin/simplification.exe -- examples/simplification_prepare1.dl
source x('A':int).                     
view v('A':int).
+x(A) :- v(A) , x(A) , not A = 42.

❯ dune exec bin/simplification.exe -- examples/simplification_prepare1.dl --prepare
source x('A':int).                     
view v('A':int).
-x(A) :- -v(A) , +x(A).
+x(A) :- v(A) , x(A) , not A = 42.

-v(A) は存在しないため、 simplification コマンドを使うと -x(A) :- +x(A), -v(A). は偽とみなされて消されてしまう。
しかし、 --prepare オプションを付けると、 view である v から +v(A)-v(A) が存在するとみなされるので、 -x(A) も残る。

delta insert の場合も同様。

source x('A':int).
view v('A':int).

+x(A) :- x(A), v(A), A <> 42.
-x(A) :- +x(A), +v(A).
❯ dune exec bin/simplification.exe -- examples/simplification_prepare2.dl 
source x('A':int).                     
view v('A':int).
+x(A) :- v(A) , x(A) , not A = 42.

❯ dune exec bin/simplification.exe -- examples/simplification_prepare2.dl --prepare
source x('A':int).                     
view v('A':int).
-x(A) :- +v(A) , +x(A).
+x(A) :- v(A) , x(A) , not A = 42.

@cedretaber cedretaber self-assigned this Sep 11, 2024
@hiroyukikato
Copy link
Collaborator

Thank you! LGTM

@hiroyukikato hiroyukikato deleted the add-prepare-option-on-simplification branch September 19, 2024 12:04
@cedretaber cedretaber restored the add-prepare-option-on-simplification branch September 19, 2024 12:14
@cedretaber cedretaber reopened this Sep 19, 2024
@cedretaber cedretaber merged commit 3b52686 into master Sep 25, 2024
4 checks passed
@cedretaber cedretaber deleted the add-prepare-option-on-simplification branch September 25, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants