Last Sunday, I published a new puzzle at http://cotpi.com/p/54/ that uses the Indian rupee symbol ₹. It appeared fine on Iceweasel 10 as well as Google Chrome 20 on Debian testing distribution (Wheezy). However, Firefox 12 as well as Google Chrome 19 failed to render the symbol on Windows 7 Enterprise Service Pack 1.

To resolve this, I downloaded an update for my version of Windows from KB2496898, installed it and rebooted the computer. KB2496898 lists the updates for other versions of Windows as well.

Last night, I came across a simple propositional logic problem concerned with the validity of the statement:

\[ \bigl((A \implies B) \land (B \implies C)\bigr) \iff (A \implies C). \]

At first, I thought it is valid. But on drawing the truth table, I was surprised to see that it isn't valid.

\(A\)\(B\)\(C\) \(A \implies B\)\(B \implies C\)\(A \implies C\) \((A \implies B) \land (B \implies C)\) \(\bigl((A \implies B) \land (B \implies C)\bigr)\) \(\iff\) \((A \implies C)\)
TTT TTT T T
TTF TFF F T
TFT FTT F F
TFF FTF F T
FTT TTT T T
FTF TFT F F
FFT TTT T T
FFF TTT T T

My intuition had failed. The truth table shows that there are two cases in which the statement is false.

Case 1: \((A \implies C) \land (B \implies C) \land \lnot(A \implies B)\)

In this case, \(A\) implies \(C\) and \(B\) implies \(C\), but \(A\) does not imply \(B\). This corresponds to the third row in the truth table. It makes sense. Two things can imply a third thing but they need not imply each other. For example, rain may imply wet soil and snow may imply wet soil as well, but rain need not imply snow. Here is another example that demonstrates this.

The following two statements are true for any integer \(x\).

\[ 4 \mid x \implies 2 \mid x. \\ 6 \mid x \implies 2 \mid x. \]

But the following statement is false when \(x \equiv 4 \pmod{12}\) or \(x \equiv 8 \pmod{12}\).

\[ 4 \mid x \implies 6 \mid x. \]

In other words, if an integer is a multiple of \(4\) as well as a multiple of \(6\), then it is also a multiple of \(2\). But this is not equivalent to claiming that if an integer is a multiple of \(4\), then it is also a multiple of \(6\). Such a claim is not correct as we can confirm for \(x \in \{4, 8, 16, 20, 28, 32, \dots\}\).

Case 2: \((A \implies B) \land (A \implies C) \land \lnot(B \implies C)\)

In this case, \(A\) implies \(B\) as well as \(C\) but \(B\) does not imply \(C\). This corresponds to the sixth row in the truth table. It makes sense as well. One thing can imply two other things but those two things need not imply each other. For example, rain may imply wet soil and flooded rivers but wet soil need not imply flooded rivers. The soil could be wet due to irrigation sprinklers. Once again, here is a mathematical example to demonstrate this.

The following two statements are true for any integer x.

\[ 6 \mid x \implies 2 \mid x. \\ 6 \mid x \implies 3 \mid x. \]

But the following statement is false when \(x\) is an odd multiple of \(3\).

\[ 2 \mid x \implies 3 \mid x. \]

In other words, if an integer is a multiple of 6, then it is a multiple of 2 as well as 3. But this is not equivalent to claiming that if an integer is a multiple of 2, then it is also a multiple of 3. Such a claim is clearly false as we can confirm for \(x \in \{3, 9, 15, 21, \dots\}\).

Encoding intuition correctly

My intuition incorrectly concluded that the \(\bigl((A \implies B) \land (B \implies C)\bigr) \iff (A \implies C)\) is valid because I was not translating the given statement correctly in my mind. I was thinking that if \(A\) implies \(B\) and \(B\) implies \(C\), of course \(A\) must also imply \(C\). This is true but this is not what the given statement represents. The given statement means something more than this. In addition to what I thought, it also means that if \(A\) does not imply \(B\) or \(B\) does not imply \(C\), then \(A\) does not imply \(C\) as well. This however doesn't happen. The truth table shows that even though \(A\) does not imply \(B\) or \(B\) does not imply \(C\), it is possible that \(A\) implies \(C\).

As far as my intuition is concerned, the following would be the right way to represent what I was thinking.

\[ \bigl((A \implies B) \land (B \implies C)\bigr) \implies (A \implies C). \]

Indeed, this statement is valid as can be seen from the truth table below.

\(A\)\(B\)\(C\) \(A \implies B\)\(B \implies C\)\(A \implies C\) \((A \implies B) \land (B \implies C)\) \(\bigl((A \implies B) \land (B \implies C)\bigr)\) \(\implies\) \((A \implies C)\)
TTT TTT T T
TTF TFF F T
TFT FTT F T
TFF FTF F T
FTT TTT T T
FTF TFT F T
FFT TTT T T
FFF TTT T T

When the HTML pre element uses the CSS width and word-wrap: break-word properties, the long lines of code wrap in Chrome and IE6 but not in Firefox.

Here is a sample page that demonstrates this: http://susam.in/files/notes/css-hacks/pre-word-wrap/pre-word-wrap.html. The CSS code for the HTML pre element is as follows.

pre {
    border: 1px solid black;
    background: #ebebeb;
    width: 20em;
    overflow: auto;
    color: blue;
}
pre.wrap {
    word-wrap: break-word;
}

The first box in each output below use the wrap class. The second ones in each is a plain pre element.

Screenshot of output in Firefox 3.6
Output in Firefox 3.6
Screenshot of output in Chrome 11
Output in Chrome 11
Screenshot of output in Internet Explorer 6
Output in Internet Explorer 6

When the HTML pre element uses the CSS width and overflow: auto properties, code that doesn't fit within the width of the pre element is clipped and a scroll-bar appears which can be used to view the remaining code.

However, when it contains only one line of code, we see a couple of issues in Firefox 3.6 and IE6. Here is a sample page that demonstrates the issue: http://susam.in/files/notes/css-hacks/pre-overflow/pre-overflow.html. Here is the CSS used for the HTML pre element.

pre {
    border: 1px solid black;
    background: #ddccff;
    width: 20em;
    overflow: auto;
}

Firefox 3.6 doesn't display the scroll-bar if the pre element contains only one line of code. It is still possible to scroll the code though by using the arrow-keys on the keyboard or selecting text in the code with the mouse and moving right.

Screenshot of the output in Firefox 3.6
Output in Firefox 3.6

Chrome does the right thing and displays the scroll-bar.

Screenshot of the output in Chrome 11
Output in Chrome 11

Internet Explorer 6 always hides the last line of the code behind the scroll-bar. Therefore, when there is only one line of code, the scroll-bar hides this only line of code and no code is visible.

Screenshot of the output it in Internet Explorer 6
Output in Internet Explorer 6

If there are two HTML div elements placed side-by-side using float: left and float: right, a long word in one of the div elements breaks the floating property of the other in Internet Explorer 6 as well as Internet Explorer 8.

Here is a sample page that demonstrates this issue: http://susam.in/files/notes/css-hacks/long-word-and-sidebar/long-word-and-sidebar.html. Here is the CSS used for both the HTML div elements.

#id1 {
    float: left;
    width: 65%;
    border: 1px solid #000080;
    background: #ffcc00;
    padding: 2px;
}
#id2 {
    float: right;
    width: 30%;
    border: 1px solid #008000;
    background: #ccccff;
    padding: 2px;
}

In each output shown below, the box on the left has its ID as id1 and the one on the right has its ID as id2. The box on the left has a long word.

Screenshot of the output in Firefox 3.6
Output in Firefox 3.6

The sidebar with its ID as id2 is intact in Firefox even though the long word has spilled outside the box on the left. However, the layout breaks in Internet Explorer 8 as can be seen below.

Screenshot of the output in Internet Explorer 8
Output in Internet Explorer 8

The fix involves allowing long words to break and wrap.

#id1 {
    float: left;
    width: 65%;
    border: 1px solid #000080;
    background: #ffcc00;
    padding: 2px;
    word-wrap: break-word;
}

Here is a page that demonstrates the fix: http://susam.in/files/notes/css-hacks/long-word-and-sidebar/long-word-and-sidebar-fixed.html.

Screenshot of the output in Firefox 3.6
Output in Firefox 3.6
Screenshot of the output in Internet Explorer 8
Output in Internet Explorer 8
Newer | Older
RSS