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