Reference Sheet for CO140 Logic Autumn 2016

1 1.1

Definitions

Evaluation 1. > is true, ⊥ is false.

Propositional Logic

2. ¬A has the opposite truth value to A.

Binding Conventions (Strongest) ¬, ∧, ∨, →, ↔ (Weakest).

3. A ∧ B is true if A and B are both true.

Propositional Formula

4. A ∨ B is true if one or both of A and B are true.

1. A propositional atom is a formula.

5. A → B is true if A is false or B is true (or both).

2. > and ⊥ are formulas.

6. A ↔ B is true if A and B have the same truth value.

3. If A is a formula then so is (¬A). 4. If A, B are formulas then so are (A ∧ B), (A ∨ B), (A → B), (A ↔ B).

Valid Argument Given formulas A1 , A2 , . . . , An , B an argument A1 , A2 , . . . , An  B is valid if B is true in any situation in which A1 , A2 , . . . , An are all true. Here  denotes logical entailment.

Principle Connective Connective at the root (top) of a formation tree. A formula with principle connective ↔ is said to have the logical form A ↔ B. Subformulas

Valid Formula A formula A is valid if it is true in every situation, i.e.  A. A tautology is a valid propositional formula.

Correspond to the subtrees of a formation tree.

Formula of the form >, ⊥, p for an atom p.

Atomic

Satisfiable Formula True in at least one situation.

Negated Formula, Conjunction, Disjunction, Implication Formula whose logical form is ¬A, A ∧ B, A ∨ B, A → B respectively. Literal

Equivalent Formulas True in exactly the same situations, i.e. A ≡ B.

Formula that is atomic or negated-atomic.

Disjunctive Normal Form Formula as a disjunction of conjunctions of literals, not further simplifiable.

Clause Disjunction of one or more literals. Situation

Conjunctive Normal Form Formula as a conjunction of disjunction of literals, not further simplifiable.

Determines whether each propositional atom is true or false. 1

Bound Variable For a formula A and variable x, x is bound if it lies under a quantifier ∀x or ∃x in the formation tree of A.

Normal Form 1. Get rid of →, ↔ using equivalences. 2. Use De Morgan laws to push negations down to atoms. Delete any double negations.

Free Variable Variable which is not bound (this includes variables which do not appear in A!).

3. Rearrange using distributivity into the required normal form. Sentence Formula with no free variables. (Does not require an assignment for evaluation).

4. Use equivalences to simplify as far as possible (e.g. using absorption, idempotence, equivalences involving > and ⊥).

Structure For a signature L, and L-structure M :

Theorem Formula that can be established by a given proof system, i.e. any A such that ` A. (Note that ` is syntactic whilst  is semantic - A1 , A2 , . . . , An  B means there is a proof of B starting with A1 , A2 , . . . , An as givens).

1. Identifies a non-empty collection of objects that M ‘knows about’, i.e. the domain of M , dom (M ).

Soundness Any provable formula is valid, i.e. if A1 , A2 , . . . , An ` B then A1 , A2 , . . . , An  B.

2. Specifies what the symbols of L mean in terms of these objects (constants specify objects in dom (M ) and relations specify relations between objects in dom (M )).

Completeness Any valid formula can be proved, i.e. if A1 , A2 , . . . , An  B then A1 , A2 , . . . , An ` B.

3. For an n-ary function symbol f in L, specifies which object f associates with each sequence of objects (a1 , a2 , . . . , an ) in dom (M ). For a constant c, cM denotes the object dom (M ) that c names in M .

