src/HOL/Ctr_Sugar.thy
author haftmann
Sun Oct 08 22:28:22 2017 +0200 (22 months ago)
changeset 66816 212a3334e7da
parent 64430 1d85ac286c72
child 69605 a96320074298
permissions -rw-r--r--
more fundamental definition of div and mod on int
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
wenzelm@60758
     9
section \<open>Wrapping Existing Freely Generated Type's Constructors\<close>
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@57631
    24
blanchet@54398
    25
declare [[coercion_args case_guard - + -]]
blanchet@54398
    26
declare [[coercion_args case_cons - -]]
blanchet@54398
    27
declare [[coercion_args case_abs -]]
blanchet@54398
    28
declare [[coercion_args case_elem - +]]
blanchet@54398
    29
blanchet@54701
    30
ML_file "Tools/Ctr_Sugar/case_translation.ML"
blanchet@54398
    31
blanchet@49312
    32
lemma iffI_np: "\<lbrakk>x \<Longrightarrow> \<not> y; \<not> x \<Longrightarrow> y\<rbrakk> \<Longrightarrow> \<not> x \<longleftrightarrow> y"
blanchet@58188
    33
  by (erule iffI) (erule contrapos_pn)
blanchet@49312
    34
blanchet@49486
    35
lemma iff_contradict:
blanchet@58188
    36
  "\<not> P \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> Q \<Longrightarrow> R"
blanchet@58188
    37
  "\<not> Q \<Longrightarrow> P \<longleftrightarrow> Q \<Longrightarrow> P \<Longrightarrow> R"
blanchet@58188
    38
  by blast+
blanchet@49486
    39
blanchet@54701
    40
ML_file "Tools/Ctr_Sugar/ctr_sugar_util.ML"
blanchet@54701
    41
ML_file "Tools/Ctr_Sugar/ctr_sugar_tactics.ML"
blanchet@54701
    42
ML_file "Tools/Ctr_Sugar/ctr_sugar_code.ML"
blanchet@54701
    43
ML_file "Tools/Ctr_Sugar/ctr_sugar.ML"
blanchet@49309
    44
blanchet@64430
    45
text \<open>Coinduction method that avoids some boilerplate compared with coinduct.\<close>
wenzelm@63655
    46
wenzelm@63655
    47
ML_file "Tools/coinduction.ML"
wenzelm@63655
    48
blanchet@49075
    49
end