Define a DFA that accepts all even length binary strings that don't contain the substring “111”?











up vote
1
down vote

favorite












I think I have worked out a DFA that doesn't accept the substring "111," but I don't know how to account for accepting even length strings. Here is what I have so far. Any help would be greatly appreciated! enter image description here



Hi, thanks so much to everyone who's commented. I've made some updates to my answer, and I think it works now, but I'm still not sure. Here's an updated photo below.
enter image description here










share|cite|improve this question









New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    I think you would have to keep track of parity. One set of states for an odd number of bits seen, another for an even number.
    – Tom Zych
    6 hours ago















up vote
1
down vote

favorite












I think I have worked out a DFA that doesn't accept the substring "111," but I don't know how to account for accepting even length strings. Here is what I have so far. Any help would be greatly appreciated! enter image description here



Hi, thanks so much to everyone who's commented. I've made some updates to my answer, and I think it works now, but I'm still not sure. Here's an updated photo below.
enter image description here










share|cite|improve this question









New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    I think you would have to keep track of parity. One set of states for an odd number of bits seen, another for an even number.
    – Tom Zych
    6 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I think I have worked out a DFA that doesn't accept the substring "111," but I don't know how to account for accepting even length strings. Here is what I have so far. Any help would be greatly appreciated! enter image description here



Hi, thanks so much to everyone who's commented. I've made some updates to my answer, and I think it works now, but I'm still not sure. Here's an updated photo below.
enter image description here










share|cite|improve this question









New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I think I have worked out a DFA that doesn't accept the substring "111," but I don't know how to account for accepting even length strings. Here is what I have so far. Any help would be greatly appreciated! enter image description here



Hi, thanks so much to everyone who's commented. I've made some updates to my answer, and I think it works now, but I'm still not sure. Here's an updated photo below.
enter image description here







finite-automata discrete-mathematics






share|cite|improve this question









New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|cite|improve this question









New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this question




share|cite|improve this question








edited 4 hours ago





















New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 7 hours ago









bmsh

92




92




New contributor




bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






bmsh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    I think you would have to keep track of parity. One set of states for an odd number of bits seen, another for an even number.
    – Tom Zych
    6 hours ago














  • 1




    I think you would have to keep track of parity. One set of states for an odd number of bits seen, another for an even number.
    – Tom Zych
    6 hours ago








1




1




I think you would have to keep track of parity. One set of states for an odd number of bits seen, another for an even number.
– Tom Zych
6 hours ago




I think you would have to keep track of parity. One set of states for an odd number of bits seen, another for an even number.
– Tom Zych
6 hours ago










1 Answer
1






active

oldest

votes

















up vote
2
down vote













Keep in mind that DFA has a "finite" memory, each state knows something about what you've read so far.
$A$ remembers that so far, you've read $w0$ for some $w in {0,1}^*$ or $epsilon$.
$B$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$.

and so on...



