zoukankan      html  css  js  c++  java
  • DM

    Chapter1 propositon Logic

    1.1propositon

      A declarative sentence   With a unique value. 
    

    • A proposition can be represented by a proposition variable (i.e., a symbol).
    • A simple statement can be represented by an atom proposition
    • More than one atom proposition can be combined into a compound statement

    logical connective not,and,or,if then,if and only if

    • exlusive disjunction i.e. xor (┐p ∧ q) ∨(p ∧ ┐q)
    • Implication p → q is false when p1&&q0

    e.g.
    p implies q
    Since p, then q
    q, if p
    q whenever p
    p only if q
    q is necessary for p
    ┐p unless q
    Unless q otherwise not p
    if p:充分条件;only if q 必要条件(被指,right hand side,后件)

    -Equivalence biconditional

    1.2Propositional Well-Formed Formula

    A symbol string of propositional variables connected by logical connectives and parentheses by some logical relation. 
    

    detailed definition of WWF:

    1. A single propositional variable is a WFF, called atom propositional WFF.
      2.If A is a WFF, then ┐A is a WFF.
    2. If both A and B are WFFs, then A∧B, A∨B, A→B, A↔B are WFFs.
    3. A symbol string generated by the above rules (1)~(3) in finite times is a WFF.

    Layers of WFF using the above constructing rules how many time

    definition

    1. WFF A is with layer 0, if A is an Atom WFF
    2. A is n+1 (n≥0) layer WFF, if one of the following conditions holds:
      (a) A= ┐B, where B is n layer WFF;
      (b) A= B∧C, where B, C are i and j layer WFFs respectively, and n = max(i, j)
      (c) A=B∨C, where B, C are defined as (b);
      (d) A=B→C, where B, C are defined as (b);
      (e) A=B↔C, where B, C are defined as (b);
    3. If the layer of WFF A is k, then A is called k layer WFF

    assignments

    • Let p1, p2, …, pn be all propositional variables in WFF A, an assignment or explanation to A is defined as the assignment of a truth value to each pi.
    • A truth table of WFF A is a table, where each line denotes a possible assignment to A, with the corresponding value of A.
    1. A is a Tautology if the value of A is always True for any possible assignment to A.
    2. A is a Contradiction if the value of A is always False for any possible assignment to A.
    3. A is a Satisfiable WFF if it is not a contradiction.

    e.g. A tautology is (necessarily) satisfiable

    1.3Propositional Equivalences

    Two WFFs A and B are called logically equivalent, denoted by A<=>B (or A≡B), if WFF A↔B is a tautology(having same truth table)
    

    determine Logical Equivalent WFFs

    • 24 Logical Basic Equivalences / Rules
    1. Double negation law-双重否定律
      A <=> ┐┐A (2.1)
    2. Idempotent laws-等幂律
      A <=> A ∨ A, A <=> A ∧ A (2.2)
    3. Commutative laws-交换律
      A ∨ B <=> B ∨ A, A ∧ B <=> B ∧ A (2.3)
    4. Associative laws-结合律
      (A ∨ B)∨C <=> A ∨ (B∨C) (A ∧ B)∧C <=> A ∧ (B∧C) (2.4)
    5. Distributive laws-分配律
      A∨(B∧C)<=>(A∨B)∧(A∨C) (∨对∧的分配律)
      A∧(B∨C)<=>(A∧B)∨(A∧C) (∧对∨的分配律) (2.5)
    6. de Morgan’s laws-德摩根律
      ┐(A∨B)<=>┐A∧┐B, ┐(A∧B)<=>┐A∨┐B (2.6)
    7. Absorption laws-吸收律
      A∨(A∧B)<=>A, A∧(A∨B) <=> A (2.7)
    8. Domination laws-零律
      A∨1<=>1, A∧0 <=> 0 (2.8)
    9. Identity laws-同一律
      A∨0<=>A, A∧1<=>A (2.9)
    10. Negation laws 1-排中律
      A∨┐A<=>1 (2.10)
    11. Negation laws 2-矛盾律
      A∧┐A<=>0 (2.11)
    12. Logical Equivalences involving Implication -蕴涵等值式 (here shorten as Implication rule)
      A→B <=> ┐A∨B (2.12)
    13. Logical Equivalences involving biconditional - 等价等值式
      A↔ B<=> (A→B) ∧ (B→A) (2.13)
    14. Logical Equivalences involving implication 2 - Contraposition 假言易位
      A→B 假言易位 ┐B→ ┐A (2.14)
    15. Logical Equivalences involving biconditional 2 - 等价否定等值式
      A↔ B假言易位 ┐A↔ ┐B (2.15)
    16. Logical Equivalences involving implication 3- 归谬论
      (A→B)∧(A→┐B) <=> ┐A (2.16)

    Replacement Rule of Equivalences

    Definition:
    Replacement Rule of Equivalences - 置换规则
    Let Φ(A): A WFF with A as its subwff, Φ(B): the WFF replacing all A with B.
    If A <=> B, then Φ(A) <=>Φ(B).
    Usage: do calculations

    1.4Disjunctive Normal Form (DNF)-析取范式

    Conjunctive Normal Form (CNF) 合取范式
    

    Literal

    Definition.
    A single propositional variable or its negation is called a literal.

    fundamental disjunction

    Definition.
    is either a literal or a disjunction (∨) of two or more literals.

    Theorem
    (1) A Fundamental Disjunction is a Tautology iff it contains a propositional variable and its negation.
    (2) A Fundamental Conjunction is a Contradiction iff it contains a propositional variable and its negation.
    DNF

    Definition.

    A DNF of a WFF is either one Fundamental Conjunction or a Disjunction of two or more Fundamental Conjunctions.
    A CNF of a WFF is either one Fundamental Disjunction or a Conjunction of two or more Fundamental Disjunctions.
    Theorem
    (1) A DNF is a Contradiction iff each Fundamental Conjunction of it is a Contradiction.
    (2)A CNF is a Tautology iff each Fundamental Disjunction of it is a Tautology.
    There always exist the DNF and CNF logically equivalent to a given propositional WFF.
    为了清晰和无误,演算中利用交换律 使得每个简单析取式或合取式中命题变项的出现都是按字典顺序

    FULL DNF

    Minterm (Maxterm)

    A Minterm (Maxterm) is defined as a Fundamental Conjunction (Disjunction) with n variables, where:
    each variable and its negation do not occur at the same time
    but one of them definitely occurs only once, and
    the ith variable or its negation occurs at the ith position from the leftmost side.

    Properties of Maxterm (same to minterm)
    Given n variables, there will be 2n different Maxterms
    One and only one assignment makes a Maxterm to be False (0)
    Let a decimal number i denote the binary assignment with false value(The Only Assignment to make it False), then the Maxterm can be denoted as Mi

    Theorem
    Let mi and Mi be a Minterm and a Maxterm respectively, composed by propositional variables p1, p2, …, pn, then (not the binary form,which are same)
    ┐mi <=> Mi
    ┐Mi <=> mi

    Full DNF

    Definition

    A DNF is called a Full DNF if all Fundamental Conjunctions in it are Minterms.
    A CNF is called a Full CNF if all Fundamental Disjunctions in it are Maxterms.

    Theorem
    There exists the unique Full DNF and the unique Full CNF logically equivalent to a propositional WFF.
    Generate DNF
    Steps: 1. Generate a DNF / CNF;
    Steps: 2. If necessary, extend the related Fundamental Conjunctions / Disjunctions;
    Ai <=> Ai∨0 <=> Ai∨(pj∧┐pj) <=> (Ai∨pj)∧(Ai∨┐pj)
    Steps: 3. Write all minterms (maxterms) by alpha-beta order;

    Applications of Full DNF/CNF - 1

    Find Assignments to make a WFF to be true or false.
    If there are s (0≤s≤ 2^n) minterms in Full DNF A, then A has S assignments to make it true, and the other 2^n-s assignments make A to be false.

    Applications of Full DNF/CNF - 2

    To check the type of a WFF =
    Let A be a WFF with n propositional variables, then

    1. A is a tautology iff the Full DNF of A contains all 2^n minterms;
    2. A is a contradiction iff the Full DNF of A contains no minterm;
    3. A is satisfiable iff the Full DNF of A contains at least one minterm.
      similarly

    There are 2^n maxterms in a contradiction by Full CNF 矛盾式无成真赋值,因此矛盾式的主合取范式含2^n (n为公式中命题变项个数) 个极大项
    There is no maxterm in tautology by Full CNF 重言式无成假赋值,因此主合取范式不含任何极大项
    Then number of maxterms in a satisfiable Full CNF is definitely less than 2^n 可满足式的主合取范式中极大项的个数一定小于2^n

    Applications of Full DNF/CNF - 3

    To check two WFFs logically equivalent or not

    Applications of Full DNF/CNF - 4

    Real applications.

    Q:
    (1) If select A, then also select C;
    (2) If select B, then not select C;
    (3) If not select C, then select either A or B.
    Q: How to select them?
    Solution: Let p: Select A; q: Select B; r: Select C. Then, by three constraints, we get,
    (p→r) ∧ (q→┐r) ∧ (┐r→(p∨q))
    then, we get the Full DNF as follows,
    (p→r)∧(q→┐r)∧(┐r→(p∨q)) <=> m1 ∨m2 ∨m5
    Since m1 = ┐p∧┐q∧r, m2 =┐p∧q∧┐r, m5=p∧┐q∧ r
    Then, there are three possible solutions:
    (a) Select C, but neither A nor B.
    (b) Select B, but neither A nor C.
    (c) Select both A and C, but not B.

    from Full DNF get Full CNF

    Let A be a wff with n propositional variables, and its Full DNF contains s (0≤s≤ 2n) minterms:
    A <=> mi1 ∨mi2 ∨…∨mis , 0 ≤ ij ≤ 2n-1, j = 1, 2, …, s
    the non-occurred minterms没出现的极小项 are mj1,mj2,…, mj(2n-s) , whose binary strings make ┐A to be true 它们的角标的二进制表示为┐A的成真赋值,因而┐A的主析取范式为
    then, ┐A <=> mj1 ∨mj2 ∨…∨ mj(2n-s)
    Thus,
    A<=> ┐┐A <=> ┐(mj1 ∨mj2 ∨…∨ mj(2n-s) )
    <=> ┐mj1∧┐mj2∧…∧┐ mj(2n-s)
    <=> Mj1∧Mj2∧…∧ Mj(2n-s)
    Then, we get Full CNF by Full DNF, and vice versa.

    Functionally Complete Set of Logical Connectives 联结词的完备集(Self-study)

    S0 = {┐,∧,∨};
    S1={┐,∧,∨,→} S2={┐,∧,∨,→,↔}
    S3={┐,∧} S4={┐,∨}
    S5={┐,→} S6={↑} S7={↓} a|b<=>┐(a∧b)

    1.6 Inferences by Propositional Logic


    Inference/Reasoning:

    a process from some premises to a conclusion

    A valid inference.

    Let A1, A2, …, Ak, B be all propositional WFFs. For any assignment to A1, A2, …, Ak, B, if
    either A1 ∧ A2 ∧ … ∧ Ak is false/0,
    or when A1 ∧ A2 ∧ … ∧ Ak is true/1, B is also true/1
    then, the inference of B from premises A1, A2, …, Ak is valid/correct, and B is called a valid conclusion.

    Remarks

    1. The premise is a set of finite WFFs, named Γ, then the inference can be denoted as Γ├B.
      Γ╞B if the inference is valid/correct, otherwise Γ B.
      Γ├B or {A1, A2, …, Ak}├B are called the formal structures of an inference.
    2. For the n propositional variables in A1, A2, …, Ak, B, and any assignment a1, a2, …, an (ai = 0/1, i =1, 2,…,n), there are four cases for the premises and conclusion:
      (1) A1∧A2∧…∧Ak is 0, and B is 0;
      (2) A1∧A2∧…∧Ak is 0, and B is 1;
      (3) A1∧A2∧…∧Ak is 1, and B is 0;
      (4) A1∧A2∧…∧Ak is 1, and B is 1.
      The inference is valid/correct iff there is no case (3).
    3. From remark 2, a Valid/Correct inference does not make the Conclusion B necessarily be True/1, which is different from traditional mathematical reasoning.

    Equivalent Formal Structure of an Inferenceanother way to present

    Theorem.
    The inference of B from premises A1, A2, …, Ak is valid iff
    the implication (A1∧A2∧…∧Ak) → B
    is a Tautology.
    Then, we get a new equivalent formal structure of an inference.
    {A1, A2, …, Ak}├ B
    can be written as an implication WFF
    (A1∧A2∧…∧Ak) → B

    Example 2. Writing the formal structure of inferences in Example 1.
    (1) Premises: p, p→q
    Conclusion: q
    Inference: (p∧(p→q)) →q
    (2)some calculation

    Rules of Inferences

    (A∧B) =>A Simplification 化简律
    A =>(A∨B) Addition 附加律
    (A→B)∧A=>B Modus ponens 假言推理
    (A→B)∧┐B=>┐A Modus tollens 拒取式
    (A∨B)∧┐B =>A Disjunctive syllogism 拒取三段论
    (A→B)∧(B→C)=>(A→C) Hypothetical syllogism假言三段论
    (A↔B)∧(B↔C)=>(A↔C) Equivalence syllogism等价三段论
    Constructive dilemma
    (A→B)∧(C→D)∧(A∨C) =>B∨D 构造性二难
    (A→B)∧(┐A→B)∧(A∨┐A)=>B 构造性二难

    Destructive dilemma

    (A→B)∧(C→D)∧(┐B∨┐D) => (┐A∨┐C) 破坏性二难

    reamarks

    Each logical basic equivalence can derive two rules of inferences, e.g., A<=> ┐┐A can derive A => ┐┐A, and ┐┐A => A

    Formal inference systems

      Natural inference system: The inference starts from any premises to get a conclusion by propositional calculus.  
      Axiomatic inference system: The inference only starts from some given axioms to get a correct conclusion by propositional calculus.
    

    A natural inference system P includes:

    1. Alphabet 字母表
      (1) Propositional variables 命题变项: p, q, r, …, pi, qi, ri, …
      (2) Connectives 联结词符号: ┐, ∧, ∨, →, ↔
      (3) Parentheses and commas 括号与逗号: ( ), ,
    2. Formulas/WFFs 合式公式
    3. Rules of Inferences 推理规则(12条)

    Solution. (1) Proof.
    Premises: (前提):p∨q, q→r, p→s, ┐s
    Conclusion (结论):r∧(p∨q)
    ① p→s Premise 前提引入
    ② ┐s Premise 前提引入
    ③ ┐p Modus tollens ①②拒取式
    ④ p∨q Premise 前提引入
    ⑤ q Disjunctive syllogism ③④析取三段论
    ⑥ q→r Premise 前提引入
    ⑦ r Modus ponens ⑤⑥假言推理
    ⑧ r∧(p∨q) Conjunction ⑦④合取

    Two techniques for proofs/inferences – Additional Premises

    The format of inferences: 有时推理的形式结构为
    (A1∧A2∧…∧Ak) →(A→B)
    The conclusion is also an implication, then we can move A as a new premise and the conclusion is only B

    Premises 前提: p → q, q → r
    Conclusion 结论: p → r
    Proof. By Additional premises. 用附加前提证明法
    ① p Additional premises 附加前提引入
    ② p → q Premise 前提引入
    ③ q Modus ponens ①② 假言推理
    ④ q → r Premise 前提引入
    ⑤ r Modus ponens ③④ 假言推理

    Two techniques for proofs/inferences – Proof by Contradiction

    For the inference in format like
    (A1∧A2∧…∧Ak )→B
    if we let ┐B a new premise and finally we get a contradiction like (Ai∧┐Ai), then the inference is correct.

    Example 7. Show the proof for the inference
    Premises 前提: (p∧q)→r, ┐r∨s, ┐s, p
    Conclusion 结论: ┐q
    Proof. By contradiction.
    ① q The negation of conclusion结论的否定引入
    ② p Premise 前提引入
    ③ p∧q Conjunction ① ②合取
    ④ (p∧q)→r Premise 前提引入
    ⑤ r Modus ponens ③ ④假言推理
    ⑥ ┐r∨s Premise 前提引入
    ⑦ s Modus tollens ⑤ ⑥拒取式
    ⑧ ┐s Premise 前提引入
    ⑨ s ∧ ┐s Conjunction ①⑨合取

    1.7First Oder Logic (FOL) 一阶逻辑 (Predicate Logic) 谓词逻辑

     Now begins the predicate logic
    

    1.7.1First Order Logic (FOL):

    An atomic proposition can be decomposed into Three elements: Individuals (个体词), Predicates(谓词) and Quantifiers(量词), to represent the inner logical relations and quantity relations
    FOL is also called Predicate Logic谓词逻辑

    1. Individuals
      An Individual constant is just a certain object, denoted usually by a, b, c, …
      An individual variable is an abstract object or a class of objects, such as human, animal, …, denoted usually by x, y, z, …; Domain
    2. Predicate 谓词
      A function to represent the properties of individuals (个体词性质) and the relationships among individuals(个体词之间相互关系)
    1. x is a rational number. “… is a rational number” is a predicate, named F, and then “x is a rational number” is denoted as F(x). A predicate constant.
    2. Jack and Luca are in the same class. “… and … are in the same class” is also a predicate, named G, G(a, b), a: Jack, b: Luca.
    3. x and y have the relation M. “… and … have the relation M”. M(x, y). A predicate variable. Abstract.
      Generally, a predicate is written as a capital letter F, G, H, …
      Any proposition can be denoted as a 0-ary predicate.
    1. Quantifiers 量词
      To denote the quantity relations among individuals.
      (1) Universal Quantifier 全称量词: All individuals in the Domain. Such as “All… ”, “for each …”, “for any…”, symbolized by , and x denote all individuals in the Domain,
      xF(x): All x in the domain satisfy the property F.
      (2) Existential Quantifier 存在量词: One individual or some individuals in the Domain. Such as “(At least) One… ”, “There exists one ..”, symbolized by , and x denote some individuals in the Domain,
      xF(x): One/Some x in the domain satisfy the property F.
      In different domains, there may or may not be different symbolizations for the same statement.

      1.7.2 Well Formed fomulas

    Alphabets in FOL language:

    1. Individual constants: a,b,c,…,ai,bi,ci,…,i≥1

    2. Individual variables: x,y,z,…,xi,yi,zi,…,i≥1

    3. Functions: f,g,h,…,fi,gi,hi,…,i≥1

    4. Predicates: F,G,H,…,Fi,Gi,Hi,…,i≥1

    5. Quantifiers: , 

    6. Connectives: ┐,∧,∨,→,↔

    7. Punctuation symbols: (), ,

    成功的路并不拥挤,因为大部分人都在颓(笑)
  • 相关阅读:
    Mysql优化与使用集锦
    用条件注释判断浏览器版本,解决兼容问题
    高效的使用 Response.Redirect
    JS中字符串的相关操作
    Http压力测试工具HttpTest4Net
    纯CSS(无 JavaScript)实现的响应式图像显示
    jquery使用jsonp进行跨域调用
    JS函数重载解决方案
    C# 实现将 PDF 转文本的功能
    iFrame的妙用
  • 原文地址:https://www.cnblogs.com/SuuT/p/10274538.html
Copyright © 2011-2022 走看看