src/HOL/ex/PresburgerEx.thy
author webertj
Thu Jul 22 19:33:12 2004 +0200 (2004-07-22)
changeset 15075 a6cd1a454751
parent 14981 e73f8140af78
child 16417 9bc16273c2d4
permissions -rw-r--r--
minor formatting fixes
berghofe@13880
     1
(*  Title:      HOL/ex/PresburgerEx.thy
berghofe@13880
     2
    ID:         $Id$
berghofe@13880
     3
    Author:     Amine Chaieb, TU Muenchen
berghofe@13880
     4
berghofe@13880
     5
Some examples for Presburger Arithmetic
berghofe@13880
     6
*)
berghofe@13880
     7
berghofe@13880
     8
theory PresburgerEx = Main:
berghofe@13880
     9
paulson@14353
    10
theorem "(\<forall>(y::int). 3 dvd y) ==> \<forall>(x::int). b < x --> a \<le> x"
berghofe@13880
    11
  by presburger
berghofe@13880
    12
berghofe@13880
    13
theorem "!! (y::int) (z::int) (n::int). 3 dvd z ==> 2 dvd (y::int) ==>
paulson@14353
    14
  (\<exists>(x::int).  2*x =  y) & (\<exists>(k::int). 3*k = z)"
berghofe@13880
    15
  by presburger
berghofe@13880
    16
berghofe@13880
    17
theorem "!! (y::int) (z::int) n. Suc(n::nat) < 6 ==>  3 dvd z ==>
paulson@14353
    18
  2 dvd (y::int) ==> (\<exists>(x::int).  2*x =  y) & (\<exists>(k::int). 3*k = z)"
berghofe@13880
    19
  by presburger
berghofe@13880
    20
webertj@15075
    21
theorem "\<forall>(x::nat). \<exists>(y::nat). (0::nat) \<le> 5 --> y = 5 + x "
berghofe@13880
    22
  by presburger
berghofe@13880
    23
paulson@14353
    24
text{*Very slow: about 55 seconds on a 1.8GHz machine.*}
webertj@15075
    25
theorem "\<forall>(x::nat). \<exists>(y::nat). y = 5 + x | x div 6 + 1= 2"
webertj@15075
    26
  by presburger
webertj@15075
    27
webertj@15075
    28
theorem "\<exists>(x::int). 0 < x"
berghofe@13880
    29
  by presburger
berghofe@13880
    30
webertj@15075
    31
theorem "\<forall>(x::int) y. x < y --> 2 * x + 1 < 2 * y"
webertj@15075
    32
  by presburger
berghofe@13880
    33
 
webertj@15075
    34
theorem "\<forall>(x::int) y. 2 * x + 1 \<noteq> 2 * y"
webertj@15075
    35
  by presburger
berghofe@13880
    36
 
webertj@15075
    37
theorem "\<exists>(x::int) y. 0 < x  & 0 \<le> y  & 3 * x - 5 * y = 1"
webertj@15075
    38
  by presburger
berghofe@13880
    39
paulson@14353
    40
theorem "~ (\<exists>(x::int) (y::int) (z::int). 4*x + (-6::int)*y = 1)"
berghofe@13880
    41
  by presburger
berghofe@13880
    42
paulson@14353
    43
theorem "\<forall>(x::int). b < x --> a \<le> x"
chaieb@14758
    44
  apply (presburger (no_quantify))
berghofe@13880
    45
  oops
berghofe@13880
    46
paulson@14353
    47
theorem "~ (\<exists>(x::int). False)"
berghofe@13880
    48
  by presburger
berghofe@13880
    49
paulson@14353
    50
theorem "\<forall>(x::int). (a::int) < 3 * x --> b < 3 * x"
chaieb@14758
    51
  apply (presburger (no_quantify))
berghofe@13880
    52
  oops
berghofe@13880
    53
webertj@15075
    54
theorem "\<forall>(x::int). (2 dvd x) --> (\<exists>(y::int). x = 2*y)"
webertj@15075
    55
  by presburger 
berghofe@13880
    56
webertj@15075
    57
theorem "\<forall>(x::int). (2 dvd x) --> (\<exists>(y::int). x = 2*y)"
webertj@15075
    58
  by presburger 
berghofe@13880
    59
webertj@15075
    60
theorem "\<forall>(x::int). (2 dvd x) = (\<exists>(y::int). x = 2*y)"
webertj@15075
    61
  by presburger 
paulson@14353
    62
webertj@15075
    63
theorem "\<forall>(x::int). ((2 dvd x) = (\<forall>(y::int). x \<noteq> 2*y + 1))"
webertj@15075
    64
  by presburger 
berghofe@13880
    65
paulson@14353
    66
theorem "~ (\<forall>(x::int). 
paulson@14353
    67
            ((2 dvd x) = (\<forall>(y::int). x \<noteq> 2*y+1) | 
paulson@14353
    68
             (\<exists>(q::int) (u::int) i. 3*i + 2*q - u < 17)
paulson@14353
    69
             --> 0 < x | ((~ 3 dvd x) &(x + 8 = 0))))"
berghofe@13880
    70
  by presburger
berghofe@13880
    71
 
webertj@15075
    72
theorem "~ (\<forall>(i::int). 4 \<le> i --> (\<exists>x y. 0 \<le> x & 0 \<le> y & 3 * x + 5 * y = i))"
berghofe@13880
    73
  by presburger
berghofe@13880
    74
webertj@15075
    75
theorem "\<forall>(i::int). 8 \<le> i --> (\<exists>x y. 0 \<le> x & 0 \<le> y & 3 * x + 5 * y = i)"
paulson@14353
    76
  by presburger
berghofe@13880
    77
webertj@15075
    78
theorem "\<exists>(j::int). \<forall>i. j \<le> i --> (\<exists>x y. 0 \<le> x & 0 \<le> y & 3 * x + 5 * y = i)"
webertj@15075
    79
  by presburger
webertj@15075
    80
webertj@15075
    81
theorem "~ (\<forall>j (i::int). j \<le> i --> (\<exists>x y. 0 \<le> x & 0 \<le> y & 3 * x + 5 * y = i))"
berghofe@13880
    82
  by presburger
berghofe@13880
    83
paulson@14353
    84
text{*Very slow: about 80 seconds on a 1.8GHz machine.*}
webertj@15075
    85
theorem "(\<exists>m::nat. n = 2 * m) --> (n + 1) div 2 = n div 2"
webertj@15075
    86
  by presburger
berghofe@13880
    87
webertj@15075
    88
theorem "(\<exists>m::int. n = 2 * m) --> (n + 1) div 2 = n div 2"
webertj@15075
    89
  by presburger
berghofe@13880
    90
webertj@15075
    91
end