src/HOL/Import/HOLLightCompat.thy
author wenzelm
Sun Jan 16 15:53:03 2011 +0100 (2011-01-16)
changeset 41589 bbd861837ebc
parent 35416 d8d7d1b785af
child 43787 5be84619e4d4
permissions -rw-r--r--
tuned headers;
obua@17322
     1
(*  Title:      HOL/Import/HOLLightCompat.thy
wenzelm@41589
     2
    Author:     Steven Obua and Sebastian Skalberg, TU Muenchen
obua@17322
     3
*)
obua@17322
     4
obua@17322
     5
theory HOLLightCompat imports HOL4Setup HOL4Compat Divides Primes Real begin
obua@17322
     6
obua@17322
     7
lemma light_imp_def: "(t1 --> t2) = ((t1 & t2) = t1)"
obua@17322
     8
  by auto;
obua@17322
     9
obua@17322
    10
lemma comb_rule: "[| P1 = P2 ; Q1 = Q2 |] ==> P1 Q1 = P2 Q2"
obua@17322
    11
  by simp
obua@17322
    12
obua@17322
    13
lemma light_and_def: "(t1 & t2) = ((%f. f t1 t2::bool) = (%f. f True True))"
obua@17322
    14
proof auto
obua@17322
    15
  assume a: "(%f. f t1 t2::bool) = (%f. f True True)"
obua@17322
    16
  have b: "(%(x::bool) (y::bool). x) = (%x y. x)" ..
obua@17322
    17
  with a
obua@17322
    18
  have "t1 = True"
obua@17322
    19
    by (rule comb_rule)
obua@17322
    20
  thus t1
obua@17322
    21
    by simp
obua@17322
    22
next
obua@17322
    23
  assume a: "(%f. f t1 t2::bool) = (%f. f True True)"
obua@17322
    24
  have b: "(%(x::bool) (y::bool). y) = (%x y. y)" ..
obua@17322
    25
  with a
obua@17322
    26
  have "t2 = True"
obua@17322
    27
    by (rule comb_rule)
obua@17322
    28
  thus t2
obua@17322
    29
    by simp
obua@17322
    30
qed
obua@17322
    31
haftmann@35416
    32
definition Pred :: "nat \<Rightarrow> nat" where
obua@17322
    33
   "Pred n \<equiv> n - (Suc 0)"
obua@17322
    34
obua@17322
    35
lemma Pred_altdef: "Pred = (SOME PRE. PRE 0 = 0 & (ALL n. PRE (Suc n) = n))"
obua@17322
    36
  apply (rule some_equality[symmetric])
obua@17322
    37
  apply (simp add: Pred_def)
obua@17322
    38
  apply (rule ext)
obua@17322
    39
  apply (induct_tac x)
obua@17322
    40
  apply (auto simp add: Pred_def)
obua@17322
    41
  done
obua@17322
    42
obua@17322
    43
lemma NUMERAL_rew[hol4rew]: "NUMERAL x = x" by (simp add: NUMERAL_def)
obua@17322
    44
obua@17322
    45
lemma REP_ABS_PAIR: "\<forall> x y. Rep_Prod (Abs_Prod (Pair_Rep x y)) = Pair_Rep x y"
obua@17322
    46
  apply (subst Abs_Prod_inverse)
obua@17322
    47
  apply (auto simp add: Prod_def)
obua@17322
    48
  done
obua@17322
    49
obua@17322
    50
lemma fst_altdef: "fst = (%p. SOME x. EX y. p = (x, y))"
obua@17322
    51
  apply (rule ext, rule someI2)
obua@17322
    52
  apply (auto intro: fst_conv[symmetric])
obua@17322
    53
  done
obua@17322
    54
obua@17322
    55
lemma snd_altdef: "snd = (%p. SOME x. EX y. p = (y, x))"
obua@17322
    56
  apply (rule ext, rule someI2)
obua@17322
    57
  apply (auto intro: snd_conv[symmetric])
obua@17322
    58
  done
obua@17322
    59
obua@17322
    60
lemma add_altdef: "op + = (SOME add. (ALL n. add 0 n = n) & (ALL m n. add (Suc m) n = Suc (add m n)))"
obua@17322
    61
  apply (rule some_equality[symmetric])
obua@17322
    62
  apply auto
obua@17322
    63
  apply (rule ext)+
obua@17322
    64
  apply (induct_tac x)
obua@17322
    65
  apply auto
obua@17322
    66
  done
obua@17322
    67
obua@17322
    68
lemma mult_altdef: "op * = (SOME mult. (ALL n. mult 0 n = 0) & (ALL m n. mult (Suc m) n = mult m n + n))"
obua@17322
    69
  apply (rule some_equality[symmetric])
obua@17322
    70
  apply auto
obua@17322
    71
  apply (rule ext)+
obua@17322
    72
  apply (induct_tac x)
obua@17322
    73
  apply auto
obua@17322
    74
  done
obua@17322
    75
obua@17322
    76
lemma sub_altdef: "op - = (SOME sub. (ALL m. sub m 0 = m) & (ALL m n. sub m (Suc n) = Pred (sub m n)))"
obua@17322
    77
  apply (simp add: Pred_def)
obua@17322
    78
  apply (rule some_equality[symmetric])
obua@17322
    79
  apply auto
obua@17322
    80
  apply (rule ext)+
obua@17322
    81
  apply (induct_tac xa)
obua@17322
    82
  apply auto
obua@17322
    83
  done
obua@17322
    84
haftmann@35416
    85
definition NUMERAL_BIT0 :: "nat \<Rightarrow> nat" where
obua@17322
    86
  "NUMERAL_BIT0 n \<equiv> n + n"
obua@17322
    87
obua@17322
    88
lemma NUMERAL_BIT1_altdef: "NUMERAL_BIT1 n = Suc (n + n)"
obua@17322
    89
  by (simp add: NUMERAL_BIT1_def)
obua@17322
    90
obua@19064
    91
consts
obua@19064
    92
  sumlift :: "('a \<Rightarrow> 'c) \<Rightarrow> ('b \<Rightarrow> 'c) \<Rightarrow> (('a + 'b) \<Rightarrow> 'c)"
obua@17322
    93
obua@19064
    94
primrec
obua@19064
    95
  "sumlift f g (Inl a) = f a"
obua@19064
    96
  "sumlift f g (Inr b) = g b"
obua@19064
    97
  
obua@19064
    98
lemma sum_Recursion: "\<exists> f. (\<forall> a. f (Inl a) = Inl' a) \<and> (\<forall> b. f (Inr b) = Inr' b)"
obua@19064
    99
  apply (rule exI[where x="sumlift Inl' Inr'"])
obua@19064
   100
  apply auto
obua@19064
   101
  done
obua@17322
   102
obua@17322
   103
end