Created
February 27, 2012 14:37
-
-
Save athos/1924255 to your computer and use it in GitHub Desktop.
https://twitter.com/#!/wtakuo/status/173781581570387968 の解法を探るために使ったAlloyコード
This file contains 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
open util/ordering [Array] | |
sig Num {} | |
sig Array { | |
at: Num -> one Num | |
} | |
pred update(a, a': Array, i, v: Num) { | |
a'.at = a.at ++ i -> v | |
} | |
fact Traces { | |
all a: Array - last | one i: Num | some v: Num | | |
update [a, a.next, i, v] | |
} | |
check { | |
no a: Array | some k, v: Num | let a' = a.next | | |
{ | |
update [a, a', a.at [k], v] | |
a'.at [a'.at [k]] != v | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment