It has been said that the smallest piece of code in the world is the C code shown below for copying strings.
while (*d++ = *s++);
That is just a whopping 17 characters long! Really?
I’ll do that in Scheme/Lisp:
(set! d s)
There 9 characters long.
By I.H. we mean by induction hypothesis.
First year in maths students are baffled about mathematical induction(M.I.). It is counter intuitive and it is true, it is hard to wrap one’s head around this concept. So to prove some mathematical property holds we are given the following template:
- First show that the property ( the property of being divisible, being prime or equal to a formula’s value, you name it etc.) is true for the base case. If the base case is then we prove that the property is true for it. Thus we work on showing is true.
- Second, we assume it is true for , that is is true – we take this as fact. This second step is called the induction hypothesis – I.H.
- Lastly, we prove that is true as well using I.H. Thus should we succeed in this final step, we have all the right to claim that we have proof that is true for all .
It is I.H. that is hard to take. Why is it that a.) we should assume it and b.) why is it that if step 3 succeeds provided we use the fact of step 2, we have the right to say – Q.E.D. or say “proven as required”! What right do we have in assuming I.H.
There are a few comments that we can make about this:
- Firstly, M.I. is about the property of numbers (in general). Numbers obey this I. H. property. As a classic example consider a number such that , for some number like 8. So if we have , can we say that the next number after will also be greater than 8? We can guess that this should be true. So let us prove it…Consider , let us add to both sides still maintaining the inequality. .
- Secondly, we are allowed to assume I.H. for after all we can set our , i.e., to our base case and check if the property holds — thus by the same token we are allowed to move from the truth of to the truth that . So we can assume I.H. because of this “domino effect”. The crucial bit is to show now that due to our utilisation of I.H. for an arbitrary , we get the truth of .
- Lastly and strongly, we can take M.I. to be an axiom! Meaning, a proposition which is self-evidently (if I can use that word) true! Indeed Wikipaedia has it like this – .
- Take a good look at this and consider the statement before the last . If you look we have this form . Remember modus ponens? It says if we have and we have , deduce .
Well when we are doing M.I. what we are actually doing is that we are establishing the truth of and when we succeed – voila, use this with the axiom and so conclude the property holds for all .
Dr. Benjamin Levitt alerted me to the article I first heard from a colleague at the university where I work. Apparently a group of neuroscientists examined the brains of 15 mathematicians using Magnetic Resonance Imaging (MRI). They showed these scientists pictures of mathematical formulas and the activity of the brains of these subjects reacted in the same way one’s brain reacts when it experiences viewing a beautiful piece of art or listening to beautiful piece of music.
Read the University College London article here.
Thinking of this now, it is this beauty that attracted me to studying mathematics, aside from of course, being inspired by great teachers who taught me and exposed me to its beauty. Though my father was an engineer (an my uncle a PE and has a PhD in hydrology), I do not think it was the one which moved me to be a student of maths. I think I was more influenced by enthusiastic teachers who were passionate with the subject – I mean, these teachers loved the subject and their tamed enthusiasm nevertheless showed when they wrote proofs on the blackboard.
I like to study maths because of its beauty yet I am so poor at it.
I am so addicted to this TV series, I hope it stays for a long long time. It is beautifully done and the interaction of complex character personalities is often heartwarming and fun. Whenever I watch an episode, I cannot help but get reminded of what C. S. Peirce said…
From P.J. Davis & R. Hersh, The Mathematical Experience, 1981, Penguin Books
C. S. Pierce in the middle of the nineteenth century, announced that “mathematics is the science of making necessary conclusions.” Conclusions about what? About quantity? About space?The content of mathematics is not defined by this definition; mathematics could be “about” anything as long as it is a subject that exhibits the pattern of assumption-deduction- conclusion. Sherlock Holmes remarks to Watson in The Sign of Four that “Detection is, or ought to be, an exact science and should be treated in the same cold and unemotional manner. You have attempted to tinge it with romanticism, which produces much the same effect as if you worked a love-story or an elopement into the fifth proposition of Euclid.” Here Conan Doyle, with tongue in cheek, is asserting that criminal detection might very well be considered a branch of mathematics. Peirce would agree.
Kurt Gödel is considered the greatest logician since Aristotle. Prior to his death, Gödel wrote a proof for the existence of God. Some theorise that the reason he did not publish nor share this proof earlier was for fear of being ostracised by the academic community where he belonged. He was afraid it wouldn’t be cool.
Using a MacBook and proof assistants (Coq and Isabelle), Christoph Benzmüller of Free University of Berlin and Bruno Woltzenlogel Paleo of Free University of Vienna, confirmed that Gödel’s proof was correct, at least as far as higher order model logic is concerned. We might note that KG’s proof indeed, involved modal operators. It only took a few minutes (even seconds) for the computer to validate that the steps KG made in his proof were valid and correct.
This is an ode (although it is not a poem) to the Myhill-Nerode Theorem, thank God for it.
I saw a question that required one to show that the language of strings of EVEN length is regular. Formally, it means to show that
The way people have approached this is to specify an alphabet like and then construct a NFA or a DFA (finite automaton) that recognises only a even strings from these alphabets. A sample is found below
Hmmm, I am uncomfortable with this. Why? We have not been given any alphabet information on the problem. Why use or limit it to ? What if the alphabet is composed of , are we not capable of producing strings of even length from this alphabet? Sure we can but what happens to our DFA proof? It will fall short. I feel it is not a good approach, and I do not think it is rigorous, even though the proof is concisely crisp. The proof should handle the generic case with no appeal as to how the alphabet looks like. I believe that is the best approach. We can of course handle the general case by stating a general assumption on and say . Then we replace the 0/1 notation in the diagram with ., then we are done. That covers every possibility and will only accept a string of even length.
Anyway back to the problem what if we have not been given the composition of ?
The Myhill-Nerode Theorem ( briefly treated here) if we know it is there to rescue you. Briefly it effectively states that the following statements are equivalent:
- is regular
- The relation , such that iff exactly when , is finite.
We prove now that is regular:
Form the membership iff the right side is satisfied. Hence, then we have two cases for .
1. may be of even length . Then , because is even because an even number () + even number() results an even number, thus . Similarly for , the same argument applies.
2. may be of odd length . Then , because is odd because an even number () + odd number() results an odd number, thus . Similarly for , the same argument applies.
3. There is only one equivalence class we can make of , so finite.
We have shown that the second part of the above theorem is satisfied by our language, and since by the theorem, this is equivalent to the first part, we then conclude that is regular.
This is for young people doing CS and are wondering how to use the Pumping Lemma to verify if a formal language is regular or not :-). So let us have a theorem about the balanced parenthesis language :
is not a regular language.
Some text books use to denote the empty string so here is none empty. The method of proof is by contraction (Reduction ad Absurdium – RAA). So we assume the language is regular and hence can be pumped but show it to be otherwise, or not true by arriving at a contradiction. By the Pumping Lemma (PLem), so that can be used to split into parts. We actually use this to form . We can do this because the Lemma says this is valid for any .
Assume to be regular. Then by PLem, there exists an such that for , . Consider now the formed by setting . Then we have . Further we know that satisfying PLem premise, so it can be applied. As per PLem, we can break into components. As per PLem also . Looking at the form of our this implies that must be composed of all left parenthesis, i.e , then for some . As per PLem, we can pump for any . So let then the new . But this implies that , i.e. parentheses are not balanced. But this means . Contradiction. At this point we have found a where the decomposition results in the string outside of and we can stop.
Anyway consider now also pumped upwards to . Then we have the new . Looking at the left of we have . Again the parentheses do not balance out. Thus . Contradiction.
Feedback is appreciated – let me know if it has helped/not helped. Thanks.