@TangWill
2019-05-15T10:15:31.000000Z
字数 25416
阅读 687
DiscreteMathematicalStructures
Logic is the discipline that deals with the methods of reasoning. It is now an integral part of disciplines such as mathematics, computer science, and linguistics.
A statement or proposition is a declarative sentence that is either true of false, but not both.
Proposition | Not a Statement |
---|---|
The national flag of China is red | x + 5 > 3 |
In mathmematics, the letters ofen denote variables that can be replaced by real numbers,and these variables can be combined with the familiar operations. In
logic, the letters denote propositions variables; that is, variables that can be replaced by statements.
Statements or propositional variables can be combined by logical connectives to obtain compound statements.
Use logical operators:
Operator | Symbol |
---|---|
Negation (not) | |
Conjunction (and) | |
Disjunction (or) | |
Exclusive or | |
Implication | |
Biconditional |
常用语:不,没有,无,否定,取反
p | |
---|---|
For propositions p and q, the output will be true if and only if (notation: IFF) both p and q are true.
常用语:并且,以及,和,与,既…又,不但…而且,尽管…依然,虽然…但是
p | q | |
---|---|---|
For propositions p and q, the output will be true if either or both p and q are true.
常用语:或者
p | q | |
---|---|---|
It is also called exclusive disjunction and the results in a value of true if exactly one of the operands has a value of true."one or the other but not neither nor both."
p | q | |
---|---|---|
p is the premise and q is the conclusion.
常用语:如果…那么,若…则,只要…就
eg.
In the case where p is true and q is false, the outcome is false.A false hypothesis implies ANYTHING
p | q | |
---|---|---|
If is an implication, then the converse of is the implication , and the contrapositive of is the implication .
True if p and q have the same truth value.
常用语:当且仅当,等价于,…和…一样
p | q | |
---|---|---|
A statement that is true for all possible values of its propositional variables is called tautology. A statement that is always false is called a contradiction or an absurdity, and a statement that can be either true or false, depending on the truth values of its propositional variables, is called a contingency.
If a proposition is tautology then it is contingency, the reverse is not true.
Commutative properties
Associative Properties
Distributive Properties
Idempotent Properties
Absorption Properties
Properties of Negation
Other Properties
Note:
只要够分数线,就能上大学(充要条件)
- p:(某人)够分数线
- q:(某人)能上大学
只有够分数线,才能上大学(充分条件)
- p:(某人)够分数线
- q:(某人)能上大学
The process of deriving a new equivalent form from a known equivalent form.
Basic equivalence | Symbol |
---|---|
Double negative law | |
Idempotent law | |
Commutative law | |
Associative law | |
Distributive law | |
De morgan law | |
Absorption law | |
Zero or one law | |
Law of Identity | |
Law of excluded middle | |
Law of contradiction | |
Implicit equivalence | |
Equivalent equation | |
False translocation | |
Equivalent negation equivalent formula | |
Return to fallacy |
Where and represent formulas of propositional logic, is a substitution instance of if and only if may be obtained from by substituting formulas for symbols in , always replacing an occurrence of the same symbol by an occurrence of the same formula. If is a tautology, so is .
Suppose represents a formula of propositional logic contain formula A as a clause, and represents a formula which replace an occurrence of A with a logically equivalent formula B; then .
Note: Unlike substitution its permissible for the replacement to occur only in one place (i.e. for one formula).
Aspect | Substitution | Replaceemnt |
---|---|---|
Use object | Any tautology | Any propositional formula |
Substitution object | Any propositional variable | Any sub-formula |
Substitute | Any propositional formula | Any Propositional Formula Equivalent to Substitution Object |
Substitution method | Substituting all occurrences of the same proposition variable | Some Appearances of Substitution Formula |
Substitution result | It is still tautological | Equivalent to the original formula |
eg.
化简语句:"情况并非如此:如果他不来,那么我也不去"。
我去了,而他没来
Note:
- A disjunctive normal form is a contradiction if and only if each fundamental conjunction of it is a contradiction.
- A conjunctive normal form is a tautology if and only if each fundamental disjunction of it is a tautology.
Every propositional formula can be converted into an equivalent formula that is in CNF and DNF.
To convert a propositional formula to equivalent CNF or DNF:
eg.
Find a DNF of
Find a CNF of
A conjunction of n propositional variables:
There are minterms of n propositional variables. We denote them as .
Suppose there are three propositional variable p, q and r.
minterm | represent1 | represent2 | symbol |
---|---|---|---|
000 | 0 | ||
001 | 1 | ||
010 | 2 | ||
011 | 3 | ||
100 | 4 | ||
101 | 5 | ||
110 | 6 | ||
111 | 7 |
Nature:
(1)、For any formula with n propositional variables, the number of all possible minimum terms is the same as the number of interpretations of the formula, and is .
(2)、Each minterm is true under only one explanation.
(3)、Minterm are not equivalent, and
(4)、Any formula containing n propositional variables can be represented by the disjunction of k minterms.
(5)、The formula formed by the disjunction of minterms must be tautology.
Disjunctive formula consisting of n propositional variables:
There are 2n maxterms of n propositional variables.We denote them as .
Suppose there are three propositional variable p, q and r.
maxterm | represent1 | represent2 | symbol |
---|---|---|---|
000 | 0 | ||
001 | 1 | ||
010 | 2 | ||
011 | 3 | ||
100 | 4 | ||
101 | 5 | ||
110 | 6 | ||
111 | 7 |
Nature:
(1)、For any formula with n propositional variables, the number of all possible maxterms is the same as the number of interpretations of the formula, and is .
(2)、Each maxterm is false under only one explanation.
(3)、Minterm are not equivalent, and
(4)、Any formula containing n propositional variables can be represented by the conjunction of k maxterms.
(5)、The formula formed by the conjunction of maxterms must be tautology.
Therefore,we can know the relationship of the minterm and the maxterm:
To convert a propositional formula to equivalent formula that is in FDNF:
Note:Suppose the formula A has n propositional variables and .Then , where .
To convert a propositional formula to equivalent formula that is in FCNF:
Note:
Every propositional formula can be converted into an unique equivalent formula that is in full disjunctive normal form.
Every propositional formula can be converted into an unique equivalent formula that is in full conjunctive normal form.
eg.
求的主析取范式和主合取范式。
原公式的析取范式是,
故
因此,主合取范式为空公式
Inference is the act or process of deriving logical conclusions from premises known or assumed to be true.
Rules of Inference
rule | symbol |
---|---|
Addition | |
Simplification | |
Modus ponens | |
Modus tollens | |
Disjunctive syllogism | |
Hypothetical syllogism | |
Equivalent syllogism |
用附加前提法证明推理:
- 前提:
- 结论:
推理正确,是有效结论
用归谬法证明推理:
- 前提:
- 结论:
由(9)得出矛盾,说明推理正确
Then P(x) is called a predicate or propositional function with respect to the set D if for each value of x in D, P(x) is a statement; i.e., P(x) is true or false.Moreover, D is called the domain of the discourse and x is called the free variable.
Then P(x, y) is a predicate with respect to the set D if for each value pair of x and y in D, P(x, y) is a statement.Such as Greater(x, y),Equal(x, y).
Predicate P(x) means that x has the property P,while P(x, y) means that x and y have the relation P.
The universal quantification of P(x) is the statement: “for all x, P(x)” or “for every x, P(x)” or “for any x, P(x)” The symbol is read as “for all and every”.
The existential quantification of P(x) is the statement:“there exists an x, P(x)” or “there is an x, P(x) ” or “there is some x, P(x) ” The symbol is read as “there exists”.
Note:The variable appearing in: x P(x) or x P(x) is called a bound variable, and P(x) is called the scope of the quantifier.
eg.
All the primes are odd.
Not
“all…are…”: use , not
eg.
There is an even prime.
Not
use , not .
eg.
There exists an unique even prime.
The well-formed formula in predicate logic are inductively defined as follows:
(1) Any variable, constant symbol and a simple predicate is a wff.
(2) If A is a wff, then is also a wff.
(3) If A and B are wffs, then are also wffs.
(4) If A is a wff and x is a variable which does not bounded occur in A(x), then are also wffs.
A formula A is logically valid if it is true for every interpretation.
A formula A is unsatisfiable if it is false for every interpretation.
A formula A is satisfiable if it is true for some interpretation.
Replacement:
Suppose represents a formula contain formula A as a subformula, and represents a formula which replace an occurrence of A with a logically equivalent formula B; then .
Substitution
Suppose and are all predicate formulas and is obtained from by substituting all the occurrence of a free variable by an new variable not appear in ; then .
Renaming
Suppose and are all predicate formulas and is obtained from by substituting one bound variable x of by an new variable not appear in its scope; then .
Tautologies in predicate logic:
A sentence that can be obtained by taking a tautology of propositional logic and uniformly replacing propositional variables by first-order formulas (one formula per propositional variable).
Elimination of quantifiers
Shrink and expansion of scope
The equivalences are valid when x does not appear as a free variable of B.
De Morgan’s laws
If x appear as a free variable of A(x), then
Distribution of quantifiers
Note: vs. , vs.
Variable renamed equivalent
Equivalence for Quantizing Predicate Arguments Many Times
eg.
证明:
eg.
证明:
A formula of the predicate calculus is in prenex normal form if it is written as a string of quantifiers (referred to as the prefix) followed by a quantifierfree part (referred to as the matrix)
where is or .Every formula in predicate logic is equivalent to a formula in prenex normal form. However, the equivalent prenex normal form is not unique.
The Basic Steps to seek Prenex Normal Form:
eg.
求 的前束范式
Universal Instantiation (or Universal Elimination, or Universal Specification)
Restriction
Universal Generalization (or Universal Introduction)
Restriction
Existential Instantiation (or Existential Elimination or Existential Specification)
Restriction
Existential Generalization (or Existential Introduction)
Restriction
构造下列推理的证明:
- 如果一个人怕困难,他就不会获得成功。所有的人或者获得成功,或者失败。有些人没有失败。所以,有些人不怕困难。
引入谓词将这三句话形式化,可得如下推理形式:
设定:
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
A set is an well-defined collection of objects.Individual items in a set are called elements or members.
NOTE: there is no relationship between different elements of a general set.
We write to say that element x belongs to the set A.The set with NO elements is called the empty set and denoted by .
We designate by card(A) or |A| the cardinality of a set A, which is the number of distinct element in A.
Given two sets A and B ,if every element in A is an element of B ,we say that A is a subset of B or that A is contained in B,and B is a superset of A,and we write
Let A be a set. Then set of all subsets in A is called the power set of A and is denoted as P (A).For finite A, | P (A) | =.
Discrete mathematics is one of the major courses for software engineering majors. In the past four weeks of study, we have learned about set and logic. In the previous knowledge combing, since the collected knowledge was repeatedly studied in high schools and universities, only a few basic and important concepts were combed, and the knowledge of logic part was thoroughly combed. In the process of learning and combing logic knowledge, I have been thinking about the importance and necessity of logic for software development and project management. At first, I didn't think of the importance of logic for software engineering. With the constant clarification of knowledge, I gradually realized that logical thinking is helpful to the algorithm design and overall design mode of software project development, and it is also helpful to transform complex requirements into abstract logical thinking. As we have said in class, simple and abstract algorithms are as important to software as universally valid formulas.
As for the teacher's teaching mode, I am very happy that the teacher can share with us cutting-edge knowledge and hot technologies. Although we may not be able to understand or make great efforts to study some technologies, such teaching mode also helps us to understand knowledge.
However, it is hoped that teachers can appropriately increase the amount and difficulty of homework in the subsequent teaching so as to understand and apply knowledge more effectively.
Since entering the university, I have met many teachers who are responsible for friendship and students who are active and enterprising. Such an environment also makes me continuously improve. Of course, under such circumstances, there will inevitably be some pressure. As the teacher said, our present age is not suitable for labeling ourselves. We should enrich ourselves by learning more. Whether it is to improve their professional level, enrich their knowledge, or enjoy the scenery of the four seasons, universities should do something meaningful. The flower has a re-opening day, and there are no more teenagers. I think we should all live in this way, and when we wake up in the morning, we can all expect something.