src/Pure/Pure.thy
author wenzelm
Fri Jan 13 01:12:59 2006 +0100 (2006-01-13 ago)
changeset 18663 8474756e4cbf
parent 18466 389a6f9c31f4
child 18710 527aa560a9e0
permissions -rw-r--r--
implicit setup, which admits exception_trace;
wenzelm@15803
     1
(*  Title:      Pure/Pure.thy
wenzelm@15803
     2
    ID:         $Id$
wenzelm@18466
     3
*)
wenzelm@15803
     4
wenzelm@18466
     5
header {* The Pure theory *}
wenzelm@15803
     6
wenzelm@15803
     7
theory Pure
wenzelm@15803
     8
imports ProtoPure
wenzelm@15803
     9
begin
wenzelm@15803
    10
wenzelm@18663
    11
setup
wenzelm@15803
    12
wenzelm@18466
    13
subsection {* Meta-level connectives in assumptions *}
wenzelm@15803
    14
wenzelm@15803
    15
lemma meta_mp:
wenzelm@18019
    16
  assumes "PROP P ==> PROP Q" and "PROP P"
wenzelm@15803
    17
  shows "PROP Q"
wenzelm@18019
    18
    by (rule `PROP P ==> PROP Q` [OF `PROP P`])
wenzelm@15803
    19
wenzelm@15803
    20
lemma meta_spec:
wenzelm@18019
    21
  assumes "!!x. PROP P(x)"
wenzelm@15803
    22
  shows "PROP P(x)"
wenzelm@18019
    23
    by (rule `!!x. PROP P(x)`)
wenzelm@15803
    24
wenzelm@15803
    25
lemmas meta_allE = meta_spec [elim_format]
wenzelm@15803
    26
wenzelm@18466
    27
wenzelm@18466
    28
subsection {* Meta-level conjunction *}
wenzelm@18466
    29
wenzelm@18466
    30
locale (open) meta_conjunction_syntax =
wenzelm@18466
    31
  fixes meta_conjunction :: "prop => prop => prop"  (infixr "&&" 2)
wenzelm@18466
    32
wenzelm@18466
    33
parse_translation {*
wenzelm@18466
    34
  [("\<^fixed>meta_conjunction", fn [t, u] => Logic.mk_conjunction (t, u))]
wenzelm@18466
    35
*}
wenzelm@18466
    36
wenzelm@18466
    37
lemma all_conjunction:
wenzelm@18466
    38
  includes meta_conjunction_syntax
wenzelm@18466
    39
  shows "(!!x. PROP A(x) && PROP B(x)) == ((!!x. PROP A(x)) && (!!x. PROP B(x)))"
wenzelm@18466
    40
proof
wenzelm@18466
    41
  assume conj: "!!x. PROP A(x) && PROP B(x)"
wenzelm@18466
    42
  fix X assume r: "(!!x. PROP A(x)) ==> (!!x. PROP B(x)) ==> PROP X"
wenzelm@18466
    43
  show "PROP X"
wenzelm@18466
    44
  proof (rule r)
wenzelm@18466
    45
    fix x
wenzelm@18466
    46
    from conj show "PROP A(x)" .
wenzelm@18466
    47
    from conj show "PROP B(x)" .
wenzelm@18466
    48
  qed
wenzelm@18466
    49
next
wenzelm@18466
    50
  assume conj: "(!!x. PROP A(x)) && (!!x. PROP B(x))"
wenzelm@18466
    51
  fix x
wenzelm@18466
    52
  fix X assume r: "PROP A(x) ==> PROP B(x) ==> PROP X"
wenzelm@18466
    53
  show "PROP X"
wenzelm@18466
    54
  proof (rule r)
wenzelm@18466
    55
    show "PROP A(x)"
wenzelm@18466
    56
    proof (rule conj)
wenzelm@18466
    57
      assume "!!x. PROP A(x)"
wenzelm@18466
    58
      then show "PROP A(x)" .
wenzelm@18466
    59
    qed
wenzelm@18466
    60
    show "PROP B(x)"
