src/Pure/Pure.thy
author wenzelm
Tue, 19 Feb 2013 21:44:37 +0100
changeset 52361 c3e99efacb67
parent 51618 3e3c2af5e8a5
child 52407 17d30843fc3b
permissions -rw-r--r--
back to non-schematic 'sublocale' and 'interpretation' (despite df8fc0567a3d) for more potential parallelism;
wenzelm@49944
     1
(*  Title:      Pure/Pure.thy
wenzelm@49944
     2
    Author:     Makarius
wenzelm@49944
     3
wenzelm@49944
     4
Final stage of bootstrapping Pure, based on implicit background theory.
wenzelm@49944
     5
*)
wenzelm@49944
     6
wenzelm@49653
     7
theory Pure
wenzelm@49656
     8
  keywords
wenzelm@49656
     9
    "!!" "!" "%" "(" ")" "+" "," "--" ":" "::" ";" "<" "<=" "=" "=="
wenzelm@49656
    10
    "=>" "?" "[" "\<equiv>" "\<leftharpoondown>" "\<rightharpoonup>"
wenzelm@49656
    11
    "\<rightleftharpoons>" "\<subseteq>" "]" "advanced" "and" "assumes"
wenzelm@49656
    12
    "attach" "begin" "binder" "constrains" "defines" "fixes" "for"
wenzelm@49656
    13
    "identifier" "if" "imports" "in" "includes" "infix" "infixl"
wenzelm@49656
    14
    "infixr" "is" "keywords" "notes" "obtains" "open" "output"
wenzelm@49656
    15
    "overloaded" "pervasive" "shows" "structure" "unchecked" "uses"
wenzelm@49656
    16
    "where" "|"
wenzelm@49656
    17
  and "header" :: diag
wenzelm@49656
    18
  and "chapter" :: thy_heading1
wenzelm@49656
    19
  and "section" :: thy_heading2
wenzelm@49656
    20
  and "subsection" :: thy_heading3
wenzelm@49656
    21
  and "subsubsection" :: thy_heading4
wenzelm@49656
    22
  and "text" "text_raw" :: thy_decl
wenzelm@49656
    23
  and "sect" :: prf_heading2 % "proof"
wenzelm@49656
    24
  and "subsect" :: prf_heading3 % "proof"
wenzelm@49656
    25
  and "subsubsect" :: prf_heading4 % "proof"
wenzelm@49656
    26
  and "txt" "txt_raw" :: prf_decl % "proof"
wenzelm@49656
    27
  and "classes" "classrel" "default_sort" "typedecl" "type_synonym"
wenzelm@49656
    28
    "nonterminal" "arities" "judgment" "consts" "syntax" "no_syntax"
wenzelm@49656
    29
    "translations" "no_translations" "axioms" "defs" "definition"
wenzelm@49656
    30
    "abbreviation" "type_notation" "no_type_notation" "notation"
wenzelm@49656
    31
    "no_notation" "axiomatization" "theorems" "lemmas" "declare"
wenzelm@49656
    32
    "hide_class" "hide_type" "hide_const" "hide_fact" :: thy_decl
wenzelm@49656
    33
  and "use" "ML" :: thy_decl % "ML"
wenzelm@49656
    34
  and "ML_prf" :: prf_decl % "proof"  (* FIXME % "ML" ?? *)
wenzelm@49656
    35
  and "ML_val" "ML_command" :: diag % "ML"
wenzelm@49656
    36
  and "setup" "local_setup" "attribute_setup" "method_setup"
wenzelm@49656
    37
    "declaration" "syntax_declaration" "simproc_setup"
wenzelm@49656
    38
    "parse_ast_translation" "parse_translation" "print_translation"
wenzelm@49656
    39
    "typed_print_translation" "print_ast_translation" "oracle" :: thy_decl % "ML"
wenzelm@49656
    40
  and "bundle" :: thy_decl
wenzelm@49656
    41
  and "include" "including" :: prf_decl
wenzelm@49656
    42
  and "print_bundles" :: diag
wenzelm@49656
    43
  and "context" "locale" :: thy_decl
wenzelm@52361
    44
  and "sublocale" "interpretation" :: thy_goal
wenzelm@52361
    45
  and "interpret" :: prf_goal % "proof"
wenzelm@49656
    46
  and "class" :: thy_decl
wenzelm@49656
    47
  and "subclass" :: thy_goal
wenzelm@49656
    48
  and "instantiation" :: thy_decl
wenzelm@49656
    49
  and "instance" :: thy_goal
wenzelm@49656
    50
  and "overloading" :: thy_decl
wenzelm@49656
    51
  and "code_datatype" :: thy_decl
wenzelm@49656
    52
  and "theorem" "lemma" "corollary" :: thy_goal
wenzelm@49656
    53
  and "schematic_theorem" "schematic_lemma" "schematic_corollary" :: thy_schematic_goal
