首页 > 其他分享 >CSE 105 Summer Session

CSE 105 Summer Session

时间:2024-07-08 19:32:00浏览次数:17  
标签:Summer set CSE Session closed under multiplication DFA your

CSE 105 Summer Session 1 2024

Homework 1

Due date: Sunday July 7 at 11:59pm

Instructions

One member of the group should upload your group submission to Gradescope. During the submission process, they will be prompted to add the names of the rest of the group members. All group members’ names and PIDs should be on each page of the submission.

Your homework must be typed. We recommend that you submit early drafts to Gradescope so that in case of any technical difficulties, at least some of your work is present.  You may update your submission as many times as you’d like up to the deadline.

Your assignments in this class will be evaluated not only on the correctness of your answers, but on your ability to present your ideas clearly and logically. You should always explain how you arrived at your conclusions, using mathematically sound reasoning.  Whether you use formal proof techniques or write a more informal argument for why something is true, your answers should always be well-supported.  Your goal should be to convince the reader that your results and methods are sound.

Reading Sipser Chapter 0, 1

Key Concepts Sets, integers, sequences, functions, relations, predicates, graphs,  trees, strings, boolean logic, proof by construction, proof by contradiction, proof by induction. DFAs, regular expressions.

Question 1. (15 points) Let A = {aa, bb, ab, ε}, B  = {a, b}, C = {ab,abab, ababab}.  For each set, write out each of its elements.

a. (A ∪ B ∪ C)

b. (A ∩ C) × (B ∪ C)

c. A O C (set concatenation)

d. P(C) (the power set of C)

e. A × C

f. C*  (this is an infinite set so you only have to write the first 6 elements in standard string order.)

g. A*  (this is an infinite set so you only have to write the first 6 elements in standard string order.)

Question 2. (20 points) CSE 105 is a fairly proof heavy class. The goal of this problem is to help refresh your memory on diferent proof techniques: proof by induction, closure proofs and set equality proofs.

For each part of this question, complete the proofs by filling in the blanks.

Note: there may be alternate correct proofs to each of these claims. The point of this question is to practice  certain proof strategies.

a. DenitionConsider the recursively defined set S defined recursively as follows:

(1) a ∈ S

(2) For any string x ∈ S, then x O x ∈ S.

Claim: For each n ≥ 0, there exists a string w in S such that |w| = 2n. Prove this claim.

b. Prove that if A ≤ R is closed under multiplication and B ≤ R is closed under multiplication then

A ∩ B is closed under multiplication and A ∪ B is not necessarily closed under multiplication.

[Note: “A is closed under multiplication” means that for all x and y in A, xy is also in A.] A ∩ B is closed under multiplication.

Let x,y be elements of A ∩ B. (Show that xy ∈ A ∩ B.)

A ∪ B not necessarily closed under multiplication.

Find a counterexample of a pair of subsets of the real numbers, A  and B  each closed under multiplication but their union is not closed under multiplication.

c. Consider the sets:

A = {w ∈ {0, 1}* |  10 is a substring of w}

B = {0n 1m |n, m ≥ 0}

 

Fill in the blanks to show that A = B.

In order to prove set equality, we must prove A ≤ B and B ≤ A.

 A ≤ B.

Suppose that w  ∈                                .  Then w  does not have any 2-element sub- strings of the form 10.  This means that there can never be a

before a                            in w.  So all 0’s must come before all 1’s and so w has the form                            and w ∈ B.

– B ≤ A.

Suppose that w  ∈                                .   Then w  must have the form 0n 1m .  The only possible 2-element substrings of w are:                         I, l                                                                             ,

.  Therefore                            is not a substring of w  and so

w ∈ A.

Question (15 points) Draw the DFA that is described by the formal definition: ({q0, q1, q2, q3}, {0, 1}, δ, q0, {q2})

with δ given by the table

State

Character

State

q0

0

q1

q0

1

q3

q1

0

q0

q1

1

q2

q2

0

q1

q2

1

q4

q3

0

q3

q3

1

q3

q4

0

q4

q4

1

q4

1. Draw the state diagram of your DFA in JFLAP or flap.js, export the image as a png or jpg file, and include it as part of your submission. (no justification necessary.)

2. Describe the language recognized by this DFA. (you can describe it in words or by using a regular expression (or both.))

3. Is it possible to construct a DFA that recognizes this language with fewer states? If not, explain why not. If so, then draw it using JFLAP or flap.js.

Question 4

(10 points) Consider the DFA, M, whose state diagram is given by:

 

1. Describe the language L(M).

2. If w ∈ L(M), will the string obtained by flipping bits in w  (changing 0 to 1 and 1 to 0) also be in L(M)? Explain your answer.

