กลับไปหน้าบทความ

อ่าน 16 นาที

ไม่มีชื่อบทความ

ใน พีชคณิตบูลีน สูตรจะอยู่ใน รูปแบบปกติแบบเชื่อมโยง ( CNF ) หรือ รูปแบบปกติแบบประโยค ถ้าสูตรนั้นเป็นการ เชื่อม โยง ของ ประโยค หนึ่งประโยคขึ้นไปโดยที่ประโยคแต่ละประโยคเป็นการ แยก...

รูปแบบปกติของการเชื่อมคำ

ในพีชคณิตบูลีนสูตรจะอยู่ในรูปแบบปกติแบบเชื่อมโยง ( CNF ) หรือรูปแบบปกติแบบประโยคถ้าสูตรนั้นเป็นการเชื่อมโยง ของ ประโยคหนึ่งประโยคขึ้นไปโดยที่ประโยคแต่ละประโยคเป็นการแยกของตัวแปรหรืออีกนัยหนึ่งคือผลคูณของผลรวมหรือเป็นผลรวมแบบ AND ของ OR

ในการพิสูจน์ทฤษฎีบทอัตโนมัติแนวคิด " รูปแบบปกติแบบประโยค " มักถูกใช้ในความหมายที่แคบกว่า ซึ่งหมายถึงการแสดงสูตร CNF ในรูปแบบเฉพาะเจาะจงในรูปของเซตของเซตของตัวอักษร

คำนิยาม

