ChLogic离散数学英文实用PPT课件
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Discrete Structures: Terminology
• Algorithm (Algorithmic Analysis, Algorithmic Thinking) • Universal, Existential Quantification, Rule of Inference • Probability, Statistics, Event, Independent, Dependent • Operation, Operator, Product, Sum, Division, Integer, Real Number,
• Steps to convert an English sentence to a statement in propositional logic • Identify propositions and using propositional variables • Determine appropriate logical operations
• “If I go to iShow (爱秀) or to CHIC (东京秀客 ), t hen I will no t go sho pping at Golden Ea gle .” • p: I go to iShow • q: I go to CHIC • r: I go shopping at GE
Solution: Let p be A is a knight, and q be B is a
kniቤተ መጻሕፍቲ ባይዱht
• If A is a knight, then p True. Since knights tell
the truth, then
If p or q then not r.
第2页/共60页
Example
• Problem: Translate the following sentenc e into propositiona l logic: “You can access the Internet from campus if you are a computer science major or you are not a freshman.”
第5页/共60页
Application: Logic Puzzles
• An island has two kinds of inhabitants, knights, who always tell the truth, and knaves, who always lie.
• You go to the island and meet A and B. a) A says “B is a knight.” b) B says “ The two of us are of opposite types.” Question: What are the types of A and B?
• Solution: Define a: You can access the internet from campus c: You are a computer science major f : You are a freshman .” (c ∨ ¬ f ) → a
第3页/共60页
Application: System Specifications
• System and Software engineers receive requirements in English and express them in a precise specification language based on logic. Example: Express in propositional logic: “The automated reply cannot be sent when the file system is full” Solution: One possible solution: Let p denote “Send the automated reply” and q denote “ The file system is full.” q→ ¬ p
Fractional Number • Polynomial, Binomial, Coefficient • Induction, Recursion, Recursive Function/Algorithm • Permutation, Combination
1
第1页/共60页
Translating English Sentences
第4页/共60页
Application: Program Correctness
• A proof that a program is completely correct requires two parts 1. Establish partial correctness by showing that the correct answer is obtained if the program terminates. The notation p{ S }q indicates that the program, or program segment, S, is correct with respect to the initial assertion p (precondition) and the final assertion q (postcondition). This means that whenever p is true for the input values of S and S terminates, then q is true for the output value of S. 2. Show that the program S always terminates
• Algorithm (Algorithmic Analysis, Algorithmic Thinking) • Universal, Existential Quantification, Rule of Inference • Probability, Statistics, Event, Independent, Dependent • Operation, Operator, Product, Sum, Division, Integer, Real Number,
• Steps to convert an English sentence to a statement in propositional logic • Identify propositions and using propositional variables • Determine appropriate logical operations
• “If I go to iShow (爱秀) or to CHIC (东京秀客 ), t hen I will no t go sho pping at Golden Ea gle .” • p: I go to iShow • q: I go to CHIC • r: I go shopping at GE
Solution: Let p be A is a knight, and q be B is a
kniቤተ መጻሕፍቲ ባይዱht
• If A is a knight, then p True. Since knights tell
the truth, then
If p or q then not r.
第2页/共60页
Example
• Problem: Translate the following sentenc e into propositiona l logic: “You can access the Internet from campus if you are a computer science major or you are not a freshman.”
第5页/共60页
Application: Logic Puzzles
• An island has two kinds of inhabitants, knights, who always tell the truth, and knaves, who always lie.
• You go to the island and meet A and B. a) A says “B is a knight.” b) B says “ The two of us are of opposite types.” Question: What are the types of A and B?
• Solution: Define a: You can access the internet from campus c: You are a computer science major f : You are a freshman .” (c ∨ ¬ f ) → a
第3页/共60页
Application: System Specifications
• System and Software engineers receive requirements in English and express them in a precise specification language based on logic. Example: Express in propositional logic: “The automated reply cannot be sent when the file system is full” Solution: One possible solution: Let p denote “Send the automated reply” and q denote “ The file system is full.” q→ ¬ p
Fractional Number • Polynomial, Binomial, Coefficient • Induction, Recursion, Recursive Function/Algorithm • Permutation, Combination
1
第1页/共60页
Translating English Sentences
第4页/共60页
Application: Program Correctness
• A proof that a program is completely correct requires two parts 1. Establish partial correctness by showing that the correct answer is obtained if the program terminates. The notation p{ S }q indicates that the program, or program segment, S, is correct with respect to the initial assertion p (precondition) and the final assertion q (postcondition). This means that whenever p is true for the input values of S and S terminates, then q is true for the output value of S. 2. Show that the program S always terminates