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