<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m10395">
  
  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Introduction to Proofs</name>

  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2.6</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2001/11/13</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2002/07/22</md:revised>
  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
      <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="ian">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Ian</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Barland</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">ian@cs.rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="ian">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Ian</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Barland</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">ian@cs.rice.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="peggy">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Peggy</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Fidelman</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">peggy@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">introduction</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">proof</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">waterworld</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">waterworld rules</md:keyword>
  </md:keywordlist>

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Logic provides a way to talk about
truth and correctness in a rigourous way,
so that we can prove things, rather than
make intelligent guesses and just hope they are correct.</md:abstract>
</metadata>
  
  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
          <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="warning">The information in this module is
      outdated. Please see <link xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" src="http://cnx.rice.edu/content/col10154/latest/">my
      course</link> for a table of contents.</note>
    <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section14">  
      <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">What good are proofs?</name>
      
      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section11">
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Examples of proofs</name>
	
	<section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section8">
	  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">WaterWorld</name>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para23">
	    Consider a game called WaterWorld, with the following rules:
	    
	    <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="list6">
	      <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
		You are an explorer in a sea full of pirates.
	      </item>
	      <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
		Whenever you enter a location,
		you need to declare wehther or not there is a pirate there;
		<note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">If you enter pirate turf without gold,
		  you'll be killed, and conversely
		  if you enter an empty location laden with gold, you'll sink.</note>
		a single mistake will do you in.
	      </item>
	      <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
		When you successfully enter an empty location,
		you can determine how many (of the up to three) neighboring contain pirates,
		though not necessarily which ones.
	      </item>
	      <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
		When you successfully enter a pirate location, you get no information,
		but are allowed to live.
	      </item>
	    </list>
	   
	    We wish to know whenever we have a <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">guaranteed</emphasis> safe move.
	  </para>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para24">
	    For instance, in this board,
	    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="todo">add picture of a sample board</note>
	    are there any safe moves?
	    What is your reasoning, that they are safe?
	    How about in this next example?
	  </para>
	</section>
	
	
	<section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section9">
	  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Type Checking</name> 
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para25">
	    When writing a program, we'd like to know be sure that
	    functions are being
	    called with (at least) the correct <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">type</emphasis> of inputs
	    (e.g. the function <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">+</code> should be
	    called with numbers (not booleans),
	    and a function which a programmer has declared
	    to return an integer really should always return an integer).
	    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">Of course we'd really like to know whether
	      the program has any bugs at all;
	      type errors are only one sort of possible programming error.
	    </note>
	    And we'd like to be sure of this <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">before</emphasis> running the program.
	    Consider:
	  </para>
	  
	  <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block">
	    int SEEMS_LIKE_FOREVER = 24;  // Time enough to procrastinate.
	    
	    // goSeeMovie?:
	    // When invited to see a movie, do you accept?
	    // Depends on how many hours until homework is due,
	    // and on how much time is needed to do the homework.
	    //
	    bool goSeeMovie?( int hrsTilHwDue, int timeNeeded ) {
	    if (hrsTilHwDue &gt;= SEEMS_LIKE_FOREVER)
	    true;
	    else
	    (hrsTilHwDue &gt;=timeNeeded);
	    }
	    
	    // Example: 
	    //   goSeeMovie?(  8,  8 ) = false
	    //   goSeeMovie?( 48, 48 ) = true
	  </code>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para26">
	    One reason programmers are required to declare the intended
	    type of each variable, 
	    is so that the computer (the compiler) can <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">prove</emphasis> that 
	    certain errors won't occur.
	    How can you prove, in the above,
	    that <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">goSeeMove?</code> really always returns
	    a boolean
	    value as promised?  (At least, presuming that it is called
	    with integers, as indicated.  Likewise, you might want
	    to later prove that whenever it is called, 
	    the provided integers are indeed provided.)
	    (That is, what work does the compiler's type-checker do?)
	  </para>
	  
	  <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block">
	    int SEEMS_LIKE_FOREVER = <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">0</emphasis>;
	    
	    bool goGetRootCanal?( int hrsTilHwDue, int timeNeeded ) {
	    if (hrsTilHwDue &gt;= SEEMS_LIKE_FOREVER)
	    true;<emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	      else if (hrsTilHwDue &gt; SEEMS_LIKE_FOREVER)
	      timeNeeded;</emphasis>
	    else
	    false;
	    }
	  </code>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para27">
	    Note that most compilers will not accept 
	    this second example as valid code, 
	    even though is is possible to prove it's safe
	    (if you know some math axioms about how <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">&gt;=</code>
	    and <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">&gt;</code> work).
	    (It certainly deserves to be caught by the compiler as poor code,
	    just not as code that will generate an error.)
	    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">
	      In general, compilers tend to focus on simple type-checking
	      and very limited checking for other bugs;
	      we'll see in the future there is
	      some reason for 
	      this.</note>
	    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="todo">add link to halting prob,
	      and mention completeness some type systems, in previous aside</note>
	  </para>
	</section>
	
	
	<section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section10">
	  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Circuit Verification</name>

	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para28">
	    Given a circuit's blueprints, will it work as advertised?
	    In 19__, Intel had to recall
	    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="todo">get numbers, ian</note>
	    ... of its Pentium processors,
	    due to a mistake in the circuit:
	    it didn't always add numbers correctly, for all inputs.
	    This cost ...s of dollars, lots of bad publicity,
	    and it happened <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">after</emphasis> intensive testing.
	    Could it have been possible to have a program try to
	    prove the chip's correctness 
	    or uncover any errors?
	  </para>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para29">
	    Software and hardware companies are increasingly turning
	    to the use of automated proofs (rather than semi-haphazard testing)
	    to verify (parts of) large products correct.
	    It is a difficult task, which is also an active area of research.
	  </para>
	</section>
	
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para31">
	  Having proofs of correctness is not just comforting;
	  it allows us to save effort (less time testing,
	  and also able to make better optimizations),
	  and prevent recall of faulty products.
	  But: who decides a proof is correct  --
	  the employee with best SAT scores?!?
	  Is there some trusted way to verify proofs,
	  besides careful inspection by a skilled
	  (yet still error-prone) professional?
	</para>
      </section> 
      
      <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para32">
	How can we tell true proofs from false ones?
	What are the rules of a proof?
	(Clearly, this is relevant to writing programs -- at least, bug-free programs.)
	These are the questions which will occupy us.
      </para>

      
      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section12"> 
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">"Yeah, well prove it!"</name>
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para33">
	  Compare the following proofs:
	</para>
	
	<example xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="example2">
	  <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="proof2">
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step7"> All people are mortal.
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step8"> Socrates is a person.
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step9"> Therefore, Socrates is mortal.
	    </item>
	  </list>
	</example>
	
	<example xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="example4">
	  <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="proof4">
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step13"> All [substitution ciphers] are [vulnerable to brute-force attacks].
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step14"> The [Julius Caeser cipher] is a [substitution cipher].
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step15"> Therefore, the [Julius Caeser cipher] is [vulnerable to brute-force attacks].
	    </item>
	  </list>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para34">
	    Note that you don't need to know anything about cryptography
	    to know that the conclusion follows from the two premises.
	    (Are the premises indeed true?  That's a different question.)
	  </para>
	</example>
	
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para35">
	  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="todo">Use a lewis carroll example?</note>
	</para>

	<example xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="example5">
	  <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="proof5">
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step16"> All griznoxes chorble happily.
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step17"> A floober is a type of griznox.
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step18"> Therefore, floobers chorble happily.
	    </item>
	  </list>
	  
	  <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para36">
	    You don't need to be a world-class floober expert
	    to evaluate this argument, either.
	  </para>
	</example>
	
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para37">
	  As you've noticed,
	  the <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">form</emphasis> of the argument
	  is the same in all these.
	  If you are assured that the first two premises are true,
	  then w/o any true understanding,
	  you (or a computer) can automatically come up with the conclusion.
	  This classical form happens to be called a "syllogism"
	  (though the name isn't important).
	  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">
	    Even less important is knowing that some people have given
	    names to each of the three steps: 
	    The major premise,
	    the minor premise,
	    and the conclusion.
	  </note>
	  The point is that a
	  syllogism is one example of a 
	  
	  <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">rule of inference</emphasis>
	  -- that is,
	  a rule that a computer can use to deduce 
	  new facts 
	  from known ones.
	  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="todo">make "rule-of-inference" into define tag?</note>
	</para>
	
	
	<exercise xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="exercise4">
	  <problem xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para38">
	      Mistakes in syllogisms are hard to make:
	      what are the only 
	      two ways to have an error in a syllogism?
	    </para>
	  </problem>
	  <solution xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	    <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="list8">
	      <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="item15">
		
		The argument isn't actually in syllogism form.
		<list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="proof7">
		  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step22"> All people don't know my file's password.
		    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">Equivalent to "Nobody knows my file's password".
		      Why did we phrase this sentence awkwardly?
		      Because a syllogism requires the first premise to be of the form 
		      "All <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">something</emphasis>s have <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">some property</emphasis>".</note>
		  </item>
		  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step23">       Any hacker is a person.
		  </item>
		  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step24">       Therefore, my file is secure from hackers.
		    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="warning">Not the correct conclusion for a syllogism.</note>
		  </item>
		</list>
		To be a syllogism, the conclusion would have to be
		"any hacker doesn't know my file's password."
		The file may or may not be secure, but the above doesn't prove it.
	      </item>
	      <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="item16">
		One of the two premises is wrong.
		
		<list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="proof8">
		  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step25">       All people don't know my file's password. 
		    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="warning">Is this really true?</note>
		  </item>
		  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step26">       Any hacker is a person.
		    <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="warning">Is this really true?</note>
		  </item>
		  <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step27">       Therefore, any hacker doesn't know my file's password.
		  </item>
		</list>
		This proof fails of course, if some hackers are non-people (e.g. programs),
		or if some people know the password.
		(In fact, presumably <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">you</emphasis> know the password!)
		<note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="todo">add link: <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" strength="3">Example from</cnxn> <cite xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">The Cuckoo's Egg</cite> 
		  Male singer croons "Everybody loves my baby; My baby don't love [anybody] but me."  
		  Conclusion:
		  the speaker is his own baby, and is narcissistic.
		  (Or, the singer is wrong in his assumptions.)
		</note>
		
		Of course, just because the argument fails,
		the conclusion might be true for other reasons. 
		(That is, an incorrect argument doesn't prove the conclusion's opposite!)
	      </item>
	    </list>
	  </solution>
	</exercise>
      </section>
      
      
      <section xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="section13">
	<name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Other rules of inference</name>
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para39">
	  Of course, there are more ways to deduce things, beyond a syllogism;
	  
	  Who decides what the valid rules of inference are?
	  Is it always clear when people have used the rules correctly?
	</para>
	
	
	<figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="figure2">
	  <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block">
	    +-----+-----+
	    |  1  |  1  |
	    | (A) | (B) |
	    +-----+-----+
	    |  ?  |
	    | (F) |
	    +-----+
	  </code>
	</figure>
	
	<figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="figure3">
	  <code xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="block">
	    +-----+-----+
	    |  1  |  X  |
	    | (A) | (B) |
	    +-----+-----+
	    |  ?  |
	    | (F) |
	    +-----+
	  </code>
	</figure>
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para40">
	  Consider the following argument:
	  <list xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="enumerated" id="proof9">
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step28">(A) is next to one pirate; and
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step29">(A) has only one explored neighbor;
	    </item>
	    <item xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="step30">Conclusion:
	      If you are a square next to (A), then you contain a pirate
	    </item>
	  </list>
	  
	  This conclusion is not true:
	  (B) is certainly  next to (A), but it doesn't contain a pirate.
	  Alternately, consider that same proof applied to this board:
	  Here, we know that (F) is safe,
	  contrary to the conclusion.
	  (In real life, I make this mistake all the time,
	  when playing WaterWorld by hand! --The Author.)
	</para>
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para41">
	  The problem is that the author of the argument
	  presumably meant to conclude 
	  "all <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">explored</emphasis> neighbors of
	  (A) contain a pirate".
	  Really, the underlying problem for this mistaken reasoning
	  is
	  These problems both arise, of course, because
	  we were sloppy about what each sentence meant exactly.
	  We used informal English -- a fine language for humans,
	  who can cope with remarkable amounts of ambiguity --
	  but not a good language for specifying arguments.
	  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">
	    Laws and contracts are really written in a separate language
	    from English -- legalese -- full of technical terms with
	    specific meanings.
	    This is done because, while some ambiguity is tolerable in 99% of
	    human interaction, sometimes the remaining 1% is problematic.
	    However, legalese still contains intentionally ambiguous terms
	    (What is a punishment cruel and unusual?
	    What exactly is the Community Standard of indecency?)
	    The legal system tries to simultaneously be formal about laws,
	    yet also be flexible to allow for unforeseen situations and
	    situation-specific latitude.
	    (And the result of this tension is the position of Judge.)
	    
	    In this course, we are trying to be entirely specific, with no ambiguity.
	  </note>
	  We need to be more careful about how we state our facts,
	  and how we use these known facts to deduce other facts.
	  Note that such faulty reasoning might not just mean
	  losing  a silly game;
	  it could result in a genuine software bug
	  (prompting a $XXX chip recall,
	  or giving faulty information to a medical doctor).
	</para>
	
	
	<para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para42">
	  One reaction to the above arguments
	  is "Well, big deal -- somebody made a mistake (mis-interpreting
	  or mis-stating a claim); that's their problem.
	  (And sheesh, they sure are dolts!)" 
	  But as a programmer, that's not true:
	  Writing any large system, human programmers <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">will</emphasis> err,
	  no matter how smart or careful they are.
	  Thus we are looking for systematic ways to prove code correct or incorrect.
	  <note xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="aside">
	    Other fields have checklists, protocols, and regulations to minimize human
	    error; 
	    programming is no different, except that the industry is still working
	    on exactly what the checklists/training should be.
	    
	  </note>
	  The first thing we need is a way to say things
	  without ambiguity.
	  That's what we mean by a
	  
	  <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">logic</emphasis>.
	  In this case, we need a logic for 
	  the game of WaterWorld.
	</para>
      </section>
    </section>
  </content>
</document>
