src/HOL/Data_Structures/Less_False.thy
author eberlm
Tue, 03 Nov 2015 11:20:21 +0100
changeset 61553 933eb9e6a1cc
parent 61203 a8a8eca85801
child 61640 44c9198f210c
permissions -rw-r--r--
Merged
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
61203
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     1
(* Author: Tobias Nipkow *)
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     2
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     3
section {* Improved Simproc for $<$ *}
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     4
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     5
theory Less_False
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     6
imports Main
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     7
begin
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     8
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
     9
simproc_setup less_False ("(x::'a::order) < y") = {* fn _ => fn ctxt => fn ct =>
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    10
  let
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    11
    fun prp t thm = Thm.full_prop_of thm aconv t;
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    12
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    13
    val eq_False_if_not = @{thm eq_False} RS iffD2
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    14
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    15
    fun prove_less_False ((less as Const(_,T)) $ r $ s) =
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    16
      let val prems = Simplifier.prems_of ctxt;
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    17
          val le = Const (@{const_name less_eq}, T);
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    18
          val t = HOLogic.mk_Trueprop(le $ s $ r);
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    19
      in case find_first (prp t) prems of
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    20
           NONE =>
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    21
             let val t = HOLogic.mk_Trueprop(less $ s $ r)
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    22
             in case find_first (prp t) prems of
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    23
                  NONE => NONE
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    24
                | SOME thm => SOME(mk_meta_eq((thm RS @{thm less_not_sym}) RS eq_False_if_not))
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    25
             end
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    26
         | SOME thm => NONE
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    27
      end;
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    28
  in prove_less_False (Thm.term_of ct) end
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    29
*}
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    30
a8a8eca85801 New subdirectory for functional data structures
nipkow
parents:
diff changeset
    31
end