Skip to content

Latest commit

 

History

History
376 lines (332 loc) · 17.3 KB

File metadata and controls

376 lines (332 loc) · 17.3 KB

* Ioduction to Logic

⊃, ∨, ∧, ¬, ≡, ≠, ∀, ∃, λ, ≤, ≥, ∈, ∉, ∞, Online Book

Lesson 1 - Introduction

1.1 Introduction to Logic (3 min)

1.2 Elements of Logic (10 min)

1.3 Formalization (9 min)

1.4 Automation (5 min)

1.5 Study Guide (4 min)

Lesson 2 - Propositional Logic

2.1 Propositional Logic (1 min)

2.2 Syntax of Propositional Logic (7 min)

Propositiona Sentences

  • Simple(proposition constants) - express single facts about the world
  • Compound - express logical relationsheeps among simpler sentences of which composed
    1. Negation - target
    2. Conjuction - tha argument of conjuction are called conjucts
    3. Disjunction - disjuncts
    4. Implication (p=>q) - p: antecedent(ենթադրյալ), q:consequent (հետևանք)
    5. Reduction (q <= p) - q: consequent, p: antecedent
    6. Equivalence / Biconditional (p <=> q)
  • Precendence of connectives (նախորդում, ավելի բարձր դիրք, приоритет) ~ & v >, <, <=>

Proposition Language

is the set of all propositional sentences that can be formed from propositional vocabulary.

  1. Proposition vocabulary is a set/sequence of proposition constants.

2.3 Semantics of Propositional Logic (10 min)

Evaluation procedure
  1. Replace proposition constants by their truth values.
  2. Use operator semantics to simplify compound sentences with truth values as arguments.
  3. Repeat this inside-out fashion to produce a value for the sentence as a whole.

2.4 Satisfaction (3 min)

Satisfication procedure (1) Form a truth table for the proposition constants and add columns for each sentence in our set. (2) Evaluate each sentence for each of the rows ot the truth table. (3) Any row that satisfy al sentences int the set is a solution to the problem.

2.5 Properties of Sentences (3 min)

  1. Double Negation: p <=> ~~p
  2. deMorgan’s Laws: ~(p&q) <=> (~p v ~q) ~(p&q) <=> (~p & ~q)
  3. Implication Introduction: p => (q => p)
  4. Implication Distribution: (p => (q => r)) => ((p => q) => (p => r))

2.6 Logical Entailment (6 min)

{p} |= (p v q) p logicali entails (p v q) logic1-ի վավերականույթուն ստուգելու նույն ալգորիթմով ստուգում ենք, if p entails (p v q)
pqp(p v q)
1111+
1011+
0101
0000

{p,q} entails (p & q) p,q, premises (p & q) logical conclusion from promosies p and q

pqpq(p & q)
11111+
10100
01010
00000

2.7 The Big Game (3 min)

Stanford people always tell the truth, and Berkeley people always lie. Unfortunately, by looking at a person, you cannot tell whether he is from Stanford or Berkeley. You came to a fork in the road and want to get to the football stadium down one fork. However, you do not know which to take. There is a person standing there. What single question you can ask him to help you decide which fork to take?
leftfrom stanfordQuestionResponse
1111+
1001
0100
0010

Question: Is it the case that the left road the way to the stadium if and only if you are from Stanford?

Lesson 3 - Propositional Satisfiability (Իրագործելիություն)

3.1 Propositional Satisfiability (16 min)

Boolean Satisfiability Solver

▶SAT: determines wheather a set of propositional sentences is satisfiable. Logic problems react as SAT problems (e.g entailment) SAT solvers used in

  • Haedware design
  • Software analysis
  • Planning
  • Mathematics

▶Methods used in SAT

  1. Complete methods

Guraranteed to give correct answer Truth Tables Backtracking search (Поиск с возвратом)

  1. Incomplete methods

Not guraranteed to give correct answer Local Search

