src/HOL/Ctr_Sugar.thy
author paulson <lp15@cam.ac.uk>
Mon Feb 22 14:37:56 2016 +0000 (2016-02-22)
changeset 62379 340738057c8c
parent 60758 d8d85a8172b5
child 63655 d31650b377c4
permissions -rw-r--r--
An assortment of useful lemmas about sums, norm, etc. Also: norm_conv_dist [symmetric] is now a simprule!
     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 section \<open>Wrapping Existing Freely Generated Type's Constructors\<close>
    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/ctr_sugar_util.ML"
    41 ML_file "Tools/Ctr_Sugar/ctr_sugar_tactics.ML"
    42 ML_file "Tools/Ctr_Sugar/ctr_sugar_code.ML"
    43 ML_file "Tools/Ctr_Sugar/ctr_sugar.ML"
    44 
    45 end