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

Explanation arrow: which rule justifies the atom? #22

Open
stephanzwicknagl opened this issue Dec 2, 2023 · 1 comment
Open

Explanation arrow: which rule justifies the atom? #22

stephanzwicknagl opened this issue Dec 2, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@stephanzwicknagl
Copy link
Collaborator

  • if component with multiple rules, it's not obvious which rule derived the atom
  • highlight (bold?) rule when explanation is triggered
  • the information is there, so it should be doable
@stephanzwicknagl stephanzwicknagl added the enhancement New feature or request label Dec 2, 2023
@stephanzwicknagl stephanzwicknagl self-assigned this Dec 2, 2023
@stephanzwicknagl stephanzwicknagl changed the title which rule justifies atom in explanation Explanation arrow: which rule justifies the atom? Dec 2, 2023
@stephanzwicknagl stephanzwicknagl added this to the Up Next milestone Jul 1, 2024
@stephanzwicknagl
Copy link
Collaborator Author

example program

bend(X1,Y1,V) :- go(X,Y,X1,Y1,N,M); go(X1,Y1,_,_,N1,M1); N = N1; M = M1; bend(X,Y,V).
bend(X1,Y1,(V-1)) :- go(X,Y,X1,Y1,N,M); go(X1,Y1,_,_,N1,M1); N != N1; M != M1; bend(X,Y,V); (V-1) >= 0.
bend(X1,Y1,V) :- go(X,Y,X1,Y1,N,M);

Justifier program before

h(2, bend(X1,Y1,V), r) :- d, R1.
h(2, bend(X1,Y1,(V-1)), r) :- d, R2.
h(2, bend(X1,Y1,V), r) :- d, R3.

Justifier program edit

h(2, 1, bend(X1,Y1,V), r) :- d, R1.
h(2, 2, bend(X1,Y1,(V-1)), r) :- d, R2.
h(2, 3, bend(X1,Y1,V), r) :- d, R3.

stephanzwicknagl added a commit that referenced this issue Aug 5, 2024
stephanzwicknagl added a commit that referenced this issue Aug 8, 2024
Upon clicking an atom, the rule that derives it is highlighted in the
rule header, aside from showing the arrows to reason atoms.

To find the rule that derives an atom from a component with multiple
rules, the justifier program was modified:

````
h(I, J, d, r) :- d, r.
```
where I is the index of the component, J is the index of the rule within
the component, d is the atom, and r are the reason atoms.

The node dataclass stores a dictionary mapping the atoms in the node
to the hash of the rule it derives from. This attribute of the node is
queried through the API when an atom is clicked.

The React App then stores the highlighted rules in the context
HighlightedSymbol in the shape
```
HighlightedRule { rule_hash: string, color: string, source_id: string }
```

Contributes: #22
stephanzwicknagl added a commit that referenced this issue Aug 12, 2024
stephanzwicknagl added a commit that referenced this issue Aug 14, 2024
For the justifier program, we have a rule hash that is used to identify
the rule that justifies an atom. This hash is computed by hashing the
string of the rule. This ensures that even for multiple dependants
of the same rule, the hash is always the same.

Contributes: #22
stephanzwicknagl added a commit that referenced this issue Sep 3, 2024
stephanzwicknagl added a commit that referenced this issue Sep 10, 2024
stephanzwicknagl added a commit that referenced this issue Sep 10, 2024
stephanzwicknagl added a commit that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant