src/HOL/Ctr_Sugar.thy
author blanchet
Mon Dec 02 20:31:54 2013 +0100 (2013-12-02)
changeset 54626 8a5e82425e55
parent 54615 62fb5af93fe2
child 54701 4ed7454aebde
permissions -rw-r--r--
added 'no_code' option
blanchet@54397
     1
(*  Title:      HOL/Ctr_Sugar.thy
blanchet@49486
     2
    Author:     Jasmin Blanchette, TU Muenchen
blanchet@54397
     3
    Copyright   2012, 2013
blanchet@49075
     4
blanchet@51797
     5
Wrapping existing freely generated type's constructors.
blanchet@49075
     6
*)
blanchet@49075
     7
blanchet@51797
     8
header {* Wrapping Existing Freely Generated Type's Constructors *}
blanchet@49075
     9
blanchet@54006
    10
theory Ctr_Sugar
blanchet@54398
    11
imports HOL
blanchet@49075
    12
keywords
blanchet@54398
    13
  "print_case_translations" :: diag and
blanchet@54626
    14
  "wrap_free_constructors" :: thy_goal
blanchet@49075
    15
begin
blanchet@49075
    16
blanchet@54398
    17
consts
blanchet@54398
    18
  case_guard :: "bool \<Rightarrow> 'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b"
blanchet@54398
    19
  case_nil :: "'a \<Rightarrow> 'b"
blanchet@54398
    20
  case_cons :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
blanchet@54398
    21
  case_elem :: "'a \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'b"
blanchet@54398
    22
  case_abs :: "('c \<Rightarrow> 'b) \<Rightarrow> 'b"
blanchet@54398
    23
declare [[coercion_args case_guard - + -]]
blanchet@54398
    24
declare [[coercion_args case_cons - -]]
blanchet@54398
    25
declare [[coercion_args case_abs -]]
blanchet@54398
    26
declare [[coercion_args case_elem - +]]
blanchet@54398
    27
blanchet@54398
    28
ML_file "Tools/case_translation.ML"
blanchet@54398
    29
setup Case_Translation.setup
blanchet@54398
    30
blanchet@49312
    31
lemma iffI_np: "\<lbrakk>x \<Longrightarrow> \<not> y; \<not> x \<Longrightarrow> y\<rbrakk> \<Longrightarrow> \<not> x \<longleftrightarrow> y"
blanchet@49312
    32
by (erule iffI) (erule contrapos_pn)
blanchet@49312
    33
blanchet@49486
    34
lemma iff_contradict:
blanchet@49486
    35
"\<not> P \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> Q \<Longrightarrow> R"
blanchet@49486
    36
"\<not> Q \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> P \<Longrightarrow> R"
blanchet@49486
    37
by blast+
blanchet@49486
    38
blanchet@54008
    39
ML_file "Tools/ctr_sugar_util.ML"
blanchet@54007
    40
ML_file "Tools/ctr_sugar_tactics.ML"
blanchet@54615
    41
ML_file "Tools/ctr_sugar_code.ML"
blanchet@54007
    42
ML_file "Tools/ctr_sugar.ML"
blanchet@49309
    43
blanchet@49075
    44
end