Propositional and Predicate Logic

Propositional and Predicate Logic

Formal Verification of Software Propositional and Predicate Logic Bernhard Beckert UNIVERSITÄT KOBLENZ-LANDAU B. Beckert: Formal Verification of Software – p.1 Signature Σ Propositional variables = fp0; p1; : : :g Formulas The propositional variables p 2 Σ are formulas If A; B are formulas, then :A (A ^ B) (A _ B) (A ! B) (A $ B) are formulas Propositional Logic: Syntax Special symbols ( ) : ^ _ ! $ B. Beckert: Formal Verification of Software – p.2 Formulas The propositional variables p 2 Σ are formulas If A; B are formulas, then :A (A ^ B) (A _ B) (A ! B) (A $ B) are formulas Propositional Logic: Syntax Special symbols ( ) : ^ _ ! $ Signature Σ Propositional variables = fp0; p1; : : :g B. Beckert: Formal Verification of Software – p.2 Propositional Logic: Syntax Special symbols ( ) : ^ _ ! $ Signature Σ Propositional variables = fp0; p1; : : :g Formulas The propositional variables p 2 Σ are formulas If A; B are formulas, then :A (A ^ B) (A _ B) (A ! B) (A $ B) are formulas B. Beckert: Formal Verification of Software – p.2 Conjunctive formulas Type α ::A (A ^ B) :(A _ B) :(A ! B) Disjunctive formulas Type β :(A ^ B) (A _ B) (A ! B) Propositional Logic: Unified Notation Introduced by Smullyan, 1968 B. Beckert: Formal Verification of Software – p.3 Disjunctive formulas Type β :(A ^ B) (A _ B) (A ! B) Propositional Logic: Unified Notation Introduced by Smullyan, 1968 Conjunctive formulas Type α ::A (A ^ B) :(A _ B) :(A ! B) B. Beckert: Formal Verification of Software – p.3 Propositional Logic: Unified Notation Introduced by Smullyan, 1968 Conjunctive formulas Type α ::A (A ^ B) :(A _ B) :(A ! B) Disjunctive formulas Type β :(A ^ B) (A _ B) (A ! B) B. Beckert: Formal Verification of Software – p.3 β β1 β2 :(A^B) :A :B A_B A B A!B :A B Propositional Logic: Unified Notation Non-literal formulas and their corresponding “logical” sub-formulas α α1 α2 A^B A B :(A_B) :A :B :(A!B) A :B ::A A A B. Beckert: Formal Verification of Software – p.4 Propositional Logic: Unified Notation Non-literal formulas and their corresponding “logical” sub-formulas α α1 α2 β β1 β2 A^B A B :(A^B) :A :B :(A_B) :A :B A_B A B :(A!B) A :B A!B :A B ::A A A B. Beckert: Formal Verification of Software – p.4 Valuation Extension of interpretation to formulas as follows: valI(p) = I(p) 8 true if I(p) = false = > valI(:p) <> false if I(p) = true > :> Propositional Logic: Semantics Interpretation Function I : Σ ! ftrue; falseg B. Beckert: Formal Verification of Software – p.5 Propositional Logic: Semantics Interpretation Function I : Σ ! ftrue; falseg Valuation Extension of interpretation to formulas as follows: valI(p) = I(p) 8 true if I(p) = false = > valI(:p) <> false if I(p) = true > :> B. Beckert: Formal Verification of Software – p.5 8 true if valI(β1) = true > > = > or valI(β2) true = > valI(β) <> false if valI(β1) = false > > > and val (β2) = false > I :> Propositional Logic: Semantics 8 true if valI(α1) = true > > = > and valI(α2) true = > valI(α) <> false if valI(α1) = false > > > or val (α2) = false > I :> B. Beckert: Formal Verification of Software – p.6 Propositional Logic: Semantics 8 true if valI(α1) = true > > = > and valI(α2) true = > valI(α) <> false if valI(α1) = false > > > or val (α2) = false > I :> 8 true if valI(β1) = true > > = > or valI(β2) true = > valI(β) <> false if valI(β1) = false > > > and val (β2) = false > I :> B. Beckert: Formal Verification of Software – p.6 Propositional Logic: Semantics 8 true if valI(A) = valI(B) = > valI(A$B) <> false if val (A) 6= val (B) > I I :> B. Beckert: Formal Verification of Software – p.7 Object variables Var = fx0; x1; : : :g Signature Triple Σ = hFΣ; PΣ; αΣi consisting of set FΣ of functions symbols set PΣ of predicate symbols function αΣ : FΣ [ PΣ ! N assigning aritys to function and predicate symbols Predicate Logic: Syntax Additional special symbols “,” “8” “9” B. Beckert: Formal Verification of Software – p.8 Signature Triple Σ = hFΣ; PΣ; αΣi consisting of set FΣ of functions symbols set PΣ of predicate symbols function αΣ : FΣ [ PΣ ! N assigning aritys to function and predicate symbols Predicate Logic: Syntax Additional special symbols “,” “8” “9” Object variables Var = fx0; x1; : : :g B. Beckert: Formal Verification of Software – p.8 Predicate Logic: Syntax Additional special symbols “,” “8” “9” Object variables Var = fx0; x1; : : :g Signature Triple Σ = hFΣ; PΣ; αΣi consisting of set FΣ of functions symbols set PΣ of predicate symbols function αΣ : FΣ [ PΣ ! N assigning aritys to function and predicate symbols B. Beckert: Formal Verification of Software – p.8 Atoms If p 2 PΣ, αΣ(p) = n, and t1; : : : ; tn terms, then p(t1; : : : ; tn) is an atom Predicate Logic: Syntax Terms variables x 2 Var are terms if f 2 FΣ, αΣ( f ) = n, and t1; : : : ; tn terms, then f (t1; : : : ; tn) is a term B. Beckert: Formal Verification of Software – p.9 Predicate Logic: Syntax Terms variables x 2 Var are terms if f 2 FΣ, αΣ( f ) = n, and t1; : : : ; tn terms, then f (t1; : : : ; tn) is a term Atoms If p 2 PΣ, αΣ(p) = n, and t1; : : : ; tn terms, then p(t1; : : : ; tn) is an atom B. Beckert: Formal Verification of Software – p.9 Literals If A is an atom, then A and :A are literals Predicate Logic: Syntax Formulas Atoms are formulas If A; B are formulas, x 2 Var, then :A; (A ^ B); (A _ B); (A ! B); (A $ B); 8xA; 9xA are formulas B. Beckert: Formal Verification of Software – p.10 Predicate Logic: Syntax Formulas Atoms are formulas If A; B are formulas, x 2 Var, then :A; (A ^ B); (A _ B); (A ! B); (A $ B); 8xA; 9xA are formulas Literals If A is an atom, then A and :A are literals B. Beckert: Formal Verification of Software – p.10 Formula φ = : leq(y; x) ! 9z (:leq(z; x) ^ :leq(y; z)) Atom Scope of | {z } | {z 9z } Example Signature Σ≤ = hf0; a; b; f g; fin_iv; leqg; αi with α(0) = α(a) = α(b) = 0 α( f ) = 1 α(leq) = 2 α(in_iv) = 3 (in interval) B. Beckert: Formal Verification of Software – p.11 Example Signature Σ≤ = hf0; a; b; f g; fin_iv; leqg; αi with α(0) = α(a) = α(b) = 0 α( f ) = 1 α(leq) = 2 α(in_iv) = 3 (in interval) Formula φ = : leq(y; x) ! 9z (:leq(z; x) ^ :leq(y; z)) Atom Scope of | {z } | {z 9z } B. Beckert: Formal Verification of Software – p.11 Existential formulas Type δ :8xA 9xA Predicate Logic: Unified Notation Extension of unified notation for propositional logic Universal formulas Type γ 8xA :9xA B. Beckert: Formal Verification of Software – p.12 Predicate Logic: Unified Notation Extension of unified notation for propositional logic Universal formulas Type γ 8xA :9xA Existential formulas Type δ :8xA 9xA B. Beckert: Formal Verification of Software – p.12 Predicate Logic: Unified Notation γ- and δ-formulas and their corresponding “logical” sub-formulas γ γ1(x) δ δ1(x) 8xA(x) A(x) :8xA(x) :A(x) :9xA(x) :A(x) 9xA(x) A(x) B. Beckert: Formal Verification of Software – p.13 Variable assignment A function λ : Var ! D Predicate Logic: Semantics Interpretation A pair D = hD; Ii where D an arbitrary non-empty set, the universe I an interpretation function α for f 2 FΣ: I( f ) : D ( f ) ! D α for p 2 PΣ: I(p) : D (p) ! ftrue; falseg B. Beckert: Formal Verification of Software – p.14 Predicate Logic: Semantics Interpretation A pair D = hD; Ii where D an arbitrary non-empty set, the universe I an interpretation function α for f 2 FΣ: I( f ) : D ( f ) ! D α for p 2 PΣ: I(p) : D (p) ! ftrue; falseg Variable assignment A function λ : Var ! D B. Beckert: Formal Verification of Software – p.14 valD;λ(p(t1; : : : ; tn)) = I(p)(valD;λ(t1); : : : ; valD;λ(tn)) 8 true if val ;λd (A) = true for all d 2 D = D x valD;λ(8xA) <> false otherwise :> 8 true if val ;λd (A) = true for some d 2 D = D x valD;λ(9xA) <> false otherwise :> valD;λ defined for propositional operators in the same way as valI. Predicate Logic: Semantics Valuation Extension of interpretation and variable assignment to formulas valD;λ(x) = λ(x) for x 2 Var valD;λ( f (t1; : : : ; tn)) = I( f )(valD;λ(t1); : : : ; valD;λ(tn)) B. Beckert: Formal Verification of Software – p.15 Predicate Logic: Semantics Valuation Extension of interpretation and variable assignment to formulas valD;λ(x) = λ(x) for x 2 Var valD;λ( f (t1; : : : ; tn)) = I( f )(valD;λ(t1); : : : ; valD;λ(tn)) valD;λ(p(t1; : : : ; tn)) = I(p)(valD;λ(t1); : : : ; valD;λ(tn)) 8 true if val ;λd (A) = true for all d 2 D = D x valD;λ(8xA) <> false otherwise :> 8 true if val ;λd (A) = true for some d 2 D = D x valD;λ(9xA) <> false otherwise :> valD;λ defined for propositional operators in the same way as valI. B. Beckert: Formal Verification of Software – p.15 Predicate Logic: Semantics Example D = R I(0) = 0 I(a) = −1 I(b) = 1 8 R ! R = I( f ) <> x 7! x2 :> I(leq) = true iff x ≤R y I(in_iv) = true iff x 2 [a; b] B. Beckert: Formal Verification of Software – p.16 Satisfiable Φ ist satisfiable iff there are an interpretation D and a variable assignment λ s.t. Φ valD;λ(A) = true for all A 2 Validity A is valid iff all interpretations are a model of A Predicate Logic: Semantics Model An interpretation D is model of a set Φ of formulas iff Φ valD;λ(A) = true for all λ and all A 2 .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    54 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us