▶Example Let Ψ = {p v q, p v ~q, ~p v q, ~p v ~q v ~r, ~p v r} Q: is Ψ satisfiable? Thas there is exsit a truth assignment that satisfied every sentence in Ψ? Assume each sentence in Ψ is a disjunction of atmos or negated atoms Solution: • Truth Table method - Complete method

pqrp v qp v ~q~p v q~p v ~q v ~r~p v rΨ sat.
00001110no
00101111no
01010111no
01110111no
10011010no
10111011no
11011110no
11111101no

Complete: thruth table method is complete, because we examine every single truth assignment Impractical except for small examples rows

  • 2 ^ 3 = 8
  • 2 ^ 10 = 1024
  • 2 ^ 20 = 1 million (10 ^ 6)
  • 2 ^ 30 = 1 billion (10 ^ 9)
  • 2 ^ 40 = 1 trillion(10 ^ 12)

• Partial assignments

pqrp v qp v ~q~p v q~p v ~q v ~r~p v rΨ sat.
10?1101?no
10?1101?no

because we have already the False in row and we do not need to check other sentences, we already no that answer is no.

• Searching partial assignments instead of only complete assignments. Tree like ??? / \ p false p true 0?? / this idea base rise to the basic backtracking search

▶ Basic backtracking search Essential backtracking search optiomization

  • Unit propagation
  • Pure Literal elimination

Most modern complete SAT sovlers are based on variations of DPLL (Davis-Putman-Logemann-Loveland)

  • Clause Learning
  • Fast Propagation
  • Proposition selection heuristicc

➤ incomplete method Some SAT problems still impractical for complete SAT sovlers Little opportunity for early pruning (Էտում) Consider method that answer correctly most of the time, but not every time

GSAT: a prototype incomplete SAT solver WalkSAT: a modification of GSAT

Lesson 4 - Propositional Proofs (20 min)

4.1 Propositional Proofs (2 min)

4.2 Linear Proofs (8 min)

Excerise

4.3 Structured Proofs (5 min)

exercise

4.4 Fitch (3 min)

Video inline quize

4.5 Soundness and Completeness (2 min)

Lesson 5 - Propositional Resolution

Пра́вило резолю́ций — это правило вывода, восходящее к методу доказательства теорем через поиск противоречий; используется в логике высказываний и логике предикатов первого порядка. Правило резолюций, применяемое последовательно для списка резольвент, позволяет ответить на вопрос, существует ли в исходном множестве логических выражений противоречие.Правило резолюций предложено в 1930 году в докторской диссертации Жака Эрбрана для доказательства теорем в формальных системах первого порядка. Правило разработано Джоном Аланом Робинсоном в 1965 году.

5.1 Propositional Resolution (2 min)

5.2 Clausal Form (5 min)

Exercise

5.3 Resolution Principle (5 min)

Exercise

5.4 Resolution Method (7 min)

Ex 1. Ex 2. Clausal Form Premises: {p, p => q, (p => q) => (q => r)} Conlclusion: r

Premises:Clauses:
p{p}
p => q{~p,q}
(p=>q)=>(q=>r){~p,~q,r}
{~q,r}
~r{~r}

Resolution proof:

1{p}Premise
2{~p,q}Premise
3{~p,~q,r}Premise
4{~q,r}Premise
5{~r}Premise
6{q}1,2
7{r}4,6
8{}5,7

5.5 Box Logic (out of focus) (04:21)

Lesson 6 - Relational Logic

⊃, ∨, ∧, ¬, ≡, ≠, ∀, ∃, λ, ≤, ≥, ∈, ∉, ∞,

6.1 Relational Logic (2 min)

When we want to say things more generally, we find that Propositional Logic is inadequate. Suppose, for example, that we wanted to say that, in general, if one person knows a second person, then the second person knows the first.

▶Relational Logic is an extension of Propositional Logic that solves this problem. The trick is to augment(ավելացնել) our language with two new linguistic features, viz.

  1. variables
  2. quantifiers

With these new features, we can express information about multiple objects without enumerating those objects; and we can express the existence of objects that satisfy specified conditions without saying which objects they are.

