Skip to content

Instantly share code, notes, and snippets.

@FlyingJester
Created February 12, 2017 23:25
Show Gist options
  • Save FlyingJester/03301b4cb907b045a1aa2cc4cfc76936 to your computer and use it in GitHub Desktop.
Save FlyingJester/03301b4cb907b045a1aa2cc4cfc76936 to your computer and use it in GitHub Desktop.
:- module rule_test.
:- interface.
:- type a ---> a1 ; a2.
:- type b ---> b1 ; b2.
% Verify that if a is a1, b is b2.
:- pred check(a::in, b::in) is semidet.
:- implementation.
% No rule for a1 and b1, since we said that if a1 then b must be b2.
check(a1, b2).
check(a2, b1).
check(a2, b2).
% Using an underscore means we don't care about the value.
% So alternatively, we could have written:
% check(a1, b2).
% check(a2, _).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment