src/HOL/ex/Puzzle.thy
author paulson
Wed May 08 09:08:29 2002 +0200 (2002-05-08)
changeset 13116 baabb0fd2ccf
parent 8018 bedd0beabbae
child 14126 28824746d046
permissions -rw-r--r--
converted to Isar
     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 = Main:
    12 
    13 consts f :: "nat => nat"
    14 
    15 axioms  f_ax [intro!]: "f(f(n)) < f(Suc(n))"
    16 
    17 
    18 lemma lemma0 [rule_format]: "\<forall>n. k=f(n) --> n <= f(n)"
    19 apply (induct_tac "k" rule: nat_less_induct)
    20 apply (rule allI)
    21 apply (rename_tac "i")
    22 apply (case_tac "i")
    23  apply simp
    24 apply (blast intro!: Suc_leI intro: le_less_trans)
    25 done
    26 
    27 lemma lemma1: "n <= f(n)"
    28 by (blast intro: lemma0)
    29 
    30 lemma lemma2: "f(n) < f(Suc(n))"
    31 by (blast intro: le_less_trans lemma1)
    32 
    33 lemma f_mono [rule_format (no_asm)]: "m <= n --> f(m) <= f(n)"
    34 apply (induct_tac "n")
    35  apply simp
    36 apply (rule impI)
    37 apply (erule le_SucE)
    38  apply (cut_tac n = n in lemma2, auto) 
    39 done
    40 
    41 lemma f_id: "f(n) = n"
    42 apply (rule order_antisym)
    43 apply (rule_tac [2] lemma1) 
    44 apply (blast intro: leI dest: leD f_mono Suc_leI)
    45 done
    46 
    47 end
    48