This file is indexed.

/usr/share/mozart/doc/fst/node3.html is in mozart-doc 1.4.0-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
2
3
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>3 Generating Hamming Codes</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node2.html#fset.examples.steiner">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node4.html#fset.examples.binpacking">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="fset.examples.hamming"><H1><A name="fset.examples.hamming">3 Generating Hamming Codes</A></H1><P class="margin">Problem Specification</P><P> Generate a Hamming code that fits in <IMG alt="b" src="latex40.png">-bit words to code <IMG alt="n" src="latex30.png"> symbols where the Hamming distance between every two symbol codes is at least <IMG alt="d" src="latex41.png">. The Hamming distance between to words is the number of bit positions where they differ. </P><P class="margin">Model</P><P> A <IMG alt="b" src="latex40.png">-bit word is modeled by a set <IMG alt=" s \subseteq \{1,\ldots,b\}" src="latex42.png"> where <IMG alt="e \in s" src="latex43.png"> means that the bit at position <IMG alt="e" src="latex44.png"> is set (resp. unset otherwise). The <EM>Hamming distance</EM> <IMG alt="h(a,b)" src="latex45.png"> between two words <IMG alt="a" src="latex46.png"> and <IMG alt="b" src="latex40.png"> represented as sets <IMG alt="s_a" src="latex47.png"> and <IMG alt="s_b" src="latex48.png"> can be computed by subtracting from the word size <IMG alt="b" src="latex40.png"> the number of elements that is contained (<IMG alt="\#(s_a \cap s_b)" src="latex49.png">) resp. is not contained (<IMG alt="\#(\{1,\ldots,b\}\backslash (s_a \cup s_b))" src="latex50.png">) in both sets. Thus, the Hamming distance results in </P><BLOCKQUOTE><P><IMG alt="h(a,b) = b - \#(s_a \cap s_b) - \#(\{1,\ldots,b\}\backslash (s_a \cup
s_b))." src="latex51.png"></P></BLOCKQUOTE><P> </P><P class="margin">Solver</P><P> The function <CODE>Hamming</CODE> returns a solver to generate a Hamming code for <CODE>NumSymbols</CODE> symbols in words with <CODE>Bits</CODE> bits and a Hamming distance of <CODE>Distance</CODE>. The procedure <CODE>MinDist</CODE> implements the constraint that the Hamming distance does not exceed the value of <CODE>Distance</CODE>. The list <CODE>Xs</CODE> holds the sets representing the single codes. The nested loop (<CODE>ForAllTail</CODE> and <CODE>ForAll</CODE>) imposes <CODE>MinDist</CODE> on all pairwise distinct elements of <CODE>Xs</CODE>. The distribution employs straightforwardly a naive strategy. </P><P></P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">declare</SPAN>&nbsp;<BR><SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">Hamming</SPAN>&nbsp;Bits&nbsp;Distance&nbsp;NumSymbols}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">MinDist</SPAN>&nbsp;X&nbsp;Y}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Common1s&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>intersect&nbsp;X&nbsp;Y}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Common0s&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>complIn<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>union&nbsp;X&nbsp;Y}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>value<SPAN class="keyword">.</SPAN>make&nbsp;[1<SPAN class="keyword">#</SPAN>Bits]}}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bits<SPAN class="keyword">-</SPAN>{FS<SPAN class="keyword">.</SPAN>card&nbsp;Common1s}<SPAN class="keyword">-</SPAN>{FS<SPAN class="keyword">.</SPAN>card&nbsp;Common0s}<SPAN class="keyword">&gt;=:</SPAN>Distance<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">in</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Xs}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Xs&nbsp;=&nbsp;{FS<SPAN class="keyword">.</SPAN>var<SPAN class="keyword">.</SPAN>list<SPAN class="keyword">.</SPAN>upperBound&nbsp;NumSymbols&nbsp;[1<SPAN class="keyword">#</SPAN>Bits]}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ForAllTail&nbsp;Xs&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;X<SPAN class="keyword">|</SPAN>Y}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ForAll&nbsp;Y&nbsp;<SPAN class="keyword">proc</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Z}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{MinDist&nbsp;X&nbsp;Z}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>distribute&nbsp;naive&nbsp;Xs}<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;<BR><SPAN class="keyword">end</SPAN>&nbsp;<BR></PRE></BLOCKQUOTE><P> </P><P> The following code generates a Hamming code for 16 symbols using 7 bit words and ensures a Hamming distance of 2. </P><BLOCKQUOTE class="code"><CODE>{Browse<BR>&nbsp;{Map&nbsp;{SearchOne&nbsp;{Hamming&nbsp;7&nbsp;2&nbsp;16}}<SPAN class="keyword">.</SPAN>1<BR>&nbsp;&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;X}&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ForThread&nbsp;7&nbsp;1&nbsp;<SPAN class="keyword">~</SPAN>1&nbsp;<SPAN class="keyword">fun</SPAN><SPAN class="variablename">&nbsp;</SPAN>{<SPAN class="functionname">$</SPAN>&nbsp;Is&nbsp;I}&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{FS<SPAN class="keyword">.</SPAN>reified<SPAN class="keyword">.</SPAN>isIn&nbsp;I&nbsp;X}<SPAN class="keyword">|</SPAN>Is&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>&nbsp;nil}&nbsp;&nbsp;<BR>&nbsp;&nbsp;<SPAN class="keyword">end</SPAN>}}</CODE></BLOCKQUOTE><P> Further, the code is nicely formatted displayed in the Oz Browser. </P><DIV align="center"><IMG alt="" src="hamming_browser.gif" id="hamming_browser.pic"></DIV><P> </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node2.html#fset.examples.steiner">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node4.html#fset.examples.binpacking">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~tmueller/">Tobias&nbsp;Müller</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>