3. If w ∈ L(M), will the string wR  (the reverse of w) also be in L(M)? Explain your answer

4. Describe in your own words the “role” of each of the states.

5. Write a regular expression that describes L(M). (please explain your reasoning.)

Question 5

(12 points )

For the DFA design problems, draw the state diagram in JFLAP or or flapjs.web.app, save the drawing as a png or jpg file and include it as part of your submission.

(no justification necessary.)

1. Design a DFA that recognizes the language:  {w ∈ {0; 1}*  |   the sum of all bits of w is even.} (e.g., the sum of the bits of 011100 is 3 since there are three ones. the sum of the bits of 0101011 is 4 since there are four ones.)

(Note: this set includes the empty string.)

2. Design a DFA that recognizes the language: {w ∈ {0; 1}*   |  the alternating sum of bits of w is a multiple of 4.}

(e.g. the alternating sum of 111101 is 1-1+1-1+0-1= -1. The alternating sum of 00101 is 0-0+1-0+1 = 2.)

(Note: this set includes the empty string.)

3. Design a DFA that recognizes the language:

{w ∈ {0; 1}*    |   w has at least length 4 and its third and fourth bits are both 0.}

 

标签:Summer,set,CSE,Session,closed,under,multiplication,DFA,your
From: https://www.cnblogs.com/qq-99515681/p/18290588

相关文章

  • Elasticsearch:Node.js ECS 日志记录 - Pino
    在我的上一篇文章“Beats:使用Filebeat从Python应用程序中提取日志”里,我详述了如何使用Python来生成日志,并使用Filebeat来收集日志到Elasticsearch中。在今天的文章中,我来详细描述如何使用Node.js来生成ECS相兼容的日子。ECS相兼容的日志符合易于Elasticsear......
  • SMU Summer 2024 Contest Round 1(7.8)
    A_DiceandCoin题目链接:abc126_c思路:分别求所有掷到的筛子数时赢得可能,进行求和voidsolve(){intn,k;cin>>n>>k;doubleans=0;for(inti=1;i<=n;++i){doublenow=1.0/n;if(i>=k)ans+=now;else{......
  • SMU Summer 2024 Contest Round 1
    SMUSummer2024ContestRound1DiceandCoin题意给个n面骰子和一枚硬币,初始投骰子,若骰子的值在1到\(K-1\)之间则反复投硬币,硬币为正则该值翻倍,否则为0,当值为0输掉游戏或者大于等于\(K\)时赢得游戏结束,问你可以赢得游戏的概率为多少。思路以1到n为初始值......
  • es:curl访问es时返回为空(elasticsearch 8.14.2)
    一,返回为空:[lhdop@blog~]$curllocalhost:9200/_cluster/health?prettycurl:(52)Emptyreplyfromserver[lhdop@blog~]$curllocalhost:9200curl:(52)Emptyreplyfromserver[lhdop@blog~]$curlhttp://localhost:9200curl:(52)Emptyreplyfromserver查看......
  • 10、flask-会话-session
    session会话是一种服务器端的会话技术、依赖于cookie特点:-服务端的会话技术-所有数据存储在服务器中-默认存储在内存中-存储结构也是key-value形式的键值对-session是离不开cookie的Flask中的session是全局对象常用操作:-设置seesion:-seesion['key']=val......
  • springboot整合ElasticSearch
    RestClient依赖,此为java的客户端,从来交互elasticsearch<dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId></dependency>因为SpringBoot默认的ES版本是7.17.10,所以我们需要......
  • 在注册表路径 HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager
    在注册表路径HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\SessionManager\MemoryManagement下的LargeSystemCache键控制着操作系统如何管理系统缓存和内存分配,不同的数值对应不同的行为和设置。LargeSystemCache参数详解0(默认值):效果:系统将系统缓存减少到最......
  • 在注册表路径 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Man
    在注册表路径HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\MemoryManagement下的DisablePagingExecutive键控制着操作系统内核数据是否允许分页到页面文件中。这个设置对系统性能和稳定性有重要影响,特别是在高负载和内存紧张的情况下。DisablePagi......
  • 百日筑基第十二天-入门Elasticsearch
    百日筑基第十二天-入门ElasticsearchElasticsearch是什么Elasticsearch是一个分布式、RESTful风格的搜索和数据分析引擎。安装Elasticsearch下载:https://www.elastic.co/cn/downloads/elasticsearchElasticsearch是免安装的,只需要把zip包解压就可以了。1)bi......
  • CSE 13S Calculator
    Assignment 4CalculatorCSE 13S, Winter 20241   IntroductionIt is common knowledge that computer scientists have very few hobbies.  One of the hobbies that almostevery computer science major has is making worse versions of......