▶We will proceed through the same stages as we did for Propositional Logic.

  1. syntax and semantics of our language.
  2. properties of relational logic sentences
  3. evaluation and satisfaction
  4. logical entailment.
  5. proofs (as with Propositional Logic, we leave the discussion of proofs to later chapters)

6.2 Syntax (9 min)

▶ Basic words of our language
  1. Variables u,w,x,y,z
  2. Constants a, b, c, 123, comp125 Types
    • Object constants represent objects. e.g. joe, stanford, usa
    • Function constatns replresent functions. e.g. father, mother, age, plus, times
    • Relation constants represent relations. e.g. knows, loves
  3. Arity the number of arguments a function constant or a relation constant it takes.
    • Unary - function or relation constant - 1 argument
    • Binary - function or relation constant - 2 argument
    • Ternary - function or relation constant - 3 argument
    • n-ary - function or relation constant - n argument
  4. Vocabulary(signature) of our language

consists of a set of object constants, a set of function constants, a set of relation constants, and an assignment of arities for each of the function constants and relation constants in the vocabulary. ▶ Terms - these words can be combined to form complex expressions called terms

  1. A term is either a variable, an object constant, or a functional term Terms represent objects. Terms are analogues to noun phrases in natural language.
  2. A functional expression, or functional term is an expression formed from n-ary function constant and n terms enclosed in parenthesis and spearated by commas. g(a,a) g(a,y) g(y,y) Funnctional terms are terms so can be nested g(g(a,y), g(y,a))

▶ Sentences How terms can be combined to form sentences Three type of sentences in relational logic. ▶ Relational sentences - analogues to the simple sentences in natural language or the analog of propositions in Propositional Logic is an expression formed from n-ary relation constant and n terms enclosed in parenthesis and spearated by commas. q(a,y) Relational sentences are not terms and cannot be nested in terms or relational sentences ▶ Logical sentences - analogous to the logical sentences in natural language or analogous to the logical sentences in Propositional Logic Logical sentences in Relational logic are analogus to those in Propositional logic. (~q(a,b)) (p(a) ∧ p(b)) (p(a) ∨ p(b)) (q(x,y) ⊃ q(y,x)) (q(x,y) ≡ q(y,x))

▶ Quantified sentences - sentences that express the significance(կարեւորություն) of variables(which have no analog in Propositional Logic)

  1. Universally quantified sentences - assert fact about all objects. (∀) Universal sentences used to assert that all object have a certain property (∀x.p(x) ⊃ q(x,x))
  2. Exsistentially quantified sentences - assert the existence of objects with given properties.(∃) Existential sentences used to assert that there are object have a certain property (∃x.(p(x) ∧ q(x,x)))
  3. Note that quantified sentences can be nested within other sentences (∀x.p(x)) ∨ (∃x.q(x,x)) (∀x.(∃x.q(x,y)))
  4. The quantifiers have higher precedence than logical operations ∀x.p(x) ⊃ q(x,x)

▶ Ground and Non-Ground expressions

  1. Ground An expression is ground iff it contains no variables. p(a)
  2. Non-Ground ∀x.p(x)

▶ Bound and Free Variables An occurence of variable is bound iff it lies in the scope of a quantifier of that variable. Otherwise it is free. ∃y.q(x,y) - in this example, x is free and y is bound.

6.3 Semantics (8 min)

6.4 Example - Sorority World (5 min)

6.5 Example - Blocks World (4 min)

6.6 Example - Modular Arithmetic (5 min)

6.7 Example - Peano Arithmetic (6 min)

6.8 Example Linked Lists (4 min)

6.9 Example - Pseudo-English (5 min)

6.10 Example - Metalevel Logic (6 min)

6.11 Properties of Sentences (3 min)

6.12 Logical Entailment (4 min)

6.13 (Optional) Finite Relational Logic (7 min)

6.14 (Optional) Omega Relational Logic (9 min)

6.15 (Optional) General Relational Logic (4 min)