src/HOL/Ctr_Sugar.thy
author wenzelm
Fri Mar 07 10:22:27 2014 +0100 (2014-03-07)
changeset 55971 7644d63e8c3f
parent 55468 98b25c51e9e5
child 57631 959caab43a3d
permissions -rw-r--r--
modernized theory setup;
     1 (*  Title:      HOL/Ctr_Sugar.thy
     2     Author:     Jasmin Blanchette, TU Muenchen
     3     Author:     Dmitriy Traytel, TU Muenchen
     4     Copyright   2012, 2013
     5 
     6 Wrapping existing freely generated type's constructors.
     7 *)
     8 
     9 header {* Wrapping Existing Freely Generated Type's Constructors *}
    10 
    11 theory Ctr_Sugar
    12 imports HOL
    13 keywords
    14   "print_case_translations" :: diag and
    15   "free_constructors" :: thy_goal
    16 begin
    17 
    18 consts
    19   case_guard :: "bool \<Rightarrow> 'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b"
    20   case_nil :: "'a \<Rightarrow> 'b"
    21   case_cons :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
    22   case_elem :: "'a \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'b"
    23   case_abs :: "('c \<Rightarrow> 'b) \<Rightarrow> 'b"
    24 declare [[coercion_args case_guard - + -]]
    25 declare [[coercion_args case_cons - -]]
    26 declare [[coercion_args case_abs -]]
    27 declare [[coercion_args case_elem - +]]
    28 
    29 ML_file "Tools/Ctr_Sugar/case_translation.ML"
    30 
    31 lemma iffI_np: "\<lbrakk>x \<Longrightarrow> \<not> y; \<not> x \<Longrightarrow> y\<rbrakk> \<Longrightarrow> \<not> x \<longleftrightarrow> y"
    32 by (erule iffI) (erule contrapos_pn)
    33 
    34 lemma iff_contradict:
    35 "\<not> P \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> Q \<Longrightarrow> R"
    36 "\<not> Q \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> P \<Longrightarrow> R"
    37 by blast+
    38 
    39 ML_file "Tools/Ctr_Sugar/ctr_sugar_util.ML"
    40 ML_file "Tools/Ctr_Sugar/ctr_sugar_tactics.ML"
    41 ML_file "Tools/Ctr_Sugar/ctr_sugar_code.ML"
    42 ML_file "Tools/Ctr_Sugar/ctr_sugar.ML"
    43 
    44 end