Now you can duplicate the states to have the following properties:
$A_{even}$ means that so far you've read $w0$ for some $w in {0,1}^*$ or $epsilon$, and you've read even number of letters.
$A_{odd}$ means that so far you've read $w0$ for some $w in {0,1}^*$, and you've read odd number of letters ($epsilon$ has even number of letters, so it's not included here).
$B_{even}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$, and you've read even number of letters.
$B_{odd}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$, and you've read odd number of letters.



And so on.

You need to re-define your transition function and and accept states to match with the definition of these new states



Edit: I misread the question as accepting '111' as a substring, so the definition of A,B that i showed are a bit off, but the answer to your question is similar in concept.






share|cite|improve this answer








New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • This is much, much better than your other answer. Thanks!
    – David Richerby
    5 hours ago











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "419"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






bmsh is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f101297%2fdefine-a-dfa-that-accepts-all-even-length-binary-strings-that-dont-contain-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote













Keep in mind that DFA has a "finite" memory, each state knows something about what you've read so far.
$A$ remembers that so far, you've read $w0$ for some $w in {0,1}^*$ or $epsilon$.
$B$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$.

and so on...



Now you can duplicate the states to have the following properties:
$A_{even}$ means that so far you've read $w0$ for some $w in {0,1}^*$ or $epsilon$, and you've read even number of letters.
$A_{odd}$ means that so far you've read $w0$ for some $w in {0,1}^*$, and you've read odd number of letters ($epsilon$ has even number of letters, so it's not included here).
$B_{even}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$, and you've read even number of letters.
$B_{odd}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$, and you've read odd number of letters.



And so on.

You need to re-define your transition function and and accept states to match with the definition of these new states



Edit: I misread the question as accepting '111' as a substring, so the definition of A,B that i showed are a bit off, but the answer to your question is similar in concept.






share|cite|improve this answer








New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • This is much, much better than your other answer. Thanks!
    – David Richerby
    5 hours ago















up vote
2
down vote













Keep in mind that DFA has a "finite" memory, each state knows something about what you've read so far.
$A$ remembers that so far, you've read $w0$ for some $w in {0,1}^*$ or $epsilon$.
$B$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$.

and so on...



Now you can duplicate the states to have the following properties:
$A_{even}$ means that so far you've read $w0$ for some $w in {0,1}^*$ or $epsilon$, and you've read even number of letters.
$A_{odd}$ means that so far you've read $w0$ for some $w in {0,1}^*$, and you've read odd number of letters ($epsilon$ has even number of letters, so it's not included here).
$B_{even}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$, and you've read even number of letters.
$B_{odd}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$, and you've read odd number of letters.



And so on.

You need to re-define your transition function and and accept states to match with the definition of these new states



Edit: I misread the question as accepting '111' as a substring, so the definition of A,B that i showed are a bit off, but the answer to your question is similar in concept.






share|cite|improve this answer








New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















  • This is much, much better than your other answer. Thanks!
    – David Richerby
    5 hours ago













up vote
2
down vote










up vote
2
down vote









Keep in mind that DFA has a "finite" memory, each state knows something about what you've read so far.
$A$ remembers that so far, you've read $w0$ for some $w in {0,1}^*$ or $epsilon$.
$B$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$.

and so on...



Now you can duplicate the states to have the following properties:
$A_{even}$ means that so far you've read $w0$ for some $w in {0,1}^*$ or $epsilon$, and you've read even number of letters.
$A_{odd}$ means that so far you've read $w0$ for some $w in {0,1}^*$, and you've read odd number of letters ($epsilon$ has even number of letters, so it's not included here).
$B_{even}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$, and you've read even number of letters.
$B_{odd}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$, and you've read odd number of letters.



And so on.

You need to re-define your transition function and and accept states to match with the definition of these new states



Edit: I misread the question as accepting '111' as a substring, so the definition of A,B that i showed are a bit off, but the answer to your question is similar in concept.






share|cite|improve this answer








New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









Keep in mind that DFA has a "finite" memory, each state knows something about what you've read so far.
$A$ remembers that so far, you've read $w0$ for some $w in {0,1}^*$ or $epsilon$.
$B$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$.

and so on...



Now you can duplicate the states to have the following properties:
$A_{even}$ means that so far you've read $w0$ for some $w in {0,1}^*$ or $epsilon$, and you've read even number of letters.
$A_{odd}$ means that so far you've read $w0$ for some $w in {0,1}^*$, and you've read odd number of letters ($epsilon$ has even number of letters, so it's not included here).
$B_{even}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$, and you've read even number of letters.
$B_{odd}$ remembers that so far, you've read $w01$ for some $w in {0,1}^*$ or $1$, and you've read odd number of letters.



And so on.

You need to re-define your transition function and and accept states to match with the definition of these new states



Edit: I misread the question as accepting '111' as a substring, so the definition of A,B that i showed are a bit off, but the answer to your question is similar in concept.







share|cite|improve this answer








New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this answer



share|cite|improve this answer






New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered 6 hours ago









shahaf finder

211




211




New contributor




shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






shahaf finder is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • This is much, much better than your other answer. Thanks!
    – David Richerby
    5 hours ago


















  • This is much, much better than your other answer. Thanks!
    – David Richerby
    5 hours ago
















This is much, much better than your other answer. Thanks!
– David Richerby
5 hours ago




This is much, much better than your other answer. Thanks!
– David Richerby
5 hours ago










bmsh is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















bmsh is a new contributor. Be nice, and check out our Code of Conduct.













bmsh is a new contributor. Be nice, and check out our Code of Conduct.












bmsh is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Computer Science Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f101297%2fdefine-a-dfa-that-accepts-all-even-length-binary-strings-that-dont-contain-the%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Morgemoulin

Scott Moir

Souastre