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












1












$begingroup$


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










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    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.
    $endgroup$
    – Tom Zych
    Dec 9 '18 at 19:11
















1












$begingroup$


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










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    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.
    $endgroup$
    – Tom Zych
    Dec 9 '18 at 19:11














1












1








1





$begingroup$


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










share|cite|improve this question











$endgroup$




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







finite-automata discrete-mathematics






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 10 '18 at 4:00







bmsh

















asked Dec 9 '18 at 18:16









bmshbmsh

92




92








  • 1




    $begingroup$
    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.
    $endgroup$
    – Tom Zych
    Dec 9 '18 at 19:11














  • 1




    $begingroup$
    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.
    $endgroup$
    – Tom Zych
    Dec 9 '18 at 19:11








1




1




$begingroup$
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.
$endgroup$
– Tom Zych
Dec 9 '18 at 19:11




$begingroup$
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.
$endgroup$
– Tom Zych
Dec 9 '18 at 19:11










1 Answer
1






active

oldest

votes


















2












$begingroup$

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









$endgroup$













  • $begingroup$
    This is much, much better than your other answer. Thanks!
    $endgroup$
    – David Richerby
    Dec 9 '18 at 20:08











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',
autoActivateHeartbeat: false,
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
});


}
});














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









2












$begingroup$

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









$endgroup$













  • $begingroup$
    This is much, much better than your other answer. Thanks!
    $endgroup$
    – David Richerby
    Dec 9 '18 at 20:08
















2












$begingroup$

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









$endgroup$













  • $begingroup$
    This is much, much better than your other answer. Thanks!
    $endgroup$
    – David Richerby
    Dec 9 '18 at 20:08














2












2








2





$begingroup$

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









$endgroup$



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












share|cite|improve this answer



share|cite|improve this answer










answered Dec 9 '18 at 19:24









shahaf findershahaf finder

312




312












  • $begingroup$
    This is much, much better than your other answer. Thanks!
    $endgroup$
    – David Richerby
    Dec 9 '18 at 20:08


















  • $begingroup$
    This is much, much better than your other answer. Thanks!
    $endgroup$
    – David Richerby
    Dec 9 '18 at 20:08
















$begingroup$
This is much, much better than your other answer. Thanks!
$endgroup$
– David Richerby
Dec 9 '18 at 20:08




$begingroup$
This is much, much better than your other answer. Thanks!
$endgroup$
– David Richerby
Dec 9 '18 at 20:08


















draft saved

draft discarded




















































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.




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

Berounka

Sphinx de Gizeh

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...