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;
blanchet@54397
     1
(*  Title:      HOL/Ctr_Sugar.thy
blanchet@49486
     2
    Author:     Jasmin Blanchette, TU Muenchen
blanchet@55160
     3
    Author:     Dmitriy Traytel, TU Muenchen
blanchet@54397
     4
    Copyright   2012, 2013
blanchet@49075
     5
blanchet@51797
     6
Wrapping existing freely generated type's constructors.
blanchet@49075
     7
*)
blanchet@49075
     8
blanchet@51797
     9
header {* Wrapping Existing Freely Generated Type's Constructors *}
blanchet@49075
    10
blanchet@54006
    11
theory Ctr_Sugar
blanchet@54398
    12
imports HOL
blanchet@49075
    13
keywords
blanchet@54398
    14
  "print_case_translations" :: diag and
blanchet@55468
    15
  "free_constructors" :: thy_goal
blanchet@49075
    16
begin
blanchet@49075
    17
blanchet@54398
    18
consts
blanchet@54398
    19
  case_guard :: "bool \<Rightarrow> 'a \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'b"
blanchet@54398
    20
  case_nil :: "'a \<Rightarrow> 'b"
blanchet@54398
    21
  case_cons :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b"
blanchet@54398
    22
  case_elem :: "'a \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'b"
blanchet@54398
    23
  case_abs :: "('c \<Rightarrow> 'b) \<Rightarrow> 'b"
blanchet@54398
    24
declare [[coercion_args case_guard - + -]]
blanchet@54398
    25
declare [[coercion_args case_cons - -]]
blanchet@54398
    26
declare [[coercion_args case_abs -]]
blanchet@54398
    27
declare [[coercion_args case_elem - +]]
blanchet@54398
    28
blanchet@54701
    29
ML_file "Tools/Ctr_Sugar/case_translation.ML"
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@54701
    39
ML_file "Tools/Ctr_Sugar/ctr_sugar_util.ML"
blanchet@54701
    40
ML_file "Tools/Ctr_Sugar/ctr_sugar_tactics.ML"
blanchet@54701
    41
ML_file "Tools/Ctr_Sugar/ctr_sugar_code.ML"
blanchet@54701
    42
ML_file "Tools/Ctr_Sugar/ctr_sugar.ML"
blanchet@49309
    43
blanchet@49075
    44
end