Some questions about closures, not language specific! >:|
I'm doing some homework, and having a hard time understanding closure开发者_运维问答s. This is in relation to boolean algebra mostly, not any specific programming language.
Here's an example: Are the following sets closed under the following operations? The language {a,b} under concatenation.
Now, from this: http://en.wikipedia.org/wiki/Closure_%28mathematics%29, it would seem that because the concatenation of the language {a,b} can produce results that are not members of the original set {a,b}, like ab, aa, bb, etc, the set is NOT closed under the concatenation operation.
Am I looking at this correctly? I feel its easy to misinterpret that definition. I feel like it might mean that if the operation produces results that CAN be created by the given language, then the set is closed under that operation.
Anyone want to take a stab at this and help me out? :)
Thanks!
In computational theory, you usually distinguish betweeen the set of symbols (characters, letters, etc.) and the set of words. It never really makes sense to discuss whether the set of characters is closed under an operation, instead you ask if some set of words is closed under an operation.
In the example you give, {a,b} is the symbol set; the set S of all words over that symbol set is closed under concatenation, since concatenating two words from S results in a word still in S.
精彩评论