src/Pure/Pure.thy
author wenzelm
Thu, 27 Mar 2008 14:41:12 +0100
changeset 26426 ddac7ef1e991
parent 23824 8ad7131dbfcf
child 26435 bdce320cd426
permissions -rw-r--r--
reduced to theory body (cf. OuterSyntax.process_file);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/Pure.thy
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
     3
*)
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
     4
26426
ddac7ef1e991 reduced to theory body (cf. OuterSyntax.process_file);
wenzelm
parents: 23824
diff changeset
     5
section {* The Pure theory *}
19800
5f764272183e removed Toplevel.debug;
wenzelm
parents: 19783
diff changeset
     6
19048
2b875dd5eb4c cannot use section before setup;
wenzelm
parents: 18836
diff changeset
     7
setup  -- {* Common setup of internal components *}
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
     8
20627
30da2841553e revert to previous version;
wenzelm
parents: 20596
diff changeset
     9
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    10
subsection {* Meta-level connectives in assumptions *}
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    11
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    12
lemma meta_mp:
18019
wenzelm
parents: 15824
diff changeset
    13
  assumes "PROP P ==> PROP Q" and "PROP P"
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    14
  shows "PROP Q"
18019
wenzelm
parents: 15824
diff changeset
    15
    by (rule `PROP P ==> PROP Q` [OF `PROP P`])
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    16
23432
cec811764a38 added meta_impE
nipkow
parents: 22933
diff changeset
    17
lemmas meta_impE = meta_mp [elim_format]
cec811764a38 added meta_impE
nipkow
parents: 22933
diff changeset
    18
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    19
lemma meta_spec:
18019
wenzelm
parents: 15824
diff changeset
    20
  assumes "!!x. PROP P(x)"
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    21
  shows "PROP P(x)"
18019
wenzelm
parents: 15824
diff changeset
    22
    by (rule `!!x. PROP P(x)`)
15803
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    23
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    24
lemmas meta_allE = meta_spec [elim_format]
42c75e0c9140 The Pure theory.
wenzelm
parents:
diff changeset
    25
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    26
21625
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    27
subsection {* Embedded terms *}
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    28
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    29
locale (open) meta_term_syntax =
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    30
  fixes meta_term :: "'a => prop"  ("TERM _")
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    31
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    32
lemmas [intro?] = termI
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    33
fa8a7de5da28 added some support for embedded terms;
wenzelm
parents: 20627
diff changeset
    34
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    35
subsection {* Meta-level conjunction *}
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    36
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    37
locale (open) meta_conjunction_syntax =
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    38
  fixes meta_conjunction :: "prop => prop => prop"  (infixr "&&" 2)
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    39
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    40
lemma all_conjunction:
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    41
  includes meta_conjunction_syntax
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    42
  shows "(!!x. PROP A(x) && PROP B(x)) == ((!!x. PROP A(x)) && (!!x. PROP B(x)))"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    43
proof
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    44
  assume conj: "!!x. PROP A(x) && PROP B(x)"
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    45
  show "(\<And>x. PROP A(x)) && (\<And>x. PROP B(x))"
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    46
  proof -
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    47
    fix x
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    48
    from conj show "PROP A(x)" by (rule conjunctionD1)
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    49
    from conj show "PROP B(x)" by (rule conjunctionD2)
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    50
  qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    51
next
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    52
  assume conj: "(!!x. PROP A(x)) && (!!x. PROP B(x))"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    53
  fix x
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    54
  show "PROP A(x) && PROP B(x)"
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    55
  proof -
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    56
    show "PROP A(x)" by (rule conj [THEN conjunctionD1, rule_format])
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    57
    show "PROP B(x)" by (rule conj [THEN conjunctionD2, rule_format])
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    58
  qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    59
qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    60
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    61
lemma imp_conjunction:
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    62
  includes meta_conjunction_syntax
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    63
  shows "(PROP A ==> PROP B && PROP C) == (PROP A ==> PROP B) && (PROP A ==> PROP C)"
18836
3a1e4ee72075 tuned proofs;
wenzelm
parents: 18710
diff changeset
    64
proof
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    65
  assume conj: "PROP A ==> PROP B && PROP C"
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    66
  show "(PROP A ==> PROP B) && (PROP A ==> PROP C)"
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    67
  proof -
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    68
    assume "PROP A"
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    69
    from conj [OF `PROP A`] show "PROP B" by (rule conjunctionD1)
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    70
    from conj [OF `PROP A`] show "PROP C" by (rule conjunctionD2)
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    71
  qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    72
next
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    73
  assume conj: "(PROP A ==> PROP B) && (PROP A ==> PROP C)"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    74
  assume "PROP A"
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    75
  show "PROP B && PROP C"
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    76
  proof -
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    77
    from `PROP A` show "PROP B" by (rule conj [THEN conjunctionD1])
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    78
    from `PROP A` show "PROP C" by (rule conj [THEN conjunctionD2])
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    79
  qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    80
qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    81
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    82
lemma conjunction_imp:
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    83
  includes meta_conjunction_syntax
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    84
  shows "(PROP A && PROP B ==> PROP C) == (PROP A ==> PROP B ==> PROP C)"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    85
proof
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    86
  assume r: "PROP A && PROP B ==> PROP C"
22933
338c7890c96f tuned proofs;
wenzelm
parents: 21627
diff changeset
    87
  assume ab: "PROP A" "PROP B"
338c7890c96f tuned proofs;
wenzelm
parents: 21627
diff changeset
    88
  show "PROP C"
338c7890c96f tuned proofs;
wenzelm
parents: 21627
diff changeset
    89
  proof (rule r)
338c7890c96f tuned proofs;
wenzelm
parents: 21627
diff changeset
    90
    from ab show "PROP A && PROP B" .
338c7890c96f tuned proofs;
wenzelm
parents: 21627
diff changeset
    91
  qed
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    92
next
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    93
  assume r: "PROP A ==> PROP B ==> PROP C"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    94
  assume conj: "PROP A && PROP B"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    95
  show "PROP C"
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    96
  proof (rule r)
19121
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    97
    from conj show "PROP A" by (rule conjunctionD1)
d7fd5415a781 simplified Pure conjunction;
wenzelm
parents: 19048
diff changeset
    98
    from conj show "PROP B" by (rule conjunctionD2)
18466
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
    99
  qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
   100
qed
389a6f9c31f4 added locale meta_conjunction_syntax and various conjunction rules;
wenzelm
parents: 18019
diff changeset
   101