src/HOL/ex/Puzzle.thy
author haftmann
Fri Jun 17 16:12:49 2005 +0200 (2005-06-17)
changeset 16417 9bc16273c2d4
parent 14126 28824746d046
child 17388 495c799df31d
permissions -rw-r--r--
migrated theory headers to new format
     1 (*  Title:      HOL/ex/Puzzle.thy
     2     ID:         $Id$
     3     Author:     Tobias Nipkow
     4     Copyright   1993 TU Muenchen
     5 
     6 A question from "Bundeswettbewerb Mathematik"
     7 
     8 Proof due to Herbert Ehler
     9 *)
    10 
    11 theory Puzzle imports Main begin
    12 
    13 consts f :: "nat => nat"
    14 
    15 specification (f)
    16   f_ax [intro!]: "f(f(n)) < f(Suc(n))"
    17     by (rule exI [of _ id], simp)
    18 
    19 
    20 lemma lemma0 [rule_format]: "\<forall>n. k=f(n) --> n <= f(n)"
    21 apply (induct_tac "k" rule: nat_less_induct)
    22 apply (rule allI)
    23 apply (rename_tac "i")
    24 apply (case_tac "i")
    25  apply simp
    26 apply (blast intro!: Suc_leI intro: le_less_trans)
    27 done
    28 
    29 lemma lemma1: "n <= f(n)"
    30 by (blast intro: lemma0)
    31 
    32 lemma lemma2: "f(n) < f(Suc(n))"
    33 by (blast intro: le_less_trans lemma1)
    34 
    35 lemma f_mono [rule_format (no_asm)]: "m <= n --> f(m) <= f(n)"
    36 apply (induct_tac "n")
    37  apply simp
    38 apply (rule impI)
    39 apply (erule le_SucE)
    40  apply (cut_tac n = n in lemma2, auto) 
    41 done
    42 
    43 lemma f_id: "f(n) = n"
    44 apply (rule order_antisym)
    45 apply (rule_tac [2] lemma1) 
    46 apply (blast intro: leI dest: leD f_mono Suc_leI)
    47 done
    48 
    49 end
    50