wenzelm@49656
    54
  and "notepad" :: thy_decl
wenzelm@51143
    55
  and "have" :: prf_goal % "proof"
wenzelm@51143
    56
  and "hence" :: prf_goal % "proof" == "then have"
wenzelm@51143
    57
  and "show" :: prf_asm_goal % "proof"
wenzelm@51143
    58
  and "thus" :: prf_asm_goal % "proof" == "then show"
wenzelm@49656
    59
  and "then" "from" "with" :: prf_chain % "proof"
wenzelm@49656
    60
  and "note" "using" "unfolding" :: prf_decl % "proof"
wenzelm@49656
    61
  and "fix" "assume" "presume" "def" :: prf_asm % "proof"
wenzelm@49656
    62
  and "obtain" "guess" :: prf_asm_goal % "proof"
wenzelm@49656
    63
  and "let" "write" :: prf_decl % "proof"
wenzelm@49656
    64
  and "case" :: prf_asm % "proof"
wenzelm@49656
    65
  and "{" :: prf_open % "proof"
wenzelm@49656
    66
  and "}" :: prf_close % "proof"
wenzelm@49656
    67
  and "next" :: prf_block % "proof"
wenzelm@49656
    68
  and "qed" :: qed_block % "proof"
wenzelm@49656
    69
  and "by" ".." "." "done" "sorry" :: "qed" % "proof"
wenzelm@49656
    70
  and "oops" :: qed_global % "proof"
wenzelm@51143
    71
  and "defer" "prefer" "apply" :: prf_script % "proof"
wenzelm@51143
    72
  and "apply_end" :: prf_script % "proof" == ""
wenzelm@49656
    73
  and "proof" :: prf_block % "proof"
wenzelm@49656
    74
  and "also" "moreover" :: prf_decl % "proof"
wenzelm@49656
    75
  and "finally" "ultimately" :: prf_chain % "proof"
wenzelm@49656
    76
  and "back" :: prf_script % "proof"
wenzelm@49656
    77
  and "Isabelle.command" :: control
wenzelm@49656
    78
  and "pretty_setmargin" "help" "print_commands" "print_configs"
wenzelm@49656
    79
    "print_context" "print_theory" "print_syntax" "print_abbrevs"
wenzelm@49656
    80
    "print_theorems" "print_locales" "print_classes" "print_locale"
wenzelm@49656
    81
    "print_interps" "print_dependencies" "print_attributes"
wenzelm@49656
    82
    "print_simpset" "print_rules" "print_trans_rules" "print_methods"
wenzelm@50584
    83
    "print_antiquotations" "thy_deps" "locale_deps" "class_deps" "thm_deps"
wenzelm@49656
    84
    "print_binds" "print_facts" "print_cases" "print_statement" "thm"
wenzelm@49656
    85
    "prf" "full_prf" "prop" "term" "typ" "print_codesetup" "unused_thms"
wenzelm@49656
    86
    :: diag
wenzelm@49656
    87
  and "cd" :: control
wenzelm@49656
    88
  and "pwd" :: diag
wenzelm@49656
    89
  and "use_thy" "remove_thy" "kill_thy" :: control
wenzelm@49656
    90
  and "display_drafts" "print_drafts" "pr" :: diag
wenzelm@49656
    91
  and "disable_pr" "enable_pr" "commit" "quit" "exit" :: control
wenzelm@49661
    92
  and "welcome" :: diag
wenzelm@49661
    93
  and "init_toplevel" "linear_undo" "undo" "undos_proof" "cannot_undo" "kill" :: control
wenzelm@49656
    94
  and "end" :: thy_end % "theory"
wenzelm@49661
    95
  and "realizers" "realizability" "extract_type" "extract" :: thy_decl
wenzelm@49661
    96
  and "find_theorems" "find_consts" :: diag
wenzelm@49653
    97
begin
wenzelm@15803
    98
wenzelm@49906
    99
ML_file "Isar/isar_syn.ML"
wenzelm@49906
   100
ML_file "Tools/find_theorems.ML"
wenzelm@49906
   101
ML_file "Tools/find_consts.ML"
wenzelm@49906
   102
wenzelm@49906
   103
wenzelm@26435
   104
section {* Further content for the Pure theory *}
wenzelm@20627
   105
wenzelm@18466
   106
subsection {* Meta-level connectives in assumptions *}
wenzelm@15803
   107
wenzelm@15803
   108
lemma meta_mp:
wenzelm@18019
   109
  assumes "PROP P ==> PROP Q" and "PROP P"
wenzelm@15803
   110
  shows "PROP Q"
wenzelm@18019
   111
    by (rule `PROP P ==> PROP Q` [OF `PROP P`])
wenzelm@15803
   112
nipkow@23432
   113
lemmas meta_impE = meta_mp [elim_format]
nipkow@23432
   114
wenzelm@15803
   115
lemma meta_spec:
wenzelm@26958
   116
  assumes "!!x. PROP P x"
wenzelm@26958
   117
  shows "PROP P x"
wenzelm@26958
   118
    by (rule `!!x. PROP P x`)
wenzelm@15803
   119
wenzelm@15803
   120
lemmas meta_allE = meta_spec [elim_format]
wenzelm@15803
   121
wenzelm@26570
   122
lemma swap_params:
wenzelm@26958
   123
  "(!!x y. PROP P x y) == (!!y x. PROP P x y)" ..
wenzelm@26570
   124
wenzelm@18466
   125
wenzelm@18466
   126
subsection {* Meta-level conjunction *}
wenzelm@18466
   127
wenzelm@18466
   128
lemma all_conjunction:
wenzelm@28856
   129
  "(!!x. PROP A x &&& PROP B x) == ((!!x. PROP A x) &&& (!!x. PROP B x))"
wenzelm@18466
   130
proof
wenzelm@28856
   131
  assume conj: "!!x. PROP A x &&& PROP B x"
wenzelm@28856
   132
  show "(!!x. PROP A x) &&& (!!x. PROP B x)"
wenzelm@19121
   133
  proof -
wenzelm@18466
   134
    fix x
wenzelm@26958
   135
    from conj show "PROP A x" by (rule conjunctionD1)
wenzelm@26958
   136
    from conj show "PROP B x" by (rule conjunctionD2)
wenzelm@18466
   137
  qed
wenzelm@18466
   138
next
wenzelm@28856
   139
  assume conj: "(!!x. PROP A x) &&& (!!x. PROP B x)"
wenzelm@18466
   140
  fix x
wenzelm@28856
   141
  show "PROP A x &&& PROP B x"
wenzelm@19121
   142
  proof -
wenzelm@26958
   143
    show "PROP A x" by (rule conj [THEN conjunctionD1, rule_format])
wenzelm@26958
   144
    show "PROP B x" by (rule conj [THEN conjunctionD2, rule_format])
wenzelm@18466
   145
  qed
wenzelm@18466
   146
qed
wenzelm@18466
   147
wenzelm@19121
   148
lemma imp_conjunction:
nipkow@51618
   149
  "(PROP A ==> PROP B &&& PROP C) == ((PROP A ==> PROP B) &&& (PROP A ==> PROP C))"
wenzelm@18836
   150
proof
wenzelm@28856
   151
  assume conj: "PROP A ==> PROP B &&& PROP C"
wenzelm@28856
   152
  show "(PROP A ==> PROP B) &&& (PROP A ==> PROP C)"
wenzelm@19121
   153
  proof -
wenzelm@18466
   154
    assume "PROP A"
wenzelm@19121
   155
    from conj [OF `PROP A`] show "PROP B" by (rule conjunctionD1)
wenzelm@19121
   156
    from conj [OF `PROP A`] show "PROP C" by (rule conjunctionD2)
wenzelm@18466
   157
  qed
wenzelm@18466
   158
next
wenzelm@28856
   159
  assume conj: "(PROP A ==> PROP B) &&& (PROP A ==> PROP C)"
wenzelm@18466
   160
  assume "PROP A"
wenzelm@28856
   161
  show "PROP B &&& PROP C"
wenzelm@19121
   162
  proof -
wenzelm@19121
   163
    from `PROP A` show "PROP B" by (rule conj [THEN conjunctionD1])
wenzelm@19121
   164
    from `PROP A` show "PROP C" by (rule conj [THEN conjunctionD2])
wenzelm@18466
   165
  qed
wenzelm@18466
   166
qed
wenzelm@18466
   167
wenzelm@18466
   168
lemma conjunction_imp:
wenzelm@28856
   169
  "(PROP A &&& PROP B ==> PROP C) == (PROP A ==> PROP B ==> PROP C)"
wenzelm@18466
   170
proof
wenzelm@28856
   171
  assume r: "PROP A &&& PROP B ==> PROP C"
wenzelm@22933
   172
  assume ab: "PROP A" "PROP B"
wenzelm@22933
   173
  show "PROP C"
wenzelm@22933
   174
  proof (rule r)
wenzelm@28856
   175
    from ab show "PROP A &&& PROP B" .
wenzelm@22933
   176
  qed
wenzelm@18466
   177
next
wenzelm@18466
   178
  assume r: "PROP A ==> PROP B ==> PROP C"
wenzelm@28856
   179
  assume conj: "PROP A &&& PROP B"
wenzelm@18466
   180
  show "PROP C"
wenzelm@18466
   181
  proof (rule r)
wenzelm@19121
   182
    from conj show "PROP A" by (rule conjunctionD1)
wenzelm@19121
   183
    from conj show "PROP B" by (rule conjunctionD2)
wenzelm@18466
   184
  qed
wenzelm@18466
   185
qed
wenzelm@18466
   186
wenzelm@49653
   187
end
wenzelm@49653
   188