Created
November 14, 2024 00:11
-
-
Save msakai/d9c0243b36ad3917c8f39dff91c47a59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sig E { | |
join, meet : E -> one E | |
} | |
one sig top, bot in E {} | |
fact { | |
all x, y, z : E { | |
-- commutativity | |
x.join[y] = y.join[x] | |
x.meet[y] = y.meet[x] | |
-- associativity | |
(x.join[y]).join[z] = x.join[y.join[z]] | |
(x.meet[y]).meet[z] = x.meet[y.meet[z]] | |
-- unit laws | |
x.meet[top] = x | |
x.join[bot] = x | |
-- idempotence | |
x.join[x] = x | |
x.meet[x] = x | |
-- asborption | |
x.meet[x.join[y]] = x | |
x.join[x.meet[y]] = x | |
} | |
} | |
pred show {} | |
run show for 5 E | |
assert wellDefinedOrdering { | |
all x, y : E { | |
x.join[y]=x <=> x.meet[y]=y | |
} | |
} | |
check wellDefinedOrdering for 7 E | |
pred distributivity { | |
all x, y, z : E | x.meet[y.join[z]] = (x.meet[y]).join[x.meet[z]] | |
} | |
run distributivity for 5 E | |
assert linearDistributivityAsEquality { | |
distributivity => | |
all x, y, z : E | x.meet[y.join[z]] = x.meet[y].join[z] | |
} | |
check linearDistributivityAsEquality for 7 E | |
pred le[x : E, y : E] { | |
x.join[y] = y | |
} | |
assert linearDistributivityAsInequality { | |
distributivity => | |
all x, y, z : E | le[x.meet[y.join[z]], x.meet[y].join[z]] | |
} | |
check linearDistributivityAsInequality for 7 E |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment