doc-src/TutorialI/Rules/rules.tex
changeset 11417 499435b4084e
parent 11411 c315dda16748
child 11428 332347b9b942
equal deleted inserted replaced
11416:91886738773a 11417:499435b4084e
    65 the form of a conjunction; the proof step makes this conjunction symbol
    65 the form of a conjunction; the proof step makes this conjunction symbol
    66 disappear. 
    66 disappear. 
    67 
    67 
    68 In Isabelle notation, the rule looks like this:
    68 In Isabelle notation, the rule looks like this:
    69 \begin{isabelle}
    69 \begin{isabelle}
    70 \isasymlbrakk?P;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?P\ \isasymand\ ?Q\rulename{conjI}
    70 \isasymlbrakk?P;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?P\ \isasymand\ ?Q\rulenamedx{conjI}
    71 \end{isabelle}
    71 \end{isabelle}
    72 Carefully examine the syntax.  The premises appear to the
    72 Carefully examine the syntax.  The premises appear to the
    73 left of the arrow and the conclusion to the right.  The premises (if 
    73 left of the arrow and the conclusion to the right.  The premises (if 
    74 more than one) are grouped using the fat brackets.  The question marks
    74 more than one) are grouped using the fat brackets.  The question marks
    75 indicate \textbf{schematic variables} (also called
    75 indicate \textbf{schematic variables} (also called
   157 The assumptions $[P]$ and $[Q]$ are bracketed 
   157 The assumptions $[P]$ and $[Q]$ are bracketed 
   158 to emphasize that they are local to their subproofs.  In Isabelle 
   158 to emphasize that they are local to their subproofs.  In Isabelle 
   159 notation, the already-familiar \isa{\isasymLongrightarrow} syntax serves the
   159 notation, the already-familiar \isa{\isasymLongrightarrow} syntax serves the
   160 same  purpose:
   160 same  purpose:
   161 \begin{isabelle}
   161 \begin{isabelle}
   162 \isasymlbrakk?P\ \isasymor\ ?Q;\ ?P\ \isasymLongrightarrow\ ?R;\ ?Q\ \isasymLongrightarrow\ ?R\isasymrbrakk\ \isasymLongrightarrow\ ?R\rulename{disjE}
   162 \isasymlbrakk?P\ \isasymor\ ?Q;\ ?P\ \isasymLongrightarrow\ ?R;\ ?Q\ \isasymLongrightarrow\ ?R\isasymrbrakk\ \isasymLongrightarrow\ ?R\rulenamedx{disjE}
   163 \end{isabelle}
   163 \end{isabelle}
   164 When we use this sort of elimination rule backwards, it produces 
   164 When we use this sort of elimination rule backwards, it produces 
   165 a case split.  (We have seen this before, in proofs by induction.)  The following  proof
   165 a case split.  (We have seen this before, in proofs by induction.)  The following  proof
   166 illustrates the use of disjunction elimination.  
   166 illustrates the use of disjunction elimination.  
   167 \begin{isabelle}
   167 \begin{isabelle}
   279 of the formula, when usually we want to take both parts of the conjunction as new
   279 of the formula, when usually we want to take both parts of the conjunction as new
   280 assumptions.  The easiest way to do so is by using an 
   280 assumptions.  The easiest way to do so is by using an 
   281 alternative conjunction elimination rule that resembles \isa{disjE}\@.  It is
   281 alternative conjunction elimination rule that resembles \isa{disjE}\@.  It is
   282 seldom, if ever, seen in logic books.  In Isabelle syntax it looks like this: 
   282 seldom, if ever, seen in logic books.  In Isabelle syntax it looks like this: 
   283 \begin{isabelle}
   283 \begin{isabelle}
   284 \isasymlbrakk?P\ \isasymand\ ?Q;\ \isasymlbrakk?P;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?R\isasymrbrakk\ \isasymLongrightarrow\ ?R\rulename{conjE}
   284 \isasymlbrakk?P\ \isasymand\ ?Q;\ \isasymlbrakk?P;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?R\isasymrbrakk\ \isasymLongrightarrow\ ?R\rulenamedx{conjE}
   285 \end{isabelle}
   285 \end{isabelle}
   286 \index{destruction rules|)}
   286 \index{destruction rules|)}
   287 
   287 
   288 \begin{exercise}
   288 \begin{exercise}
   289 Use the rule \isa{conjE} to shorten the proof above. 
   289 Use the rule \isa{conjE} to shorten the proof above. 
   296 At the start of this chapter, we saw the rule \emph{modus ponens}.  It is, in fact,
   296 At the start of this chapter, we saw the rule \emph{modus ponens}.  It is, in fact,
   297 a destruction rule. The matching introduction rule looks like this 
   297 a destruction rule. The matching introduction rule looks like this 
   298 in Isabelle: 
   298 in Isabelle: 
   299 \begin{isabelle}
   299 \begin{isabelle}
   300 (?P\ \isasymLongrightarrow\ ?Q)\ \isasymLongrightarrow\ ?P\
   300 (?P\ \isasymLongrightarrow\ ?Q)\ \isasymLongrightarrow\ ?P\
   301 \isasymlongrightarrow\ ?Q\rulename{impI}
   301 \isasymlongrightarrow\ ?Q\rulenamedx{impI}
   302 \end{isabelle}
   302 \end{isabelle}
   303 And this is \emph{modus ponens}\index{modus ponens@\emph{modus ponens}} :
   303 And this is \emph{modus ponens}\index{modus ponens@\emph{modus ponens}} :
   304 \begin{isabelle}
   304 \begin{isabelle}
   305 \isasymlbrakk?P\ \isasymlongrightarrow\ ?Q;\ ?P\isasymrbrakk\
   305 \isasymlbrakk?P\ \isasymlongrightarrow\ ?Q;\ ?P\isasymrbrakk\
   306 \isasymLongrightarrow\ ?Q
   306 \isasymLongrightarrow\ ?Q
   307 \rulename{mp}
   307 \rulenamedx{mp}
   308 \end{isabelle}
   308 \end{isabelle}
   309 
   309 
   310 Here is a proof using the implication rules.  This 
   310 Here is a proof using the implication rules.  This 
   311 lemma performs a sort of uncurrying, replacing the two antecedents 
   311 lemma performs a sort of uncurrying, replacing the two antecedents 
   312 of a nested implication by a conjunction.  The proof illustrates
   312 of a nested implication by a conjunction.  The proof illustrates
   411 Negation introduction deduces $\neg P$ if assuming $P$ leads to a 
   411 Negation introduction deduces $\neg P$ if assuming $P$ leads to a 
   412 contradiction. Negation elimination deduces any formula in the 
   412 contradiction. Negation elimination deduces any formula in the 
   413 presence of $\neg P$ together with~$P$: 
   413 presence of $\neg P$ together with~$P$: 
   414 \begin{isabelle}
   414 \begin{isabelle}
   415 (?P\ \isasymLongrightarrow\ False)\ \isasymLongrightarrow\ \isasymnot\ ?P%
   415 (?P\ \isasymLongrightarrow\ False)\ \isasymLongrightarrow\ \isasymnot\ ?P%
   416 \rulename{notI}\isanewline
   416 \rulenamedx{notI}\isanewline
   417 \isasymlbrakk{\isasymnot}\ ?P;\ ?P\isasymrbrakk\ \isasymLongrightarrow\ ?R%
   417 \isasymlbrakk{\isasymnot}\ ?P;\ ?P\isasymrbrakk\ \isasymLongrightarrow\ ?R%
   418 \rulename{notE}
   418 \rulenamedx{notE}
   419 \end{isabelle}
   419 \end{isabelle}
   420 %
   420 %
   421 Classical logic allows us to assume $\neg P$ 
   421 Classical logic allows us to assume $\neg P$ 
   422 when attempting to prove~$P$: 
   422 when attempting to prove~$P$: 
   423 \begin{isabelle}
   423 \begin{isabelle}
   424 (\isasymnot\ ?P\ \isasymLongrightarrow\ ?P)\ \isasymLongrightarrow\ ?P%
   424 (\isasymnot\ ?P\ \isasymLongrightarrow\ ?P)\ \isasymLongrightarrow\ ?P%
   425 \rulename{classical}
   425 \rulenamedx{classical}
   426 \end{isabelle}
   426 \end{isabelle}
   427 
   427 
   428 \index{contrapositives|(}%
   428 \index{contrapositives|(}%
   429 The implications $P\imp Q$ and $\neg Q\imp\neg P$ are logically
   429 The implications $P\imp Q$ and $\neg Q\imp\neg P$ are logically
   430 equivalent, and each is called the
   430 equivalent, and each is called the
   498 
   498 
   499 The following example may be skipped on a first reading.  It involves a
   499 The following example may be skipped on a first reading.  It involves a
   500 peculiar but important rule, a form of disjunction introduction:
   500 peculiar but important rule, a form of disjunction introduction:
   501 \begin{isabelle}
   501 \begin{isabelle}
   502 (\isasymnot \ ?Q\ \isasymLongrightarrow \ ?P)\ \isasymLongrightarrow \ ?P\ \isasymor \ ?Q%
   502 (\isasymnot \ ?Q\ \isasymLongrightarrow \ ?P)\ \isasymLongrightarrow \ ?P\ \isasymor \ ?Q%
   503 \rulename{disjCI}
   503 \rulenamedx{disjCI}
   504 \end{isabelle}
   504 \end{isabelle}
   505 This rule combines the effects of \isa{disjI1} and \isa{disjI2}.  Its great
   505 This rule combines the effects of \isa{disjI1} and \isa{disjI2}.  Its great
   506 advantage is that we can remove the disjunction symbol without deciding
   506 advantage is that we can remove the disjunction symbol without deciding
   507 which disjunction to prove.  This treatment of disjunction is standard in sequent
   507 which disjunction to prove.  This treatment of disjunction is standard in sequent
   508 and tableau calculi.
   508 and tableau calculi.
   678 
   678 
   679 The Isabelle version of the substitution rule looks like this: 
   679 The Isabelle version of the substitution rule looks like this: 
   680 \begin{isabelle}
   680 \begin{isabelle}
   681 \isasymlbrakk?t\ =\ ?s;\ ?P\ ?s\isasymrbrakk\ \isasymLongrightarrow\ ?P\
   681 \isasymlbrakk?t\ =\ ?s;\ ?P\ ?s\isasymrbrakk\ \isasymLongrightarrow\ ?P\
   682 ?t
   682 ?t
   683 \rulename{ssubst}
   683 \rulenamedx{ssubst}
   684 \end{isabelle}
   684 \end{isabelle}
   685 Crucially, \isa{?P} is a function 
   685 Crucially, \isa{?P} is a function 
   686 variable.  It can be replaced by a $\lambda$-term 
   686 variable.  It can be replaced by a $\lambda$-term 
   687 with one bound variable, whose occurrences identify the places 
   687 with one bound variable, whose occurrences identify the places 
   688 in which $s$ will be replaced by~$t$.  The proof above requires
   688 in which $s$ will be replaced by~$t$.  The proof above requires
   874 \subsection{The Universal Introduction Rule}
   874 \subsection{The Universal Introduction Rule}
   875 
   875 
   876 Returning to the universal quantifier, we find that having a similar quantifier
   876 Returning to the universal quantifier, we find that having a similar quantifier
   877 as part of the meta-logic makes the introduction rule trivial to express:
   877 as part of the meta-logic makes the introduction rule trivial to express:
   878 \begin{isabelle}
   878 \begin{isabelle}
   879 (\isasymAnd x.\ ?P\ x)\ \isasymLongrightarrow\ {\isasymforall}x.\ ?P\ x\rulename{allI}
   879 (\isasymAnd x.\ ?P\ x)\ \isasymLongrightarrow\ {\isasymforall}x.\ ?P\ x\rulenamedx{allI}
   880 \end{isabelle}
   880 \end{isabelle}
   881 
   881 
   882 
   882 
   883 The following trivial proof demonstrates how the universal introduction 
   883 The following trivial proof demonstrates how the universal introduction 
   884 rule works. 
   884 rule works. 
   908 the rule looks like this: 
   908 the rule looks like this: 
   909 \[ \infer{P[t/x]}{\forall x.\,P} \]
   909 \[ \infer{P[t/x]}{\forall x.\,P} \]
   910 The conclusion is $P$ with $t$ substituted for the variable~$x$.  
   910 The conclusion is $P$ with $t$ substituted for the variable~$x$.  
   911 Isabelle expresses substitution using a function variable: 
   911 Isabelle expresses substitution using a function variable: 
   912 \begin{isabelle}
   912 \begin{isabelle}
   913 {\isasymforall}x.\ ?P\ x\ \isasymLongrightarrow\ ?P\ ?x\rulename{spec}
   913 {\isasymforall}x.\ ?P\ x\ \isasymLongrightarrow\ ?P\ ?x\rulenamedx{spec}
   914 \end{isabelle}
   914 \end{isabelle}
   915 This destruction rule takes a 
   915 This destruction rule takes a 
   916 universally quantified formula and removes the quantifier, replacing 
   916 universally quantified formula and removes the quantifier, replacing 
   917 the bound variable \isa{x} by the schematic variable \isa{?x}.  Recall that a
   917 the bound variable \isa{x} by the schematic variable \isa{?x}.  Recall that a
   918 schematic variable starts with a question mark and acts as a
   918 schematic variable starts with a question mark and acts as a
   921 The universal elimination rule is also
   921 The universal elimination rule is also
   922 available in the standard elimination format.  Like \isa{conjE}, it never
   922 available in the standard elimination format.  Like \isa{conjE}, it never
   923 appears in logic books:
   923 appears in logic books:
   924 \begin{isabelle}
   924 \begin{isabelle}
   925 \isasymlbrakk \isasymforall x.\ ?P\ x;\ ?P\ ?x\ \isasymLongrightarrow \ ?R\isasymrbrakk \ \isasymLongrightarrow \ ?R%
   925 \isasymlbrakk \isasymforall x.\ ?P\ x;\ ?P\ ?x\ \isasymLongrightarrow \ ?R\isasymrbrakk \ \isasymLongrightarrow \ ?R%
   926 \rulename{allE}
   926 \rulenamedx{allE}
   927 \end{isabelle}
   927 \end{isabelle}
   928 The methods \isa{drule~spec} and \isa{erule~allE} do precisely the
   928 The methods \isa{drule~spec} and \isa{erule~allE} do precisely the
   929 same inference.
   929 same inference.
   930 
   930 
   931 To see how $\forall$-elimination works, let us derive a rule about reducing 
   931 To see how $\forall$-elimination works, let us derive a rule about reducing 
  1003 \index{quantifiers!existential|(}%
  1003 \index{quantifiers!existential|(}%
  1004 The concepts just presented also apply
  1004 The concepts just presented also apply
  1005 to the existential quantifier, whose introduction rule looks like this in
  1005 to the existential quantifier, whose introduction rule looks like this in
  1006 Isabelle: 
  1006 Isabelle: 
  1007 \begin{isabelle}
  1007 \begin{isabelle}
  1008 ?P\ ?x\ \isasymLongrightarrow\ {\isasymexists}x.\ ?P\ x\rulename{exI}
  1008 ?P\ ?x\ \isasymLongrightarrow\ {\isasymexists}x.\ ?P\ x\rulenamedx{exI}
  1009 \end{isabelle}
  1009 \end{isabelle}
  1010 If we can exhibit some $x$ such that $P(x)$ is true, then $\exists x.
  1010 If we can exhibit some $x$ such that $P(x)$ is true, then $\exists x.
  1011 P(x)$ is also true.  It is a dual of the universal elimination rule, and
  1011 P(x)$ is also true.  It is a dual of the universal elimination rule, and
  1012 logic texts present it using the same notation for substitution.
  1012 logic texts present it using the same notation for substitution.
  1013 
  1013 
  1016 in a logic text: 
  1016 in a logic text: 
  1017 \[ \infer{Q}{\exists x.\,P & \infer*{Q}{[P]}} \]
  1017 \[ \infer{Q}{\exists x.\,P & \infer*{Q}{[P]}} \]
  1018 %
  1018 %
  1019 It looks like this in Isabelle: 
  1019 It looks like this in Isabelle: 
  1020 \begin{isabelle}
  1020 \begin{isabelle}
  1021 \isasymlbrakk{\isasymexists}x.\ ?P\ x;\ \isasymAnd x.\ ?P\ x\ \isasymLongrightarrow\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?Q\rulename{exE}
  1021 \isasymlbrakk{\isasymexists}x.\ ?P\ x;\ \isasymAnd x.\ ?P\ x\ \isasymLongrightarrow\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?Q\rulenamedx{exE}
  1022 \end{isabelle}
  1022 \end{isabelle}
  1023 %
  1023 %
  1024 Given an existentially quantified theorem and some
  1024 Given an existentially quantified theorem and some
  1025 formula $Q$ to prove, it creates a new assumption by removing the quantifier.  As with
  1025 formula $Q$ to prove, it creates a new assumption by removing the quantifier.  As with
  1026 the universal introduction  rule, the textbook version imposes a proviso on the
  1026 the universal introduction  rule, the textbook version imposes a proviso on the
  1168 \end{isabelle}
  1168 \end{isabelle}
  1169 We have forced the desired instantiation.
  1169 We have forced the desired instantiation.
  1170 
  1170 
  1171 \medskip
  1171 \medskip
  1172 Existential formulas can be instantiated too.  The next example uses the 
  1172 Existential formulas can be instantiated too.  The next example uses the 
  1173 \textbf{divides} relation\indexbold{divides relation}
  1173 \textbf{divides} relation\index{divides relation}
  1174 of number theory: 
  1174 of number theory: 
  1175 \begin{isabelle}
  1175 \begin{isabelle}
  1176 ?m\ dvd\ ?n\ \isasymequiv\ {\isasymexists}k.\ ?n\ =\ ?m\ *\ k
  1176 ?m\ dvd\ ?n\ \isasymequiv\ {\isasymexists}k.\ ?n\ =\ ?m\ *\ k
  1177 \rulename{dvd_def}
  1177 \rulename{dvd_def}
  1178 \end{isabelle}
  1178 \end{isabelle}
  1253 description}: when \isa{P} is satisfied by a unique value,~\isa{a}. 
  1253 description}: when \isa{P} is satisfied by a unique value,~\isa{a}. 
  1254 We reason using this rule:\REMARK{update if we add iota}
  1254 We reason using this rule:\REMARK{update if we add iota}
  1255 \begin{isabelle}
  1255 \begin{isabelle}
  1256 \isasymlbrakk P\ a;\ \isasymAnd x.\ P\ x\ \isasymLongrightarrow \ x\ =\ a\isasymrbrakk \ 
  1256 \isasymlbrakk P\ a;\ \isasymAnd x.\ P\ x\ \isasymLongrightarrow \ x\ =\ a\isasymrbrakk \ 
  1257 \isasymLongrightarrow \ (SOME\ x.\ P\ x)\ =\ a%
  1257 \isasymLongrightarrow \ (SOME\ x.\ P\ x)\ =\ a%
  1258 \rulename{some_equality}
  1258 \rulenamedx{some_equality}
  1259 \end{isabelle}
  1259 \end{isabelle}
  1260 For instance, we can define the
  1260 For instance, we can define the
  1261 cardinality of a finite set~$A$ to be that
  1261 cardinality of a finite set~$A$ to be that
  1262 $n$ such that $A$ is in one-to-one correspondence with $\{1,\ldots,n\}$.  We can then
  1262 $n$ such that $A$ is in one-to-one correspondence with $\{1,\ldots,n\}$.  We can then
  1263 prove that the cardinality of the empty set is zero (since $n=0$ satisfies the
  1263 prove that the cardinality of the empty set is zero (since $n=0$ satisfies the
  1307 
  1307 
  1308 \index{descriptions!indefinite}%
  1308 \index{descriptions!indefinite}%
  1309 Occasionally, \hbox{\isa{SOME\ x.\ P\ x}} serves as an \textbf{indefinite
  1309 Occasionally, \hbox{\isa{SOME\ x.\ P\ x}} serves as an \textbf{indefinite
  1310 description}, when it makes an arbitrary selection from the values
  1310 description}, when it makes an arbitrary selection from the values
  1311 satisfying~\isa{P}\@.  Here is the definition
  1311 satisfying~\isa{P}\@.  Here is the definition
  1312 of~\isa{inv},\index{*inv (constant)} which expresses inverses of functions:
  1312 of~\cdx{inv}, which expresses inverses of
       
  1313 functions:
  1313 \begin{isabelle}
  1314 \begin{isabelle}
  1314 inv\ f\ \isasymequiv \ \isasymlambda y.\ SOME\ x.\ f\ x\ =\ y%
  1315 inv\ f\ \isasymequiv \ \isasymlambda y.\ SOME\ x.\ f\ x\ =\ y%
  1315 \rulename{inv_def}
  1316 \rulename{inv_def}
  1316 \end{isabelle}
  1317 \end{isabelle}
  1317 The inverse of \isa{f}, when applied to \isa{y}, returns some~\isa{x} such that
  1318 The inverse of \isa{f}, when applied to \isa{y}, returns some~\isa{x} such that
  1333 \isa{SOME} as a definite description, since it only reasons about
  1334 \isa{SOME} as a definite description, since it only reasons about
  1334 situations in which the value is  described uniquely.  To go further is
  1335 situations in which the value is  described uniquely.  To go further is
  1335 tricky and requires rules such as these:
  1336 tricky and requires rules such as these:
  1336 \begin{isabelle}
  1337 \begin{isabelle}
  1337 P\ x\ \isasymLongrightarrow \ P\ (SOME\ x.\ P\ x)
  1338 P\ x\ \isasymLongrightarrow \ P\ (SOME\ x.\ P\ x)
  1338 \rulename{someI}\isanewline
  1339 \rulenamedx{someI}\isanewline
  1339 \isasymlbrakk P\ a;\ \isasymAnd x.\ P\ x\ \isasymLongrightarrow \ Q\
  1340 \isasymlbrakk P\ a;\ \isasymAnd x.\ P\ x\ \isasymLongrightarrow \ Q\
  1340 x\isasymrbrakk \ \isasymLongrightarrow \ Q\ (SOME\ x.\ P\ x)
  1341 x\isasymrbrakk \ \isasymLongrightarrow \ Q\ (SOME\ x.\ P\ x)
  1341 \rulename{someI2}
  1342 \rulenamedx{someI2}
  1342 \end{isabelle}
  1343 \end{isabelle}
  1343 Rule \isa{someI} is basic: if anything satisfies \isa{P} then so does
  1344 Rule \isa{someI} is basic: if anything satisfies \isa{P} then so does
  1344 \hbox{\isa{SOME\ x.\ P\ x}}.  The repetition of~\isa{P} in the conclusion makes it
  1345 \hbox{\isa{SOME\ x.\ P\ x}}.  The repetition of~\isa{P} in the conclusion makes it
  1345 difficult to apply in a backward proof, so the derived rule \isa{someI2} is
  1346 difficult to apply in a backward proof, so the derived rule \isa{someI2} is
  1346 also provided. 
  1347 also provided. 
  1836 To re-orient the equation requires the symmetry rule:
  1837 To re-orient the equation requires the symmetry rule:
  1837 \begin{isabelle}
  1838 \begin{isabelle}
  1838 ?s\ =\ ?t\
  1839 ?s\ =\ ?t\
  1839 \isasymLongrightarrow\ ?t\ =\
  1840 \isasymLongrightarrow\ ?t\ =\
  1840 ?s%
  1841 ?s%
  1841 \rulename{sym}
  1842 \rulenamedx{sym}
  1842 \end{isabelle}
  1843 \end{isabelle}
  1843 The following declaration gives our equation to \isa{sym}:
  1844 The following declaration gives our equation to \isa{sym}:
  1844 \begin{isabelle}
  1845 \begin{isabelle}
  1845 \ \ \ \isacommand{lemmas}\ gcd_mult\ =\ gcd_mult_1\ [THEN\ sym]
  1846 \ \ \ \isacommand{lemmas}\ gcd_mult\ =\ gcd_mult_1\ [THEN\ sym]
  1846 \end{isabelle}
  1847 \end{isabelle}
  1857 which converts the implication $P\imp Q$ into the rule
  1858 which converts the implication $P\imp Q$ into the rule
  1858 $\vcenter{\infer{Q}{P}}$. Similar to \isa{mp} are the following two rules,
  1859 $\vcenter{\infer{Q}{P}}$. Similar to \isa{mp} are the following two rules,
  1859 which extract  the two directions of reasoning about a boolean equivalence:
  1860 which extract  the two directions of reasoning about a boolean equivalence:
  1860 \begin{isabelle}
  1861 \begin{isabelle}
  1861 \isasymlbrakk?Q\ =\ ?P;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?P%
  1862 \isasymlbrakk?Q\ =\ ?P;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?P%
  1862 \rulename{iffD1}%
  1863 \rulenamedx{iffD1}%
  1863 \isanewline
  1864 \isanewline
  1864 \isasymlbrakk?P\ =\ ?Q;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?P%
  1865 \isasymlbrakk?P\ =\ ?Q;\ ?Q\isasymrbrakk\ \isasymLongrightarrow\ ?P%
  1865 \rulename{iffD2}
  1866 \rulenamedx{iffD2}
  1866 \end{isabelle}
  1867 \end{isabelle}
  1867 %
  1868 %
  1868 Normally we would never name the intermediate theorems
  1869 Normally we would never name the intermediate theorems
  1869 such as \isa{gcd_mult_0} and
  1870 such as \isa{gcd_mult_0} and
  1870 \isa{gcd_mult_1} but would combine
  1871 \isa{gcd_mult_1} but would combine
  2015 \isa{mp} and
  2016 \isa{mp} and
  2016 \isa{spec} to operate on formulae.  They can also operate on terms, using rules
  2017 \isa{spec} to operate on formulae.  They can also operate on terms, using rules
  2017 such as these:
  2018 such as these:
  2018 \begin{isabelle}
  2019 \begin{isabelle}
  2019 x\ =\ y\ \isasymLongrightarrow \ f\ x\ =\ f\ y%
  2020 x\ =\ y\ \isasymLongrightarrow \ f\ x\ =\ f\ y%
  2020 \rulename{arg_cong}\isanewline
  2021 \rulenamedx{arg_cong}\isanewline
  2021 i\ \isasymle \ j\ \isasymLongrightarrow \ i\ *\ k\ \isasymle \ j\ *\ k%
  2022 i\ \isasymle \ j\ \isasymLongrightarrow \ i\ *\ k\ \isasymle \ j\ *\ k%
  2022 \rulename{mult_le_mono1}
  2023 \rulename{mult_le_mono1}
  2023 \end{isabelle}
  2024 \end{isabelle}
  2024 
  2025 
  2025 For example, let us prove a fact about divisibility in the natural numbers:
  2026 For example, let us prove a fact about divisibility in the natural numbers:
  2094 \end{isabelle}
  2095 \end{isabelle}
  2095 Simplification has yielded an equation for~\isa{m}.  The rest of the proof
  2096 Simplification has yielded an equation for~\isa{m}.  The rest of the proof
  2096 is omitted.
  2097 is omitted.
  2097 
  2098 
  2098 \medskip
  2099 \medskip
  2099 Here is another demonstration of \isa{insert}.  \REMARK{Effect with
  2100 Here is another demonstration of \isa{insert}.  Division and
  2100 unknowns?} Division  and remainder obey a well-known law: 
  2101 remainder obey a well-known law: 
  2101 \begin{isabelle}
  2102 \begin{isabelle}
  2102 (?m\ div\ ?n)\ *\ ?n\ +\ ?m\ mod\ ?n\ =\ ?m
  2103 (?m\ div\ ?n)\ *\ ?n\ +\ ?m\ mod\ ?n\ =\ ?m
  2103 \rulename{mod_div_equality}
  2104 \rulename{mod_div_equality}
  2104 \end{isabelle}
  2105 \end{isabelle}
  2105 
  2106