สูตรตรรกะจะถือว่าอยู่ในรูปแบบ CNF ก็ต่อเมื่อเป็นการเชื่อมโยงของการแยก อย่างน้อยหนึ่งรายการ ของตัวแปร อย่างน้อยหนึ่งตัว เช่นเดียวกับในรูปแบบปกติแบบแยก (DNF) ตัวดำเนินการเชิงประพจน์เพียงอย่างเดียวใน CNF คือ " หรือ " ({\displaystyle \vee }), และ ({\displaystyle \land }) และไม่ใช่ (¬{\displaystyle \neg }ตัว ดำเนินการ ` not`สามารถใช้ได้เฉพาะเป็นส่วนหนึ่งของค่าคงที่เท่านั้น ซึ่งหมายความว่าจะต้องอยู่หน้าตัวแปรเชิงประพจน์ เท่านั้น

ต่อไปนี้เป็นไวยากรณ์ที่ไม่ขึ้นกับบริบทสำหรับ CNF:

ซีเอ็นเอฟ{\displaystyle \,\to \,}แยกส่วน{\displaystyle \,\mid \,}แยกส่วน{\displaystyle \,\land \,}ซีเอ็นเอฟ
แยกส่วน{\displaystyle \,\to \,}อย่างแท้จริง{\displaystyle \,\mid \,}อย่างแท้จริง{\displaystyle \,\lor \,}แยกส่วน
อย่างแท้จริง{\displaystyle \,\to \,}ตัวแปร{\displaystyle \,\mid \,}¬{\displaystyle \,\neg \,}ตัวแปร

โดยที่Variableคือตัวแปรใดๆ ก็ได้

สูตรทั้งหมดต่อไปนี้อยู่ในตัวแปรเอ,บี,ซี,ดี,อี,{\displaystyle A,B,C,D,E,}และเอฟ{\displaystyle F}อยู่ในรูปกริยาเชื่อมประโยคปกติ:

  • (เอ¬บี¬ซี)(¬ดีอีเอฟ){\displaystyle (A\lor \neg B\lor \neg C)\land (\neg D\lor E\lor F)}
  • (เอบี)(ซี){\displaystyle (A\lor B)\land (C)}
  • (เอบี){\displaystyle (A\lor B)}
  • (เอ){\displaystyle (A)}

สูตรต่อไปนี้ไม่ได้ อยู่ ในรูปแบบปกติแบบเชื่อมโยง:

  • ¬(เอบี){\displaystyle \neg (A\land B)}เนื่องจากตัวดำเนินการ AND ซ้อนอยู่ภายในตัวดำเนินการ NOT
  • ¬(เอบี)ซี{\displaystyle \neg (A\lor B)\land C}เนื่องจาก OR นั้นซ้อนอยู่ภายใน NOT
  • เอ(บี(ดีอี)){\displaystyle A\land (B\lor (D\land E))}เนื่องจากตัวดำเนินการ AND ซ้อนอยู่ภายในตัวดำเนินการ OR
  • เอ(บี(ซีดี)){\displaystyle A\land (B\lor (C\lor D))}เนื่องจากตัวดำเนินการ OR ซ้อนกันควรเขียนโดยไม่ต้องมีวงเล็บ

การแปลงเป็น CNF

ในตรรกศาสตร์คลาสสิกสูตรประพจน์แต่ละ สูตร สามารถแปลงเป็น สูตร ที่เทียบเท่ากันซึ่งอยู่ใน CNF ได้[ 1 ]การแปลงนี้ขึ้นอยู่กับกฎเกี่ยวกับความสมมูลเชิงตรรกะได้แก่การกำจัดการปฏิเสธซ้ำซ้อนกฎของเดอ มอร์แกนและกฎการกระจาย

อัลกอริทึมพื้นฐาน

อัลกอริทึมสำหรับคำนวณค่าเทียบเท่า CNF ของสูตรเชิงประพจน์ที่กำหนดให้ϕ{\displaystyle \phi }สร้างต่อยอดจาก¬ϕ{\displaystyle \lnot \phi }ในรูปแบบปกติแบบแยกส่วน (DNF) : ขั้นตอนที่ 1. [ 2 ] จากนั้น¬ϕดีเอ็นเอฟ{\displaystyle \lnot \phi _{DNF}}ถูกแปลงเป็นϕซีเอ็นเอฟ{\displaystyle \phi _{CNF}}โดยการสลับ AND กับ OR และในทางกลับกัน พร้อมทั้งกลับค่าตัวอักษรทั้งหมด ลบทั้งหมด¬¬{\displaystyle \lnot \lnot }[ 1 ]

การแปลงโดยวิธีการทางไวยากรณ์

แปลงสูตรเชิงประพจน์ให้อยู่ในรูปแบบ CNFϕ{\displaystyle \phi }.

ขั้นตอนที่ 1 : แปลงการปฏิเสธให้เป็นรูปแบบปกติแบบแยกส่วน[ 2 ]

¬ϕดีเอ็นเอฟ=(ซี1ซี2ซีฉันซี){\displaystyle \lnot \phi _{DNF}=(C_{1}\lor C_{2}\lor \ldots \lor C_{i}\lor \ldots \lor C_{m})}[ 3 ]

โดยที่แต่ละซีฉัน{\displaystyle C_{i}}เป็นการเชื่อมโยงของตัวอักษรฉัน1ฉัน2ฉันnฉัน{\displaystyle l_{i1}\land l_{i2}\land \ldots \land l_{in_{i}}}[ 4 ]

ขั้นตอนที่ 2 : ยกเลิก¬ϕดีเอ็นเอฟ{\displaystyle \lnot \phi _{DNF}}จากนั้นจึงเปลี่ยนเกียร์¬{\displaystyle \lnot }เข้าไปภายในโดยการใช้หลักสมดุลของเดอ มอร์แกน (แบบทั่วไป)จนกว่าจะไม่สามารถทำได้อีกต่อไป ϕ¬¬ϕดีเอ็นเอฟ=¬(ซี1ซี2ซีฉันซี)¬ซี1¬ซี2¬ซีฉัน¬ซี// (ทั่วไป) DM{\displaystyle {\begin{aligned}\phi &\leftrightarrow \lnot \lnot \phi _{DNF}\\&=\lnot (C_{1}\lor C_{2}\lor \ldots \lor C_{i}\lor \ldots \lor C_{m})\\&\leftrightarrow \lnot C_{1}\land \lnot C_{2}\land \ldots \land \lnot C_{i}\land \ldots \land \lnot C_{m}&&{\text{// (generalized) DM}}\end{aligned}}} ที่ไหน¬ซีฉัน=¬(ฉัน1ฉัน2ฉันnฉัน)(¬ฉัน1¬ฉัน2¬ฉันnฉัน)// (ทั่วไป) DM{\displaystyle {\begin{aligned}\lnot C_{i}&=\lnot (l_{i1}\land l_{i2}\land \ldots \land l_{in_{i}})\\&\leftrightarrow (\lnot l_{i1}\lor \lnot l_{i2}\lor \ldots \lor \lnot l_{in_{i}})&&{\text{// (generalized) DM}}\end{aligned}}}

ขั้นตอนที่ 3 : ลบการปฏิเสธซ้ำซ้อนทั้งหมดออก

ตัวอย่าง

แปลงสูตรเชิงประพจน์ให้อยู่ในรูปแบบ CNF ϕ=((¬(พีq))(¬(พีq))){\displaystyle \phi =((\lnot (p\land q))\leftrightarrow (\lnot r\uparrow (p\oplus q)))}[ 5 ]

DNF เทียบเท่าแบบเต็มของสิ่งที่ปฏิเสธคือ[ 2 ]¬ϕดีเอ็นเอฟ=(พีq)(พีq¬)(พี¬q¬)(¬พีq¬){\displaystyle \lnot \phi _{DNF}=(p\land q\land r)\lor (p\land q\land \lnot r)\lor (p\land \lnot q\land \lnot r)\lor (\lnot p\land q\land \lnot r)}

ϕ¬¬ϕดีเอ็นเอฟ=¬{(พีq)(พีq¬)(พี¬q¬)(¬พีq¬)}¬(พีq)_¬(พีq¬)_¬(พี¬q¬)_¬(¬พีq¬)_// DM ทั่วไป (¬พี¬q¬)(¬พี¬q¬¬)(¬พี¬¬q¬¬)(¬¬พี¬q¬¬)// DM ทั่วไป (4×)(¬พี¬q¬)(¬พี¬q)(¬พีq)(พี¬q)// ลบทั้งหมด ¬¬=ϕซีเอ็นเอฟ{\displaystyle {\begin{aligned}\phi &\leftrightarrow \lnot \lnot \phi _{DNF}\\&=\lnot \{(p\land q\land r)\lor (p\land q\land \lnot r)\lor (p\land \lnot q\land \lnot r)\lor (\lnot p\land q\land \lnot r)\}\\&\leftrightarrow {\underline {\lnot (p\land q\land r)}}\land {\underline {\lnot (p\land q\land \lnot r)}}\land {\underline {\lnot (p\land \lnot q\land \lnot r)}}\land {\underline {\lnot (\lnot p\land q\land \lnot r)}}&&{\text{// generalized D.M. }}\\&\leftrightarrow (\lnot p\lor \lnot q\lor \lnot r)\land (\lnot p\lor \lnot q\lor \lnot \lnot r)\land (\lnot p\lor \lnot \lnot q\lor \lnot \lnot r)\land (\lnot \lnot p\lor \lnot q\lor \lnot \lnot r)&&{\text{// generalized D.M. }}(4\times )\\&\leftrightarrow (\lnot p\lor \lnot q\lor \lnot r)\land (\lnot p\lor \lnot q\lor r)\land (\lnot p\lor q\lor r)\land (p\lor \lnot q\lor r)&&{\text{// remove all }}\lnot \lnot \\&=\phi _{CNF}\end{aligned}}}

การแปลงโดยวิธีการทางความหมาย

สูตรที่เทียบเท่ากับรูปแบบ CNF สามารถหาได้จากตารางค่าความจริง ของสูตรนั้น ลองพิจารณาสูตรนี้อีกครั้ง ϕ=((¬(พีq))(¬(พีq))){\displaystyle \phi =((\lnot (p\land q))\leftrightarrow (\lnot r\uparrow (p\oplus q)))}[ 5 ]

ตารางความจริงที่เกี่ยวข้องคือ

พี{\displaystyle p}q{\displaystyle q}{\displaystyle r}({\displaystyle (}¬{\displaystyle \lnot }(พีq){\displaystyle (p\land q)}){\displaystyle )}{\displaystyle \leftrightarrow }({\displaystyle (}¬{\displaystyle \lnot r}{\displaystyle \uparrow }(พีq){\displaystyle (p\oplus q)}){\displaystyle )}
ทีทีทีเอฟทีเอฟเอฟทีเอฟ
ทีทีเอฟเอฟทีเอฟทีทีเอฟ
ทีเอฟทีทีเอฟทีเอฟทีที
ทีเอฟเอฟทีเอฟเอฟทีเอฟที
เอฟทีทีทีเอฟทีเอฟทีที
เอฟทีเอฟทีเอฟเอฟทีเอฟที
เอฟเอฟทีทีเอฟทีเอฟทีเอฟ
เอฟเอฟเอฟทีเอฟทีทีทีเอฟ

เทียบเท่า CNF ของϕ{\displaystyle \phi }เป็น (¬พี¬q¬)(¬พี¬q)(¬พีq)(พี¬q){\displaystyle (\lnot p\lor \lnot q\lor \lnot r)\land (\lnot p\lor \lnot q\lor r)\land (\lnot p\lor q\lor r)\land (p\lor \lnot q\lor r)}

การเชื่อมโยงแบบ "หรือ" แต่ละครั้งสะท้อนถึงการกำหนดตัวแปรซึ่งϕ{\displaystyle \phi }ประเมินค่าเป็น F(เท็จ) หากในการกำหนดค่าดังกล่าว ตัวแปรวี{\displaystyle V}

  • ถ้า T(จริง) ค่าตัวอักษรจะถูกตั้งเป็น¬วี{\displaystyle \lnot V}ในการเชื่อมแบบ "ไม่"
  • ถ้าเป็น F(เท็จ) ค่าตัวอักษรจะถูกตั้งเป็นวี{\displaystyle V}ในการเชื่อมแบบ "หรือ"

แนวทางอื่นๆ

เนื่องจากสูตรเชิงประพจน์ทั้งหมดสามารถแปลงเป็นสูตรที่เทียบเท่ากันในรูปแบบปกติเชิงเชื่อมโยง (Conjunctive Normal Form หรือ CNF) ได้ การพิสูจน์จึงมักอาศัยสมมติฐานว่าสูตรทั้งหมดเป็น CNF อย่างไรก็ตาม ในบางกรณี การแปลงเป็น CNF อาจทำให้สูตรมีขนาดใหญ่ขึ้นอย่างมาก ตัวอย่างเช่น การแปลสูตรที่ไม่ใช่ CNF

(X1วาย1)(X2วาย2)(Xnวายn){\displaystyle (X_{1}\wedge Y_{1})\vee (X_{2}\wedge Y_{2})\vee \ldots \vee (X_{n}\wedge Y_{n})}

เมื่อนำไปผสมกับ CNF จะได้สูตรที่มี2n{\displaystyle 2^{n}}ข้อกำหนด:

(X1X2Xn)(วาย1X2Xn)(X1วาย2Xn)(วาย1วาย2Xn)(วาย1วาย2วายn).{\displaystyle (X_{1}\vee X_{2}\vee \ldots \vee X_{n})\wedge (Y_{1}\vee X_{2}\vee \ldots \vee X_{n})\wedge (X_{1}\vee Y_{2}\vee \ldots \vee X_{n})\wedge (Y_{1}\vee Y_{2}\vee \ldots \vee X_{n})\wedge \ldots \wedge (Y_{1}\vee Y_{2}\vee \ldots \vee Y_{n}).}

แต่ละข้อความประกอบด้วยอย่างใดอย่างหนึ่งXฉัน{\displaystyle X_{i}}หรือวายฉัน{\displaystyle Y_{i}}สำหรับแต่ละคนฉัน{\displaystyle i}.

มีการแปลงเป็น CNF ที่หลีกเลี่ยงการเพิ่มขนาดแบบเลขชี้กำลังโดยการรักษาความสามารถในการทำให้ เป็นจริง แทนที่จะเป็นความเท่าเทียมกัน [ 6 ] [ 7 ] การแปลงเหล่านี้รับประกันว่าจะเพิ่มขนาดของสูตรขึ้นแบบเชิงเส้นเท่านั้น แต่จะเพิ่มตัวแปรใหม่ ตัวอย่างเช่น สูตรข้างต้นสามารถแปลงเป็น CNF ได้โดยการเพิ่มตัวแปร1,,n{\displaystyle Z_{1},\ldots ,Z_{n}}ดังต่อไปนี้:

(1n)(¬1X1)(¬1วาย1)(¬nXn)(¬nวายn).{\displaystyle (Z_{1}\vee \ldots \vee Z_{n})\wedge (\neg Z_{1}\vee X_{1})\wedge (\neg Z_{1}\vee Y_{1})\wedge \ldots \wedge (\neg Z_{n}\vee X_{n})\wedge (\neg Z_{n}\vee Y_{n}).}

การตีความจะสอดคล้องกับสูตรนี้ก็ต่อเมื่อตัวแปรใหม่ตัวใดตัวหนึ่งเป็นจริงอย่างน้อยหนึ่งตัว ถ้าตัวแปรนั้นคือฉัน{\displaystyle Z_{i}}จากนั้นทั้งสองXฉัน{\displaystyle X_{i}}และวายฉัน{\displaystyle Y_{i}}ก็เป็นจริงเช่นกัน นั่นหมายความว่าทุกแบบจำลองที่ตรงตามสูตรนี้ก็ตรงตามสูตรดั้งเดิมด้วย ในทางกลับกัน มีเพียงบางแบบจำลองของสูตรดั้งเดิมเท่านั้นที่ตรงตามสูตรนี้ เนื่องจากฉัน{\displaystyle Z_{i}}เนื่องจากตัวแปรเหล่านี้ไม่ได้ถูกกล่าวถึงในสูตรดั้งเดิม ค่าของตัวแปรเหล่านี้จึงไม่เกี่ยวข้องกับการทำให้สูตรนั้นเป็นจริง ซึ่งแตกต่างจากสูตรสุดท้าย นั่นหมายความว่าสูตรดั้งเดิมและผลลัพธ์ของการแปลงนั้นสามารถทำให้เป็นจริงได้เหมือนกันแต่ไม่เท่ากัน

การแปลอีกแบบหนึ่ง คือการแปลงแบบ Tseitinนั้น ยังรวมถึงข้อความย่อยต่างๆ ด้วยฉัน¬Xฉัน¬วายฉัน{\displaystyle Z_{i}\vee \neg X_{i}\vee \neg Y_{i}}ด้วยเงื่อนไขเหล่านี้ สูตรดังกล่าวจึงหมายความว่าฉันXฉันวายฉัน{\displaystyle Z_{i}\equiv X_{i}\wedge Y_{i}}สูตรนี้มักถูกมองว่าเป็นการ "กำหนด"ฉัน{\displaystyle Z_{i}}เพื่อเป็นชื่อสำหรับXฉันวายฉัน{\displaystyle X_{i}\wedge Y_{i}}.

จำนวนการเชื่อมแบบ "หรือ" สูงสุด

พิจารณาสูตรเชิงประพจน์ที่มีn{\displaystyle n}ตัวแปรn1{\displaystyle n\geq 1}.

มีอยู่2n{\displaystyle 2n}ตัวอักษรที่อาจเป็นไปได้:แอล={พี1,¬พี1,พี2,¬พี2,,พีn,¬พีn}{\displaystyle L=\{p_{1},\lnot p_{1},p_{2},\lnot p_{2},\ldots ,p_{n},\lnot p_{n}\}}.

แอล{\displaystyle L}มี(22n1){\displaystyle (2^{2n}-1)}เซตย่อยที่ไม่ว่างเปล่า[ 8 ]

นี่คือจำนวนการแยกสูงสุดที่ CNF สามารถมีได้[ 9 ]

การรวมกันเชิงฟังก์ชันความจริงทั้งหมดสามารถแสดงได้ด้วย2n{\displaystyle 2^{n}}การเชื่อมแบบ "หรือ" (disjunctions) หนึ่งอันสำหรับแต่ละแถวของตารางความจริงในตัวอย่างด้านล่าง การเชื่อมแบบ "หรือ" จะถูกขีดเส้นใต้

ตัวอย่าง

พิจารณาสูตรที่มีตัวแปรสองตัวพี{\displaystyle p}และq{\displaystyle q}.

CNF ที่ยาวที่สุดที่เป็นไปได้คือ2(2×2)1=15{\displaystyle 2^{(2\times 2)}-1=15}การแยก: [ 9 ](¬พี)(พี)(¬q)(q)(¬พีพี)(¬พี¬q)_(¬พีq)_(พี¬q)_(พีq)_(¬qq)(¬พีพี¬q)(¬พีพีq)(¬พี¬qq)(พี¬qq)(¬พีพี¬qq){\displaystyle {\begin{array}{lcl}(\lnot p)\land (p)\land (\lnot q)\land (q)\land \\(\lnot p\lor p)\land {\underline {(\lnot p\lor \lnot q)}}\land {\underline {(\lnot p\lor q)}}\land {\underline {(p\lor \lnot q)}}\land {\underline {(p\lor q)}}\land (\lnot q\lor q)\land \\(\lnot p\lor p\lor \lnot q)\land (\lnot p\lor p\lor q)\land (\lnot p\lor \lnot q\lor q)\land (p\lor \lnot q\lor q)\land \\(\lnot p\lor p\lor \lnot q\lor q)\end{array}}}

สูตรนี้ขัดแย้งกันเองสามารถทำให้ง่ายขึ้นได้เป็น(¬พีพี){\displaystyle (\neg p\land p)}หรือถึง(¬qq){\displaystyle (\neg q\land q)}ซึ่งสิ่งเหล่านี้ก็เป็นข้อขัดแย้งเช่นกัน แต่ก็เป็น CNF ที่ถูกต้องด้วย

ความซับซ้อนในการคำนวณ

ปัญหาชุดสำคัญในความซับซ้อนของการคำนวณเกี่ยวข้องกับการค้นหาการกำหนดค่าให้กับตัวแปรของสูตรบูลีนที่แสดงในรูปแบบปกติแบบเชื่อมโยง โดยที่สูตรนั้นเป็นจริง ปัญหา k -SAT คือปัญหาของการค้นหาการกำหนดค่าที่น่าพอใจให้กับสูตรบูลีนที่แสดงใน CNF ซึ่งแต่ละการเชื่อมโยงมีตัวแปร ไม่เกิน k ตัว3-SATเป็น ปัญหา NP-complete (เช่นเดียวกับ ปัญหาk -SAT อื่นๆ ที่ k > 2) ในขณะที่2-SATเป็นที่ทราบกันว่ามีวิธีแก้ปัญหาในเวลาพหุนามผลที่ตามมาคือ[ 10 ]งานของการแปลงสูตรเป็นDNFโดยรักษาความสามารถในการทำให้เป็นจริงจึงเป็นNP-hardในทำนองเดียวกันการแปลงเป็น CNF โดยรักษาความถูกต้องก็เป็น NP-hard เช่นกัน ดังนั้นการแปลงเป็น DNF หรือ CNF ที่รักษาความเท่าเทียมกันจึงเป็น NP-hard อีกครั้ง

ปัญหาทั่วไปในกรณีนี้เกี่ยวข้องกับสูตรในรูปแบบ "3CNF": รูปแบบปกติเชิงเชื่อมโยง (conjunctive normal form) ที่มีตัวแปรไม่เกินสามตัวต่อส่วนเชื่อมโยง ตัวอย่างของสูตรดังกล่าวที่พบได้ในทางปฏิบัติอาจมีขนาดใหญ่มาก เช่น มีตัวแปร 100,000 ตัว และส่วนเชื่อมโยง 1,000,000 ส่วน

สูตรในรูปแบบ CNF สามารถแปลงเป็นสูตรที่สามารถทำให้เป็นจริงได้ในรูปแบบ " k CNF" (สำหรับk 3) โดยการแทนที่ส่วนประกอบแต่ละส่วนด้วย ตัวแปรมากกว่าk ตัวX1XเคXn{\displaystyle X_{1}\vee \ldots \vee X_{k}\vee \ldots \vee X_{n}}โดยสองจุดบรรจบกันX1Xเค1{\displaystyle X_{1}\vee \ldots \vee X_{k-1}\vee Z}และ¬XเคXn{\displaystyle \neg Z\vee X_{k}\lor \ldots \vee X_{n}}โดยให้Zเป็นตัวแปรใหม่ และทำซ้ำบ่อยเท่าที่จำเป็น

ตรรกะลำดับที่หนึ่ง

ในตรรกศาสตร์ลำดับที่หนึ่ง รูปแบบปกติเชิงเชื่อมโยง (Conjunctive Normal Form หรือ CNF) สามารถนำไปใช้ต่อเพื่อให้ได้รูปแบบปกติเชิงประโยค (Clausal Normal Form หรือ CNF) ของสูตรตรรกศาสตร์ ซึ่งสามารถนำไปใช้ในการแก้ปัญหาลำดับที่หนึ่งได้ในการพิสูจน์ทฤษฎีบทอัตโนมัติโดยใช้การแก้ปัญหา สูตร CNF สามารถนำไป ใช้ได้

({\displaystyle (}11{\displaystyle l_{11}}{\displaystyle \lor }{\displaystyle \ldots }{\displaystyle \lor }1n1{\displaystyle l_{1n_{1}}}){\displaystyle )}{\displaystyle \land }{\displaystyle \ldots }{\displaystyle \land }({\displaystyle (}1{\displaystyle l_{m1}}{\displaystyle \lor }{\displaystyle \ldots }{\displaystyle \lor }n{\displaystyle l_{mn_{m}}}){\displaystyle )}[ 11 ] มักจะ แสดงเป็นเซตของเซต
{{\displaystyle \{}{{\displaystyle \{}11{\displaystyle l_{11}},{\displaystyle ,}{\displaystyle \ldots },{\displaystyle ,}1n1{\displaystyle l_{1n_{1}}}}{\displaystyle \}},{\displaystyle ,}{\displaystyle \ldots },{\displaystyle ,}{{\displaystyle \{}1{\displaystyle l_{m1}},{\displaystyle ,}{\displaystyle \ldots },{\displaystyle ,}n{\displaystyle l_{mn_{m}}}}{\displaystyle \}}}{\displaystyle \}}.

ดูตัวอย่างด้านล่าง

การแปลงจากตรรกะลำดับที่หนึ่ง

เพื่อแปลงตรรกะลำดับแรกเป็น CNF: [ 12 ]

  1. แปลงเป็นรูปแบบปกติของการปฏิเสธ
    1. ขจัดความคลุมเครือและความเท่าเทียมกัน: แทนที่ซ้ำๆพีคิว{\displaystyle P\rightarrow Q}กับ¬พีคิว{\displaystyle \lnot P\lor Q}; แทนที่พีคิว{\displaystyle P\leftrightarrow Q}กับ(พี¬คิว)(¬พีคิว){\displaystyle (P\lor \lnot Q)\land (\lnot P\lor Q)}ในที่สุดแล้ว วิธีนี้จะช่วยขจัดปัญหาทั้งหมดได้{\displaystyle \rightarrow }และ{\displaystyle \leftrightarrow }.
    2. ย้าย NOT เข้าด้านในโดยใช้กฎของเดอ มอร์แกน ซ้ำๆ โดยเฉพาะอย่างยิ่ง ให้แทนที่¬(พีคิว){\displaystyle \lnot (P\lor Q)}กับ(¬พี)(¬คิว){\displaystyle (\lnot P)\land (\lnot Q)}; แทนที่¬(พีคิว){\displaystyle \lnot (P\land Q)}กับ(¬พี)(¬คิว){\displaystyle (\lnot P)\lor (\lnot Q)}และแทนที่¬¬พี{\displaystyle \lnot \lnot P}กับพี{\displaystyle P}; แทนที่¬(xพี(x)){\displaystyle \lnot (\forall xP(x))}กับx¬พี(x){\displaystyle \exists x\lnot P(x)};¬(xพี(x)){\displaystyle \lnot (\exists xP(x))}กับx¬พี(x){\displaystyle \forall x\lnot P(x)}หลังจากนั้น¬{\displaystyle \lnot }อาจปรากฏได้เฉพาะก่อนหน้าสัญลักษณ์แสดงภาคแสดงเท่านั้น
  2. ทำให้ตัวแปรเป็นมาตรฐาน
    1. สำหรับประโยคเช่น(xพี(x))(xคิว(x)){\displaystyle (\forall xP(x))\lor (\exists xQ(x))}หากใช้ชื่อตัวแปรเดียวกันสองครั้ง ให้เปลี่ยนชื่อตัวแปรตัวใดตัวหนึ่ง เพื่อหลีกเลี่ยงความสับสนในภายหลังเมื่อตัดตัวระบุปริมาณออก ตัวอย่างเช่นx[yเอnฉันเอ(y)¬แอลโอวีอี(x,y)][yแอลโอวีอี(y,x)]{\displaystyle \forall x[\exists y\mathrm {Animal} (y)\land \lnot \mathrm {Loves} (x,y)]\lor [\exists y\mathrm {Loves} (y,x)]}เปลี่ยนชื่อเป็นx[yเอnฉันเอ(y)¬แอลโอวีอี(x,y)][zแอลโอวีอี(z,x)]{\displaystyle \forall x[\exists y\mathrm {Animal} (y)\land \lnot \mathrm {Loves} (x,y)]\lor [\exists z\mathrm {Loves} (z,x)]}.
  3. สโกเลไมซ์คำแถลง
    1. ย้ายตัวบ่งปริมาณออกไปด้านนอก: แทนที่ซ้ำๆพี(xคิว(x)){\displaystyle P\land (\forall xQ(x))}กับx(พีคิว(x)){\displaystyle \forall x(P\land Q(x))}; แทนที่พี(xคิว(x)){\displaystyle P\lor (\forall xQ(x))}กับx(พีคิว(x)){\displaystyle \forall x(P\lor Q(x))}; แทนที่พี(xคิว(x)){\displaystyle P\land (\exists xQ(x))}กับx(พีคิว(x)){\displaystyle \exists x(P\land Q(x))}; แทนที่พี(xคิว(x)){\displaystyle P\lor (\exists xQ(x))}กับx(พีคิว(x)){\displaystyle \exists x(P\lor Q(x))}การแทนที่เหล่านี้ยังคงรักษาความเท่าเทียมกันไว้ เนื่องจากขั้นตอนการกำหนดมาตรฐานตัวแปรก่อนหน้านี้ได้ทำให้มั่นใจได้ว่าx{\displaystyle x}ไม่เกิดขึ้นในพี{\displaystyle P}หลังจากทำการแทนที่เหล่านี้แล้ว ตัวบ่งปริมาณอาจปรากฏได้เฉพาะในส่วนนำหน้าของสูตรเท่านั้น แต่จะไม่ปรากฏอยู่ภายในสูตร¬{\displaystyle \lnot },{\displaystyle \land }, หรือ{\displaystyle \lor }.
    2. เปลี่ยนซ้ำๆx1xnyพี(y){\displaystyle \forall x_{1}\ldots \forall x_{n}\;\exists y\;P(y)}กับx1xnพี(เอฟ(x1,,xn)){\displaystyle \forall x_{1}\ldots \forall x_{n}\;P(f(x_{1},\ldots ,x_{n}))}, ที่ไหนเอฟ{\displaystyle f}เป็นของใหม่n{\displaystyle n}สัญลักษณ์ฟังก์ชัน -ary หรือที่เรียกว่า " ฟังก์ชัน Skolem " นี่เป็นขั้นตอนเดียวที่รักษาไว้ซึ่งความสามารถในการทำให้เป็นจริงเท่านั้น ไม่ใช่ความเท่าเทียมกัน มันกำจัดตัวบ่งปริมาณเชิงมีอยู่ทั้งหมด
  4. ลบตัวระบุปริมาณสากลทั้งหมดออก
  5. กระจายการดำเนินการ OR เข้าไปด้านในเหนือการดำเนินการ AND: แทนที่ซ้ำๆพี(คิวอาร์){\displaystyle P\lor (Q\land R)}กับ(พีคิว)(พีอาร์){\displaystyle (P\lor Q)\land (P\lor R)}.

ตัวอย่าง

ตัวอย่างเช่น สูตรที่กล่าวว่า"ใครก็ตามที่รักสัตว์ทุกชนิด ย่อมได้รับความรักตอบแทนจากผู้อื่น"สามารถแปลงเป็นรูปแบบ CNF (และต่อมาเป็น รูปแบบ ประโยคย่อยในบรรทัดสุดท้าย) ได้ดังนี้ (โดยเน้นกฎการแทนที่redexไว้)สีแดง{\displaystyle {\color {red}{\text{red}}}}):

