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