wenzelm@18466
    61
    proof (rule conj)
wenzelm@18466
    62
      assume "!!x. PROP B(x)"
wenzelm@18466
    63
      then show "PROP B(x)" .
wenzelm@18466
    64
    qed
wenzelm@18466
    65
  qed
wenzelm@18466
    66
qed
wenzelm@18466
    67
wenzelm@18466
    68
lemma imp_conjunction [unfolded prop_def]:
wenzelm@18466
    69
  includes meta_conjunction_syntax
wenzelm@18466
    70
  shows "(PROP A ==> PROP prop (PROP B && PROP C)) == (PROP A ==> PROP B) && (PROP A ==> PROP C)"
wenzelm@18466
    71
proof (unfold prop_def, rule)
wenzelm@18466
    72
  assume conj: "PROP A ==> PROP B && PROP C"
wenzelm@18466
    73
  fix X assume r: "(PROP A ==> PROP B) ==> (PROP A ==> PROP C) ==> PROP X"
wenzelm@18466
    74
  show "PROP X"
wenzelm@18466
    75
  proof (rule r)
wenzelm@18466
    76
    assume "PROP A"
wenzelm@18466
    77
    from conj [OF `PROP A`] show "PROP B" .
wenzelm@18466
    78
    from conj [OF `PROP A`] show "PROP C" .
wenzelm@18466
    79
  qed
wenzelm@18466
    80
next
wenzelm@18466
    81
  assume conj: "(PROP A ==> PROP B) && (PROP A ==> PROP C)"
wenzelm@18466
    82
  assume "PROP A"
wenzelm@18466
    83
  fix X assume r: "PROP B ==> PROP C ==> PROP X"
wenzelm@18466
    84
  show "PROP X"
wenzelm@18466
    85
  proof (rule r)
wenzelm@18466
    86
    show "PROP B"
wenzelm@18466
    87
    proof (rule conj)
wenzelm@18466
    88
      assume "PROP A ==> PROP B"
wenzelm@18466
    89
      from this [OF `PROP A`] show "PROP B" .
wenzelm@18466
    90
    qed
wenzelm@18466
    91
    show "PROP C"
wenzelm@18466
    92
    proof (rule conj)
wenzelm@18466
    93
      assume "PROP A ==> PROP C"
wenzelm@18466
    94
      from this [OF `PROP A`] show "PROP C" .
wenzelm@18466
    95
    qed
wenzelm@18466
    96
  qed
wenzelm@18466
    97
qed
wenzelm@18466
    98
wenzelm@18466
    99
lemma conjunction_imp:
wenzelm@18466
   100
  includes meta_conjunction_syntax
wenzelm@18466
   101
  shows "(PROP A && PROP B ==> PROP C) == (PROP A ==> PROP B ==> PROP C)"
wenzelm@18466
   102
proof
wenzelm@18466
   103
  assume r: "PROP A && PROP B ==> PROP C"
wenzelm@18466
   104
  assume "PROP A" and "PROP B"
wenzelm@18466
   105
  show "PROP C" by (rule r) -
wenzelm@18466
   106
next
wenzelm@18466
   107
  assume r: "PROP A ==> PROP B ==> PROP C"
wenzelm@18466
   108
  assume conj: "PROP A && PROP B"
wenzelm@18466
   109
  show "PROP C"
wenzelm@18466
   110
  proof (rule r)
wenzelm@18466
   111
    from conj show "PROP A" .
wenzelm@18466
   112
    from conj show "PROP B" .
wenzelm@18466
   113
  qed
wenzelm@18466
   114
qed
wenzelm@18466
   115
wenzelm@18466
   116
lemma conjunction_assoc:
wenzelm@18466
   117
  includes meta_conjunction_syntax
wenzelm@18466
   118
  shows "((PROP A && PROP B) && PROP C) == (PROP A && (PROP B && PROP C))"
wenzelm@18466
   119
  by (rule equal_intr_rule) (unfold imp_conjunction conjunction_imp)
wenzelm@18466
   120
wenzelm@15803
   121
end