x{\displaystyle \forall x}({\displaystyle (}y{\displaystyle \forall y}เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \color {red}\rightarrow }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \rightarrow }({\displaystyle (}{\displaystyle \exists }y{\displaystyle y}แอลโอวีอี({\displaystyle \mathrm {Loves} (}y{\displaystyle y},x){\displaystyle ,x)}){\displaystyle )}
x{\displaystyle \forall x}({\displaystyle (}y{\displaystyle \forall y}¬{\displaystyle \lnot }เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \lor }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \color {red}\rightarrow }({\displaystyle (}{\displaystyle \exists }y{\displaystyle y}แอลโอวีอี({\displaystyle \mathrm {Loves} (}y{\displaystyle y},x){\displaystyle ,x)}){\displaystyle )}โดย 1.1
x{\displaystyle \forall x}¬{\displaystyle \color {red}\lnot }({\displaystyle (}y{\displaystyle {\color {red}{\forall y}}}¬{\displaystyle \lnot }เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \lor }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \lor }({\displaystyle (}{\displaystyle \exists }y{\displaystyle y}แอลโอวีอี({\displaystyle \mathrm {Loves} (}y{\displaystyle y},x){\displaystyle ,x)}){\displaystyle )}โดย 1.1
x{\displaystyle \forall x}({\displaystyle (}y{\displaystyle \exists y}¬{\displaystyle \color {red}\lnot }({\displaystyle (}¬{\displaystyle \lnot }เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \color {red}\lor }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}){\displaystyle )}{\displaystyle \lor }({\displaystyle (}{\displaystyle \exists }y{\displaystyle y}แอลโอวีอี({\displaystyle \mathrm {Loves} (}y{\displaystyle y},x){\displaystyle ,x)}){\displaystyle )}โดย 1.2
x{\displaystyle \forall x}({\displaystyle (}y{\displaystyle \exists y}¬{\displaystyle \color {red}\lnot }¬{\displaystyle \color {red}\lnot }เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \lor }({\displaystyle (}{\displaystyle \exists }y{\displaystyle y}แอลโอวีอี({\displaystyle \mathrm {Loves} (}y{\displaystyle y},x){\displaystyle ,x)}){\displaystyle )}โดย 1.2
x{\displaystyle \forall x}({\displaystyle (}y{\displaystyle {\color {red}{\exists y}}}เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \lor }({\displaystyle (}{\displaystyle \color {red}\exists }y{\displaystyle \color {red}y}แอลโอวีอี({\displaystyle \mathrm {Loves} (}y{\displaystyle y},x){\displaystyle ,x)}){\displaystyle )}โดย 1.2
x{\displaystyle \forall x}({\displaystyle (}y{\displaystyle \exists y}เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \color {red}\lor }({\displaystyle (}{\displaystyle \color {red}\exists }z{\displaystyle \color {red}z}แอลโอวีอี({\displaystyle \mathrm {Loves} (}z{\displaystyle z},x){\displaystyle ,x)}){\displaystyle )}โดย 2
x{\displaystyle \forall x}z{\displaystyle \exists z}({\displaystyle (}y{\displaystyle {\color {red}{\exists y}}}เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \color {red}\lor }แอลโอวีอี({\displaystyle \mathrm {Loves} (}z{\displaystyle z},x){\displaystyle ,x)}โดย 3.1
x{\displaystyle \forall x}z{\displaystyle {\color {red}{\exists z}}}y{\displaystyle \exists y}({\displaystyle (}เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \lor }แอลโอวีอี({\displaystyle \mathrm {Loves} (}z{\displaystyle z},x){\displaystyle ,x)}โดย 3.1
x{\displaystyle \forall x}y{\displaystyle {\color {red}{\exists y}}}({\displaystyle (}เอnฉันเอ({\displaystyle \mathrm {Animal} (}y{\displaystyle y}){\displaystyle )}{\displaystyle \land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}y{\displaystyle y}){\displaystyle )}){\displaystyle )}{\displaystyle \lor }แอลโอวีอี({\displaystyle \mathrm {Loves} (}จี(x){\displaystyle g(x)},x){\displaystyle ,x)}โดย 3.2
({\displaystyle (}เอnฉันเอ({\displaystyle \mathrm {Animal} (}เอฟ(x){\displaystyle f(x)}){\displaystyle )}{\displaystyle \color {red}\land }¬{\displaystyle \lnot }แอลโอวีอี(x,{\displaystyle \mathrm {Loves} (x,}เอฟ(x){\displaystyle f(x)}){\displaystyle )}){\displaystyle )}{\displaystyle \color {red}\lor }แอลโอวีอี({\displaystyle \mathrm {Loves} (}จี(x){\displaystyle g(x)},x){\displaystyle ,x)}โดย 4
({\displaystyle (}เอnฉันเอ({\displaystyle \mathrm {Animal} (}เอฟ(x){\displaystyle f(x)}){\displaystyle )}{\displaystyle \color {red}\lor }แอลโอวีอี({\displaystyle \mathrm {Loves} (}จี(x){\displaystyle g(x)},x){\displaystyle ,x)}){\displaystyle )}{\displaystyle \color {red}\land }({\displaystyle (}¬แอลโอวีอี(x,เอฟ(x)){\displaystyle \lnot \mathrm {Loves} (x,f(x))}{\displaystyle \color {red}\lor }แอลโอวีอี(จี(x),x){\displaystyle \mathrm {Loves} (g(x),x)}){\displaystyle )}โดย 5
{{\displaystyle \{}{{\displaystyle \{}เอnฉันเอ({\displaystyle \mathrm {Animal} (}เอฟ(x){\displaystyle f(x)}){\displaystyle )},{\displaystyle ,}แอลโอวีอี({\displaystyle \mathrm {Loves} (}จี(x){\displaystyle g(x)},x){\displaystyle ,x)}}{\displaystyle \}},{\displaystyle ,}{{\displaystyle \{}¬แอลโอวีอี(x,เอฟ(x)){\displaystyle \lnot \mathrm {Loves} (x,f(x))},{\displaystyle ,}แอลโอวีอี(จี(x),x){\displaystyle \mathrm {Loves} (g(x),x)}}{\displaystyle \}}}{\displaystyle \}}( การแสดง ข้อความ )

โดยไม่เป็นทางการ หน้าที่ของสโกเลมจี(x){\displaystyle g(x)}อาจมองได้ว่าเป็นการมอบตัวให้กับบุคคลที่...x{\displaystyle x}เป็นที่รัก ในขณะที่เอฟ(x){\displaystyle f(x)}ให้ผลผลิตเป็นสัตว์ (ถ้ามี) ที่x{\displaystyle x}ไม่รัก บรรทัดที่สามจากท้ายสุดด้านล่างอ่านว่า"x{\displaystyle x}ไม่รักสัตว์เอฟ(x){\displaystyle f(x)}มิเช่นนั้นx{\displaystyle x}เป็นที่รักของจี(x){\displaystyle g(x)}" .

บรรทัดรองสุดท้ายจากด้านบน(เอnฉันเอ(เอฟ(x))แอลโอวีอี(จี(x),x))(¬แอลโอวีอี(x,เอฟ(x))แอลโอวีอี(จี(x),x)){\displaystyle (\mathrm {Animal} (f(x))\lor \mathrm {Loves} (g(x),x))\land (\lnot \mathrm {Loves} (x,f(x))\lor \mathrm {Loves} (g(x),x))}คือ CNF

ดูเพิ่มเติม

หมายเหตุ

  1. 1 2 Howson 2005 , หน้า 46.
  2. 1 2 3ดูรูปแบบปกติแบบแยกส่วน §  การแปลงเป็น DNF
  3. 1{\displaystyle 1\leq m\leq }จำนวนการเชื่อมคำสูงสุดสำหรับϕ{\displaystyle \phi }
  4. 1ฉันnฉัน{\displaystyle 1\leq in_{i}\leq }จำนวนตัวอักษรสูงสุดสำหรับϕ{\displaystyle \phi }
  5. 1 2ϕ{\displaystyle \phi }= (( NOT (p AND q)) IFF (( NOT r) NAND (p XOR q)))
  6. Tseitin 1968 .
  7. แจ็กสันและ เชอริ แดน 2004
  8. |พี(แอล)|=22n{\displaystyle \left|{\mathcal {P}}(L)\right|=2^{2n}}
  9. 1 2ถือว่าการทำซ้ำและการเปลี่ยนแปลง (เช่น(เอ)(เอ)(เอ){\displaystyle (a\land b)\lor (b\land a)\lor (a\land b\land b)}) โดยอาศัยสมบัติการสลับที่และการจัดกลุ่มของ{\displaystyle \lor }และ{\displaystyle \land }ไม่เกิดขึ้น
  10. เนื่องจากวิธีหนึ่งในการตรวจสอบความน่าพอใจของ CNF คือการแปลงเป็น DNFซึ่งสามารถตรวจสอบความน่าพอใจได้ในเวลาเชิงเส้น
  11. 1{\displaystyle 1\leq m\leq }จำนวนการเชื่อมแบบ "หรือ" สูงสุด1ฉันnฉัน{\displaystyle 1\leq in_{i}\leq }จำนวนตัวอักษรสูงสุด
  12. Russel & Norvig 2010 , หน้า 345–347, 9.5.1 รูปแบบปกติเชิงเชื่อมโยงสำหรับตรรกะลำดับที่หนึ่ง
  • "เครื่องมือ Java สำหรับ แปลงตารางความจริงเป็น CNF และ DNF"มหาวิทยาลัยมาร์บูร์กสืบค้นเมื่อ31 ธันวาคม 2023

สรุปเนื้อหา

ข้อมูลสำคัญจากบทความ

ข้อมูลสำคัญเกี่ยวกับ ไม่มีชื่อบทความ

ใน พีชคณิตบูลีน สูตรจะอยู่ใน รูปแบบปกติแบบเชื่อมโยง ( CNF ) หรือ รูปแบบปกติแบบประโยค ถ้าสูตรนั้นเป็นการ เชื่อม โยง ของ ประโยค หนึ่งประโยคขึ้นไปโดยที่ประโยคแต่ละประโยคเป็นการ แยก...

คำนิยาม

สูตรตรรกะจะถือว่าอยู่ในรูปแบบ CNF ก็ต่อเมื่อเป็นการ เชื่อมโยง ของ การแยก อย่างน้อยหนึ่งรายการ ของ ตัวแปร อย่างน้อยหนึ่งตัว เช่นเดียวกับใน รูปแบบปกติแบบแยก (DNF) ตัวดำเนินการเชิงประพจน์เพียงอย่างเดียวใน CNF คือ " หรือ " ( ∨ {\displaystyle \vee } ), และ ( ∧...

การแปลงเป็น CNF

ใน ตรรกศาสตร์คลาสสิก สูตรประพจน์ แต่ละ สูตร สามารถแปลงเป็น สูตร ที่เทียบเท่ากัน ซึ่งอยู่ใน CNF ได้ [ 1 ] การแปลงนี้ขึ้นอยู่กับกฎเกี่ยวกับ ความสมมูลเชิงตรรกะ ได้แก่การ กำจัดการปฏิเสธซ้ำซ้อน กฎของเดอ มอร์แกน และกฎ การกระจาย

อัลกอริทึมพื้นฐาน

อัลกอริทึมสำหรับคำนวณค่าเทียบเท่า CNF ของสูตรเชิงประพจน์ที่กำหนดให้ ϕ {\displaystyle \phi } สร้างต่อยอดจาก ¬ ϕ {\displaystyle \lnot \phi } ใน รูปแบบปกติแบบแยกส่วน (DNF) : ขั้นตอนที่ 1.