src/HOL/Ctr_Sugar.thy
author blanchet
Fri Sep 05 00:41:01 2014 +0200 (2014-09-05)
changeset 58188 cc71d2be4f0a
parent 58177 166131276380
child 58659 6c9821c32dd5
permissions -rw-r--r--
introduced mechanism to filter interpretations
     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 
    25 declare [[coercion_args case_guard - + -]]
    26 declare [[coercion_args case_cons - -]]
    27 declare [[coercion_args case_abs -]]
    28 declare [[coercion_args case_elem - +]]
    29 
    30 ML_file "Tools/Ctr_Sugar/case_translation.ML"
    31 
    32 lemma iffI_np: "\<lbrakk>x \<Longrightarrow> \<not> y; \<not> x \<Longrightarrow> y\<rbrakk> \<Longrightarrow> \<not> x \<longleftrightarrow> y"
    33   by (erule iffI) (erule contrapos_pn)
    34 
    35 lemma iff_contradict:
    36   "\<not> P \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> Q \<Longrightarrow> R"
    37   "\<not> Q \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> P \<Longrightarrow> R"
    38   by blast+
    39 
    40 ML_file "Tools/Ctr_Sugar/local_interpretation.ML"
    41 ML_file "Tools/Ctr_Sugar/ctr_sugar_util.ML"
    42 ML_file "Tools/Ctr_Sugar/ctr_sugar_tactics.ML"
    43 ML_file "Tools/Ctr_Sugar/ctr_sugar_code.ML"
    44 ML_file "Tools/Ctr_Sugar/ctr_sugar.ML"
    45 
    46 end