Alloyãªãä»æ§è¨è¿°è¨èª (本家サイト)ã§åã®å®ç¾©ãæ¸ãã¦ã¿ã¾ããããªãAlloyãã¯ãä¸å¿ç®çã¯ããã®ã§ç¶ããããã°æ¸ãã¾ãããç¹ã«æ·±ãæå³ã¯ãªãã§ããä»æ§è¨è¿°è¨èªãªãä½ã§ãè¯ãã£ãã¨ãã話ãã
ã§ãããã«æ¸ãã¦ããã人ãå°ãªãã¨æãããç¾ç¶ãã»ã¨ãã©èªååãã®ã¡ã¢ã§ãã
ã§ã以ä¸ãééã£ã¦ããããããªããã©ããã
sig Object {} sig Category { objs: set Object, // 対象ã®éå hom: objs -> objs // å°ã®éåï¼homéåï¼ } { objs <: iden in hom // æçå°ã®åå¨ hom.hom in hom // 追å ï¼composition ã«ã¤ãã¦éãã¦ãã }
å½ç¶è²ã¤ããªãããªãããã
æ¬å½ã¯ãã¡ãã¼ã£ã¨idã®å®ç¾©ããããããªãã®ã§ãããã¨ããããã»ã£ã¨ãã¾ããçµã¿è¾¼ã¿ã§idenãªããã®ããã£ããã§ããã£ã¡ä½¿ãããä¿®æ£ãã¾ããã
iden ã¦ã®ã¯ãæçååå
¨ä½ã®éåã§ãã"<:"ãªã©ã¨ããç´ããããè¨å·ã¯ããã¡ã¤ã³ãéå®ããããã®ãã®ã"objs <: iden" ã§ãobjs ããã¡ã¤ã³ã¨ãã¦ããæçååå
¨ä½ã®éåãå¾ããã¾ãã
çµåæ§ã¯ãAlloyããã¼ã¹ã«ãã¦ã relational logic*1 ã®ç¹è³ªãããæ示ããªãã¦ãè¨ãã¦ãã¾ãã¨æããã¾ããå®éã以ä¸ã®è¡¨æãéãã¾ãã
assert associative { all f,g,h : Category.hom { f.(g.h) = (f.g).h } }
以ä¸è足ã§ãããããã§*2
check associative
ã¨ãæ¸ãã¨
Executing "Check associative" Solver=sat4j Bitwidth=4 MaxSeq=4 Symmetry=20 613 vars. 69 primary vars. 1191 clauses. 125ms. No counterexample found. Assertion may be valid. 125ms.
ã¨ããªã£ã¦åä¾ãªãã