Consistency A formula is consistent if 6` ¬A. So a formula is consistent if and only if it is satisfiable.

1.2

For a function f , f M (a1 , a2 , . . . , an ) denotes the object dom (M ) that f (a1 , a2 , . . . , an ) names in M .

Predicate Logic

If a formula A is true in M , we say M  A.

Binding Conventions (Strongest) (¬, ∀x, ∃x), ∧, ∨, →, ↔ (Weakest). Assignment able.

Signature Collection of constants and relation symbols and function symbols with specified arities. Term

If a formula A is true in M under h, we say M, h  A. Value of Term For a signature L, an L-structure M and an assignment h, for any L-term t, the value of t in M under h is the object in dom (M ) allocated to t by:

For a signature L:

1. Any constant in L is an L-term. 2. Any variable is an L-term. 3. For an n-ary function symbol f f (t1 , t2 , . . . , tn ) is an L-term. Closed / Ground Term

For a structure M , allocates an object in dom (M ) to each vari-

1. M if t is a constant, i.e. the object tM . in L and L-terms t1 , t2 , . . . , tn ,

2. h if t is a variable, i.e. the object h (t). 3. f M if t is a function on terms, i.e. f (t1 , t2 , . . . , tn ) is the object f M (a1 , a2 , . . . , an ) where ai is the value of ti in M under h.

Does not involve a variable. 2

Predicate Formula For an L-structure M and an assignment h:

6. Exactly one lecturer: at least one lecturer∧at most one lecturer or ∃x∀y (lecturer (y) ↔ y = x).

1. For an n-ary relation symbol in L, and L-terms t1 , t2 , . . . , tn , R (t1 , t2 , . . . , tn ) is an atomic L-formula. M, h  R (t1 , t2 , . . . , tn ) if M says the sequence (a1 , a2 , . . . , an ) is in the relation R, where ai is the value of ti in M under h.

Remember: 1. Always consider the vacuous case when using ∀.

2. For L-terms t1 , t2 , t1 = t2 is an atomic L-formula. M, h  t1 = t2 if t1 and t2 have the same value in M under h.

2. The order of quantifiers is very important!

3. >, ⊥ are atomic L-formulas. M, h  > and M, h 6 ⊥.

Valid Argument For a signature L, and L-formulas A1 , A2 , . . . , An , B, the argument A1 , A2 , . . . , An  B is valid if for any L-structure M and assignment h into M , if M, h  B given M, h  A1 , M, h  A2 , . . . , M, h  An .

4. For L-formulas A, B, (¬A) , (A ∧ B) , (A ∨ B) , (A → B) , (A ↔ B) are Lformulas. M, h  A ∧ B if M, h  A and M, h  B, etc.

Valid Formula The L-formula A is valid if for for all L-structures M and assignment h into M , M, h  A. We say  A.

5. For an L-formula A and a variable x, (∀xA) and (∃xA) are L-formulas. M, h  ∀xA if M, g  A for every assignment g into M with g =x h and M, h  ∃xA if M, g  A for some assignment g into M with g =x h. (The notation g =x h here means g agrees with h except perhaps on x). Some Translation Advice

Satisfiable Formula The L-formula A is satisfiable if for for some L-structure M and assignment h into M , M, h  A.

Note that: Equivalent Formulas The L-formulas A and B are equivalent if for for every L-structure M and assignment h into M , M, h  A if and only if M, h  B.

1. ∀x (lecturer (x) ∧ human (x)) says everything is a lecturer and a human. 2. ∀x (lecturer (x) → human (x)) says every lecturer is a human.

1.3

3. ∃x (lecturer (x) ∧ human (x)) says there is a lecturer that is also a human.

Term

4. ∃x (lecturer (x) → human (x)) says there is a non-lecturer, or there is a lecturer that is also a human.

Many-Sorted Predicate Logic Redefined such that:

1. Each variable and constant comes with a sort s. We indicate this as x : s and c : s.

Counting:

2. Each n-ary function symbol f comes with a template f : (s1 , s2 , . . . , sn ) → s.

1. No lecturers: ¬∃x (lecturer (x)). 2. At least one lecturer: ∃x (lecturer (x)). 3. At least two lecturers: ∀x∃y (lecturer (y) ∧ y 6= x).

∃x∃y (lecturer (x) ∧ lecturer (y) ∧ x 6= y)

4. At least three lecturers: ∀x∀y∃z (lecturer (z) ∧ z 6= x ∧ z 6= y).

Formula

or

Redefined such that:

1. Each n-ary relation symbol R comes with a template R (s1 , s2 , . . . , sn ). similar

to

above,

e.g.

2. t1 = t2 is a formula if t1 , t2 have the same sort.

5. At most one lecturer: ¬∃x∃y (lecturer (x) ∧ lecturer (y) ∧ z 6= y) or ∀x∀y (lecturer (x) ∧ lecturer (y) → x = y) or ∃x∀y (lecturer (y) → y = x).

It is polite to indicate the sort of a variable in ∀, ∃, e.g. ∀x : lecturer∃y : Sun (boughtlecturer,Sun (x, y)). 3

1.4

2

Formal Specification of Programs

Pre-condition Formula A (x1 , x2 , . . . , xn ) such that any arguments (a1 , a2 , . . . , an ) satisfy the pre-condition iff A (a1 , a2 , . . . , an ) is true. If there is no restrictions on arguments beyond type information, we write ’none’ or >. Post-condition arguments.

Checking Validity

We can use: 1. Truth tables - but not for predicate logic 2. Direct argument 3. Equivalences

Formula expressing intended value of a funtion in terms of

4. Proof systems - e.g. natural deduction

2.1

Lists We can define a signature suitable for lists of type [Nat]: Constants:

Direct Argument

Propositional Logic

• 0, 1, · · · : Nat

1. Take an arbitrary situation. 2. Prove that the formula is true in this situation. (Often this will require the law of excluded middle - argument by cases).

Relations: • <, ≤, >, ≥: (Nat,Nat)

Predicate Logic Functions:

To show the argument A1 , A2 , . . . , An  B is valid:

1. Consider any M such that M  A1 , M  A2 , . . . , M  An .

• +, −, × : (Nat,Nat)→Nat

2. Show M  B, e.g.:

• [] : [Nat]

(a) M  ∀x (B (x)): Consider an arbitrary object a in dom (M ). Show M  B (a). (b) M  ∃x (B (x)): Consider any object b in dom (M ). Show M  B (b).

• cons(:) : (Nat,[Nat])→[Nat] • ++ : ([Nat],[Nat])→[Nat] • head : [Nat]→Nat

2.2

• tail : [Nat]→[Nat]

When using equivalences, you must justify every step by stating the equivalence you used. Remember you can work from either direction. Note that distributivity is often very helpful when applied backwards. Be especially careful with ∧ and ∨!

• # : [Nat]→Nat • !! : ([Nat],Nat)→Nat Pre-conditions for functions on lists are usually > or sometimes involve checking the list is non-empty (#xs > 0). Post-conditions for functions on lists often involve:

Equivalences

¬ 1. ¬> ≡ ⊥ 2. ¬⊥ ≡ >

1. Checking a property of a list and its length compared to the given list (e.g. #xs = #ys ∧ ∀i : Nat (i < #xs → P (ys!!i)) where ys = f (x)).

3. ¬¬A ≡ A 4. ¬ (A ∧ B) ≡ ¬A ∨ ¬B (De Morgan)

2. Checking a property of an item and its presence in the given list (e.g. ∃i : Nat (i < #xs ∧ xs!!i = y) ∧ P (y) where y = f (x)).

5. ¬ (A ∨ B) ≡ ¬A ∧ ¬B (De Morgan) 4





1. A ∧ B ≡ B ∧ A (Commutativity)

1. A ↔ B ≡ (A → B) ∧ (B → A) ≡ (A ∧ B) ∨ (¬A ∧ ¬B) ≡ ¬A ↔ ¬B

2. A ∧ A ≡ A (Idempotence)

2. ¬ (A ↔ B) ≡ A ↔ ¬B ≡ ¬A ↔ B ≡ (A ∧ ¬B) ∨ (¬A ∧ B)

3. A ∧ > ≡ A

∀, ∃

4. ⊥ ∧ A ≡ ¬A ∧ A ≡ ⊥ 1. ∀x∀yA ≡ ∀y∀xA 5. (A ∧ B) ∧ C ≡ A ∧ (B ∧ C) (Associativity) 2. ∃x∃yA ≡ ∃y∃xA 6. A ∧ (B ∨ C) ≡ (A ∧ B) ∨ (A ∧ C) (Distributivity)

3. ¬∀xA ≡ ∃x¬A

7. A ∧ (A ∨ B) ≡ A (Absorption)

4. ¬xA ≡ ∀x¬A 5. ∀x (A ∧ B) ≡ ∀xA ∧ ∀xB



6. ∃x (A ∨ B) ≡ ∃xA ∨ ∃xB

1. A ∨ B ≡ B ∨ A (Commutativity)

For A in which x does not Occur Free:

2. A ∨ A ≡ A (Idempotence) 3. ⊥ ∨ A ≡ ¬A ∨ A ≡ >

1. A ≡ ∀xA ≡ ∃xA

4. A ∨ > ≡ A

2. ∃x (A ∧ B) ≡ A ∧ ∃xB

5. (A ∨ B) ∨ C ≡ A ∨ (B ∨ C) (Associativity)

3. ∀x (A ∨ B) ≡ A ∨ ∀xB

6. A ∨ (B ∧ C) ≡ (A ∨ B) ∧ (A ∨ C) (Distributivity)

4. ∃x (A → B) ≡ A → ∃xB

7. A ∨ (A ∧ B) ≡ A (Absorption)

5. ∀x (A → B) ≡ A → ∀xB 6. ∃x (B → A) ≡ ∀xB → A*



7. ∀x (B → A) ≡ ∃xB → A*

1. A → A ≡ >

* Watch out for these two cases!

2. > → A ≡ A =

3. A → > ≡ > 4. ⊥ → A ≡ >

1. t = t ≡ >

5. A → ⊥ ≡ ¬A

2. t = u ≡ u = t

6. A → B ≡ ¬A ∨ B ≡ ¬ (A ∧ ¬B)

3. Leibniz Principle If A is a formula in which x occurs free and y does not occur and B is the formula obtained from A by replacing one or more free occurences of x by y, then x = y → (A ↔ B) ≡ >.

7. ¬(A → B) ≡ A ∧ ¬B 5

Renaming Bound Variables The formula in which all bound occurrences of a variable and the respective quantifiers are changed to a new variable is equivalent to the original formula.

2.3

↔-Elimination

Natural Deduction

¬-Introduction

When using natural deduction, remember line numbers and reasoning are required for every step. You should take time to check your answers.

∧-Introduction

1 2 3

A B A∧B

∧-Elimination

∨-Introduction

∨-Elimination

→-Introduction

→-Elimination

↔-Introduction

A∧B A B

1 2 3

1 2 3

1 2 3

1 2 3

1 2 3

A ⊥ ¬A

1 or 2 ↔ E (1, 2) 3

∧E (1) ∧E (1)

A A∨B B∨A

A B A→B A→B A B A→B B→A A↔B

⊥ A

1 2

1 2 3

A ¬A ⊥

¬E (1, 2) or ⊥I (1, 2)

⊥E (1)

Proof by Contradiction

∃-Introduction

ass ∃-Elimination

→ I (1, 2)

→ E (1, 2)

∀-Introduction

∀-Elimination

↔ I (1, 2) 6

1 2 1 2 3 4 2 3 4 1 2

¬¬E (1)

A ∨ ¬A

1

Excluded Middle

∧I (1) ∧I (1)

↔ E (1, 2)

¬I (1, 2)

¬¬A A

1 2

¬¬-Elimination

A↔B B A

ass

∧I (1, 2)

A∨B A ass 4 B ass C 5 C C ∨E (1, 2, 3, 4, 5)

1 2 3 6

A↔B A B

¬-Elimination /⊥-Introduction

⊥-Elimination 1 2 3

1 2 3

1 2 3

A (t/x) ∃xA ∃xA A (c/x) B B c A (c/x) ∀xA ∀xA A (t/x)

lemma

¬A ⊥ A

ass P C (1, 2)

∃I (1)

ass ∃E (1, 2, 3) ∀I const ∀I (1, 2)

∀E (1)

∀ →-Elimination

Reflexivity

1

Symmetry

t=t 1 2 3

Substitution

1 2

1 2 3

∀x (A (x) → B (x)) A (t/x) B (t/x) refl

A (t/x) t=u A (u/x) c=d d=c

∀ → E (1, 2)

sub(1, 2)

sym(1)

7

Reference Sheet for CO140 Logic - GitHub

Free Variable Variable which is not bound (this includes variables which do not appear in A!). Sentence Formula with no free variables. ... domain of M, dom (M).

162KB Sizes 3 Downloads 318 Views

Recommend Documents

Oolite Reference Sheet - GitHub
will shut down, requiring a cool-down period before it ... 10 Fuel Scoop ... V2 & Creative Commons License: BY - NC - SA 3.0 Oolite Website: http:/www. ..... A discontinued fighter design finding a new life in the professional racing circuit.

Reference Sheet for CO120.3 Programming III - GitHub
GBB. B d˜rief en enum type th—t represents fl—gs for renderingF. B. B i—™h ˜it represents — different fl—gF …se ˜itwise —nd. B to ™he™k if — fl—g is setF. BG enum render•fl—g {. GBB „he —m˜ient fl—g @˜it HAF BG

Reference Sheet for C112 Hardware - GitHub
Page 1 ... We might be able to make a considerable simplification by considering max- terms (0s) instead of minterms. • Don't cares (X) can ... Noise Margin. Fan out The number of inputs to which the output of a gate is connected. • Since 1. R.

Reference Sheet for CO120.2 Programming II - GitHub
Implementing Interfaces Use notation: @Override when a class method im- ... Style: usually a class extends an abstract class (with constructor and fields).

Reference Sheet for CO130 Databases - GitHub
create table actor_cars ( .... Table. Relational Expression. Views. Tuple. Row. Attribute. Column. Domain .... end of free space, location and size of each record.

Reference Sheet for CO142.1 Discrete Mathematics I - GitHub
Products For arbitrary sets A and B: 1. Ordered ... Identity idA = {〈x, y〉 ∈ A2|x = y}. Composition .... Identity: The function idA : A → A is defined as idA (a) = a. 3.

Reference Sheet for CO141 Reasoning about Programs - GitHub
General Technique: For any P ⊆ Z and any m : Z: P (m) ∧ ∀k ≥ m. [P (k) → P (k + 1)] → ∀n ≥ m.P (n). 1.2 Strong Induction. P (0) ∧ ∀k : N. [∀j ∈ {0..k} .

Reference Sheet for CO142.2 Discrete Mathematics II - GitHub
Connected: there is a path joining any two nodes. .... and merge two components .... Merge sort can be parallelised by executing recursive calls in parallel. 2.

Logic Engine 2 cheat sheet 3.cdr - GitHub
Plastics. (1) Rear Inner Bezel (black 1/8" acrylic). (1) Rear Outer Bezel (black 1/8" acrylic). (1) Rear Inner Screen (clear 1/16" non-glare acrylic). (1) Rear Outer Screen (clear 1/16" non-glare acrylic). (2) Front Inner Bezel (black 1/8" acrylic).

Location Reference Sheet for writers.pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Location ...

Reference Sheet for CO120.1 Programming I
Stops execution and displays error message. 9 Types and Common ... multiple times or to clean up code. ... You should spend time planning your answer (on ...

CSS3 Cheat Sheet - GitHub
Border Radius vendor prefix required for iOS

gitchangelog Cheat Sheet - GitHub
new: test: added a bunch of test around user usability of feature X. fix: typo in spelling my name in comment. !minor. By Delqvs cheatography.com/delqvs/. Published 14th August, 2017. Last updated 14th August, 2017. Page 1 of 1. Sponsored by ApolloPa

Reference Manual - GitHub
for the simulation of the electron cloud buildup in particle accelerators. 1 Input files .... points of the longitudinal beam profile of sec- ondary beams.

NetBSD reference card - GitHub
To monitor various informations of your NetBSD box you ... ifconfig_if assigns an IP or other on that network in- ... pkg_admin fetch-pkg-vulnerabilities download.

Machine Learning Cheat Sheet - GitHub
get lost in the middle way of the derivation process. This cheat sheet ... 3. 2.2. A brief review of probability theory . . . . 3. 2.2.1. Basic concepts . . . . . . . . . . . . . . 3 ...... pdf of standard normal π ... call it classifier) or a decis

LIKWID | quick reference - GitHub
likwid-memsweeper Sweep memory of NUMA domains and evict cache lines from the last level cache likwid-setFrequencies Control the CPU frequency and ...

J1a SwapForth Reference - GitHub
application. After installing the icestorm tools, you can .... The SwapForth shell is a Python program that runs on the host PC. It has a number of advantages over ...

GABotS Reference Manual - GitHub
Apr 9, 2002 - MainWindow (Main widget for the GABots app). 23. Random ..... Main class for simple Genetic Algorithm used in the program. ز ذظ .

RTOS Threading Cheat Sheet - GitHub
If the UART is enabled, it causes a data frame to start transmitting with the parameters indicated in the. UARTLCRH register. Data continues to be transmitted ...

R Markdown : : CHEAT SHEET - GitHub
Word, or RTF documents; html or pdf based slides ... stop render when errors occur (FALSE) (default = FALSE) .... colortheme. Beamer color theme to use. X css.

RN-171 Data Sheet - GitHub
Jan 27, 2012 - 171 is perfect for mobile wireless applications such as asset monitoring ... development of your application. ... sensor data to a web server.

Go Quick Reference Go Quick Reference Go Quick Reference - GitHub
Structure - Package package mylib func CallMeFromOutside. Format verbs. Simpler than Cās. MOAR TABLE package anothermain import (. "fmt". ) func main() {.

Log4j Quick Reference Card - GitHub
log4j.appender.socket.port=10005 log4j.appender.socket.locationInfo=true log4j.logger.com.my.app=DEBUG. Level. Description. ALL. Output of all messages.