æè¿ã¤ã³ã¿ã¼ã³ã®ãããµã³åã« UCLA ã®ææãããã£ã¦è«çã®åå¼·ããã¦ãããæè¿ãã£ã¦ã Alloy ã«ã¯ããã¯ã¨ã³ãã¨ã㦠SAT ã¨ããç©ã使ããã¦ãã¦ããã®ä»çµã¿ãç¥ãããã¨è¨ã£ããææãããããæ Prolog ãä½ã£ã http://d.hatena.ne.jp/propella/20090502/p1 äºã ã楽åããï¼ã¨æã£ã¦ããã ãã©ãªããªãé£ãããä¸é±éçµã£ã¦ãçµãããªããå¿ããã¨å°ãã®ã§è¦ããäºãããã«æ¸ãã
ç®çã¯ãã¼ã«æ¼ç®ã使ã£ã¦æ¨è«ãããäºã
ããã°ã©ãã«ã¨ã£ã¦ã¯ãã¼ã«æ¼ç®ã¯ã¨ã¦ã身è¿ãªç©ã ã使ãå¤ã¯ true 㨠false ã ããæ¼ç®å㯠and or not ã®ä¸ã¤ã§ããããã©ããã£ã¦ãé£ãããªããããç¡ãã¨æãããããªããªãé¢ç½ãåé¡ãåãã§ããããã¼ã«æ¼ç®ã®è©±ãé£ãããªãã®ã¯ãã¡ã¿ãªè©±é¡ãä¸ç¨æã«æ··ããããã ã¨æããä¾ãã°
- true ⧠false = false (ç and å½ ã¯ å½)
ã¨ããå¼ããã®å¼èªä½ããã¼ã«å¤ãæã£ã¦ããã®ã§
- (true ⧠false = false) = true
ã®ããã«ãã¦ãçå¼ã®æ§è³ªãã¾ããã¼ã«å¼ã ã¨ãããããããäºã«ãªããããã«ãã¼ã«å¼ãéåã¨æãäºãåºæ¥ãã®ã§ããã«ãããããã¦ãåãäºãè¨ãã®ã«
- A ⧠~A = false (ãã®å¼ã¯ A ãã©ããªæã§ã false)
- A ⧠~A 㯠inconsistent (ãã®å¼ã true ã«ãªã A ã®éåã¨èããã¨è§£ã¯ç¡ã)
ã®ããã«äºã¤ã®è¨ãæ¹ãããããã£ã¡ã®åé¡ã¯ãããè¨æ³ã®åé¡ã§ãããã°ã©ãã³ã°è¨èªã¿ããã«å³å¯ã«åãæèãã¦æ¸ãã¨è¯ãã¨æããã ãã©ãæ°å¦çãªè¨æ³ã¨ããã®ã¯ç´ 人ç®ããããã¨å³å¯ãã«æ¬ ããæ°ããããã¨ããã®ã¾ã¾ç¶ããã¨æç´ã ããã«ãªãã®ã§ãã¡ã¢ã«ç§»ãã
ãã¼ã«æ¼ç®ã®å®ç¾©
ãã¼ã«æ¼ç®ã§ä½¿ã主ãªè¨å·ã¯æ¬¡ã®éã
- true : çã表ã
- false : å½ã表ã
- ⧠: and æ¼ç®åãtrue ⧠true = true ãã®ä»ã®å ´å㯠false
- ⨠: or æ¼ç®åãfalse ⨠false = false ãã®ä»ã®å ´å㯠true
- ~ : not æ¼ç®å(ã»ãã¨ã¯ãã¿ãããªåã ãã©åããã®ã§ ~ ã«ãã)ã~true = false, ~false = true
⧠ã®ä¸¡è¾ºã¯ãã¼ã«å¤ã ãã©ãä½æ°ãªããæç¸ãã«ä½¿ãããäºãããã®ã§æ³¨æãä¾ãã° A ⧠B ã¨è¨ãã¨åã« A 㨠B ã® and ãåã£ãå¤ãããªãã¦ããA = true ã㤠B = true ã®å ´åãã¨ãã風ã«å¤æ°åã«æå³ãããæããããç¹ã« | ã®å¾ãã
ãã¨éè¦ãªè¨å· â 㨠⊧ 㨠| ã«ã¤ãã¦ãa â b 㯠a implies b ã¨èªããã¼ã«æ¼ç®åãa ã®æ b ã¨ããæå³ã«ä½¿ãã a = false ã®æã®æ¯ãèããæ®éã®è¨èªã¨éãã
a | b | a â b |
false | false | true |
false | true | true |
true | false | false |
true | true | true |
a ⊧ b 㯠a satisfies b ã¨å¼ã¶ããã㯠â ã¨ä¼¼ã¦ããã両辺ã¯ãã¼ã«å¤ã§ã¯ãªããè«çå¼ã®éåã®æã«ä½¿ãããããã¾ã ãããµããªãã ãã©ãHaskell 風ã«æ¸ãã¨ã ããã ⊧ :: ([Bool] -> Bool) -> ([Bool] -> Bool) -> Bool ã¨æãã¨æå³ãç¹ããã両辺ããã¼ã«å¤ã®éåã§ã¯ãªããé¢æ°(ãã¼ã«å¤ãä»£å ¥ããã¨å¤ãå®ã¾ãå¼)ãªäºã«æ³¨æã
a | b ã®èªã¿æ¹ã¯åãããªããã©ãHaskell 風ã«ã¯ whereãã¤ã¾ããb ãæãç«ã¤æã® a ã®å¤ã表ããä¾ãã°
- A ⧠B | A = true ⧠B = B
ã¨ãªãããã®å ´åã| ã®å³è¾ºã® A ã¯ãA ã®å¤ããç¡ãã¦ãA = true ã¨ããæç¸ã表ãã®ã§æ³¨æãæ¼ç®ã®çµæå¤æ° A ãæ¶ãããA = false ãä»£å ¥ããã«ã¯
- A ⧠B | ~A
ã¨æ¸ããã©ã®ãããä¸è¬çãªã®ãç¥ããªããã©ãããã¸ãããã¦ãªãææ³ã ã¨æãã
è¤æ°ã®ãã¼ã«å¤ã®æ§è³ª
è¤æ°ã®ãã¼ã«å¤ã®æ§è³ªãè¨ãã®ã«ç¹å¥ãªè¿°èªãããã
- valid : å ¨é¨ã true
- invalid : false ã®ç©ããã
- consistent : true ã®ç©ããã
- inconsistent : å ¨é¨ã false
ä¾ãã°äºã¤ã®ãã¼ã«å¤ããã£ãæ
valid? | consistent? | ||
false | false | invalid | inconsistent |
false | true | invalid | consistent |
true | false | invalid | consistent |
true | true | valid | consistent |
ã¨ãªããç¹ã« valid 㨠inconsistent ãè¯ãåºã¦ããã
éåå
éååã¨ããã®ã¯ããå ¨ã¦ã®ãªãã¨ãããããªãã¨ããåå¨ãããã¨ãããã¤ããã¼ã«è«çã§ã¯ããã¨åç´ãªå®ç¾©ã«ãªã£ã¦ããã
- âPÎ ≝ Î|P ⨠Î| ~P (Î ãæãç«ã¤ P ãåå¨ãã)
- âPÎ ≝ Î|P ⧠Î| ~P (P ãã©ããªã§ãã£ã¦ã Î ãæãç«ã¤)
ãã®å®ç¾©ã¯ç°¡åã§è¯ãããã°ããåºã¦ããªãã®ã§çç¥ã
Conjunctive Normal Form (CNF)
⨠ã¨ã ⧠ã¨ãå ¥åã大å¤ãªã®ã§å¥ã®æ¹æ³ãèããäºã«ãããå ¨ã¦ã®ãã¼ã«å¼ã¯
- (a1 ⨠a2 ⨠a3 ⨠...) ⧠(b1 ⨠b2 ⨠b3 ⨠...) ⧠...
ã¨ããå½¢ã«æ¸ãæããããäºãç¥ããã¦ãããããã§ãããããéåã®éåãã¨ãã風ã«æ¸ãã¨æ±ãã楽ã ãã¤ã¾ã次ã®ããã«ãªãã
- {{a1, a2, a3, ...}, {b1, b2, b3, ...} , ... }
å¤å´ã®éå㯠andãå å´ã®éå㯠or ã®æå³ã«ãªããä¾ãã°ãããªæãã«è¨ç®åºæ¥ãã
- {{false, false}, {true, false}}
- = {false, true} -- å å´ã® or ãè¨ç®
- = false -- å¤å´ã® and ãè¨ç®
ãªããåãå¤ããªãã§
- {{}} = true
- {} = false
ã¨ããæ¹ãç¾ããã
æ¨è«
ã¤ã¥ãã¾ãããã