src/HOL/Import/HOL/HOL4Real.thy
changeset 35416 d8d7d1b785af
parent 26086 3c243098b64a
child 44763 b50d5d694838
equal deleted inserted replaced
35342:4dc65845eab3 35416:d8d7d1b785af
    37 
    37 
    38 lemma HREAL_LT_LADD: "ALL (x::hreal) (y::hreal) z::hreal.
    38 lemma HREAL_LT_LADD: "ALL (x::hreal) (y::hreal) z::hreal.
    39    hreal_lt (hreal_add x y) (hreal_add x z) = hreal_lt y z"
    39    hreal_lt (hreal_add x y) (hreal_add x z) = hreal_lt y z"
    40   by (import realax HREAL_LT_LADD)
    40   by (import realax HREAL_LT_LADD)
    41 
    41 
    42 constdefs
    42 definition treal_0 :: "hreal * hreal" where 
    43   treal_0 :: "hreal * hreal" 
       
    44   "treal_0 == (hreal_1, hreal_1)"
    43   "treal_0 == (hreal_1, hreal_1)"
    45 
    44 
    46 lemma treal_0: "treal_0 = (hreal_1, hreal_1)"
    45 lemma treal_0: "treal_0 = (hreal_1, hreal_1)"
    47   by (import realax treal_0)
    46   by (import realax treal_0)
    48 
    47 
    49 constdefs
    48 definition treal_1 :: "hreal * hreal" where 
    50   treal_1 :: "hreal * hreal" 
       
    51   "treal_1 == (hreal_add hreal_1 hreal_1, hreal_1)"
    49   "treal_1 == (hreal_add hreal_1 hreal_1, hreal_1)"
    52 
    50 
    53 lemma treal_1: "treal_1 = (hreal_add hreal_1 hreal_1, hreal_1)"
    51 lemma treal_1: "treal_1 = (hreal_add hreal_1 hreal_1, hreal_1)"
    54   by (import realax treal_1)
    52   by (import realax treal_1)
    55 
    53 
    56 constdefs
    54 definition treal_neg :: "hreal * hreal => hreal * hreal" where 
    57   treal_neg :: "hreal * hreal => hreal * hreal" 
       
    58   "treal_neg == %(x::hreal, y::hreal). (y, x)"
    55   "treal_neg == %(x::hreal, y::hreal). (y, x)"
    59 
    56 
    60 lemma treal_neg: "ALL (x::hreal) y::hreal. treal_neg (x, y) = (y, x)"
    57 lemma treal_neg: "ALL (x::hreal) y::hreal. treal_neg (x, y) = (y, x)"
    61   by (import realax treal_neg)
    58   by (import realax treal_neg)
    62 
    59 
    63 constdefs
    60 definition treal_add :: "hreal * hreal => hreal * hreal => hreal * hreal" where 
    64   treal_add :: "hreal * hreal => hreal * hreal => hreal * hreal" 
       
    65   "treal_add ==
    61   "treal_add ==
    66 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
    62 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
    67    (hreal_add x1 x2, hreal_add y1 y2)"
    63    (hreal_add x1 x2, hreal_add y1 y2)"
    68 
    64 
    69 lemma treal_add: "ALL (x1::hreal) (y1::hreal) (x2::hreal) y2::hreal.
    65 lemma treal_add: "ALL (x1::hreal) (y1::hreal) (x2::hreal) y2::hreal.
    70    treal_add (x1, y1) (x2, y2) = (hreal_add x1 x2, hreal_add y1 y2)"
    66    treal_add (x1, y1) (x2, y2) = (hreal_add x1 x2, hreal_add y1 y2)"
    71   by (import realax treal_add)
    67   by (import realax treal_add)
    72 
    68 
    73 constdefs
    69 definition treal_mul :: "hreal * hreal => hreal * hreal => hreal * hreal" where 
    74   treal_mul :: "hreal * hreal => hreal * hreal => hreal * hreal" 
       
    75   "treal_mul ==
    70   "treal_mul ==
    76 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
    71 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
    77    (hreal_add (hreal_mul x1 x2) (hreal_mul y1 y2),
    72    (hreal_add (hreal_mul x1 x2) (hreal_mul y1 y2),
    78     hreal_add (hreal_mul x1 y2) (hreal_mul y1 x2))"
    73     hreal_add (hreal_mul x1 y2) (hreal_mul y1 x2))"
    79 
    74 
    81    treal_mul (x1, y1) (x2, y2) =
    76    treal_mul (x1, y1) (x2, y2) =
    82    (hreal_add (hreal_mul x1 x2) (hreal_mul y1 y2),
    77    (hreal_add (hreal_mul x1 x2) (hreal_mul y1 y2),
    83     hreal_add (hreal_mul x1 y2) (hreal_mul y1 x2))"
    78     hreal_add (hreal_mul x1 y2) (hreal_mul y1 x2))"
    84   by (import realax treal_mul)
    79   by (import realax treal_mul)
    85 
    80 
    86 constdefs
    81 definition treal_lt :: "hreal * hreal => hreal * hreal => bool" where 
    87   treal_lt :: "hreal * hreal => hreal * hreal => bool" 
       
    88   "treal_lt ==
    82   "treal_lt ==
    89 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
    83 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
    90    hreal_lt (hreal_add x1 y2) (hreal_add x2 y1)"
    84    hreal_lt (hreal_add x1 y2) (hreal_add x2 y1)"
    91 
    85 
    92 lemma treal_lt: "ALL (x1::hreal) (y1::hreal) (x2::hreal) y2::hreal.
    86 lemma treal_lt: "ALL (x1::hreal) (y1::hreal) (x2::hreal) y2::hreal.
    93    treal_lt (x1, y1) (x2, y2) = hreal_lt (hreal_add x1 y2) (hreal_add x2 y1)"
    87    treal_lt (x1, y1) (x2, y2) = hreal_lt (hreal_add x1 y2) (hreal_add x2 y1)"
    94   by (import realax treal_lt)
    88   by (import realax treal_lt)
    95 
    89 
    96 constdefs
    90 definition treal_inv :: "hreal * hreal => hreal * hreal" where 
    97   treal_inv :: "hreal * hreal => hreal * hreal" 
       
    98   "treal_inv ==
    91   "treal_inv ==
    99 %(x::hreal, y::hreal).
    92 %(x::hreal, y::hreal).
   100    if x = y then treal_0
    93    if x = y then treal_0
   101    else if hreal_lt y x
    94    else if hreal_lt y x
   102         then (hreal_add (hreal_inv (hreal_sub x y)) hreal_1, hreal_1)
    95         then (hreal_add (hreal_inv (hreal_sub x y)) hreal_1, hreal_1)
   108     else if hreal_lt y x
   101     else if hreal_lt y x
   109          then (hreal_add (hreal_inv (hreal_sub x y)) hreal_1, hreal_1)
   102          then (hreal_add (hreal_inv (hreal_sub x y)) hreal_1, hreal_1)
   110          else (hreal_1, hreal_add (hreal_inv (hreal_sub y x)) hreal_1))"
   103          else (hreal_1, hreal_add (hreal_inv (hreal_sub y x)) hreal_1))"
   111   by (import realax treal_inv)
   104   by (import realax treal_inv)
   112 
   105 
   113 constdefs
   106 definition treal_eq :: "hreal * hreal => hreal * hreal => bool" where 
   114   treal_eq :: "hreal * hreal => hreal * hreal => bool" 
       
   115   "treal_eq ==
   107   "treal_eq ==
   116 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
   108 %(x1::hreal, y1::hreal) (x2::hreal, y2::hreal).
   117    hreal_add x1 y2 = hreal_add x2 y1"
   109    hreal_add x1 y2 = hreal_add x2 y1"
   118 
   110 
   119 lemma treal_eq: "ALL (x1::hreal) (y1::hreal) (x2::hreal) y2::hreal.
   111 lemma treal_eq: "ALL (x1::hreal) (y1::hreal) (x2::hreal) y2::hreal.
   192 lemma TREAL_LT_MUL: "ALL (x::hreal * hreal) y::hreal * hreal.
   184 lemma TREAL_LT_MUL: "ALL (x::hreal * hreal) y::hreal * hreal.
   193    treal_lt treal_0 x & treal_lt treal_0 y -->
   185    treal_lt treal_0 x & treal_lt treal_0 y -->
   194    treal_lt treal_0 (treal_mul x y)"
   186    treal_lt treal_0 (treal_mul x y)"
   195   by (import realax TREAL_LT_MUL)
   187   by (import realax TREAL_LT_MUL)
   196 
   188 
   197 constdefs
   189 definition treal_of_hreal :: "hreal => hreal * hreal" where 
   198   treal_of_hreal :: "hreal => hreal * hreal" 
       
   199   "treal_of_hreal == %x::hreal. (hreal_add x hreal_1, hreal_1)"
   190   "treal_of_hreal == %x::hreal. (hreal_add x hreal_1, hreal_1)"
   200 
   191 
   201 lemma treal_of_hreal: "ALL x::hreal. treal_of_hreal x = (hreal_add x hreal_1, hreal_1)"
   192 lemma treal_of_hreal: "ALL x::hreal. treal_of_hreal x = (hreal_add x hreal_1, hreal_1)"
   202   by (import realax treal_of_hreal)
   193   by (import realax treal_of_hreal)
   203 
   194 
   204 constdefs
   195 definition hreal_of_treal :: "hreal * hreal => hreal" where 
   205   hreal_of_treal :: "hreal * hreal => hreal" 
       
   206   "hreal_of_treal == %(x::hreal, y::hreal). SOME d::hreal. x = hreal_add y d"
   196   "hreal_of_treal == %(x::hreal, y::hreal). SOME d::hreal. x = hreal_add y d"
   207 
   197 
   208 lemma hreal_of_treal: "ALL (x::hreal) y::hreal.
   198 lemma hreal_of_treal: "ALL (x::hreal) y::hreal.
   209    hreal_of_treal (x, y) = (SOME d::hreal. x = hreal_add y d)"
   199    hreal_of_treal (x, y) = (SOME d::hreal. x = hreal_add y d)"
   210   by (import realax hreal_of_treal)
   200   by (import realax hreal_of_treal)
   577 lemma REAL_SUP_EXISTS: "ALL P::real => bool.
   567 lemma REAL_SUP_EXISTS: "ALL P::real => bool.
   578    Ex P & (EX z::real. ALL x::real. P x --> x < z) -->
   568    Ex P & (EX z::real. ALL x::real. P x --> x < z) -->
   579    (EX x::real. ALL y::real. (EX x::real. P x & y < x) = (y < x))"
   569    (EX x::real. ALL y::real. (EX x::real. P x & y < x) = (y < x))"
   580   by (import real REAL_SUP_EXISTS)
   570   by (import real REAL_SUP_EXISTS)
   581 
   571 
   582 constdefs
   572 definition sup :: "(real => bool) => real" where 
   583   sup :: "(real => bool) => real" 
       
   584   "sup ==
   573   "sup ==
   585 %P::real => bool.
   574 %P::real => bool.
   586    SOME s::real. ALL y::real. (EX x::real. P x & y < x) = (y < s)"
   575    SOME s::real. ALL y::real. (EX x::real. P x & y < x) = (y < s)"
   587 
   576 
   588 lemma sup: "ALL P::real => bool.
   577 lemma sup: "ALL P::real => bool.
   779 
   768 
   780 ;end_setup
   769 ;end_setup
   781 
   770 
   782 ;setup_theory topology
   771 ;setup_theory topology
   783 
   772 
   784 constdefs
   773 definition re_Union :: "(('a => bool) => bool) => 'a => bool" where 
   785   re_Union :: "(('a => bool) => bool) => 'a => bool" 
       
   786   "re_Union ==
   774   "re_Union ==
   787 %(P::('a::type => bool) => bool) x::'a::type.
   775 %(P::('a::type => bool) => bool) x::'a::type.
   788    EX s::'a::type => bool. P s & s x"
   776    EX s::'a::type => bool. P s & s x"
   789 
   777 
   790 lemma re_Union: "ALL P::('a::type => bool) => bool.
   778 lemma re_Union: "ALL P::('a::type => bool) => bool.
   791    re_Union P = (%x::'a::type. EX s::'a::type => bool. P s & s x)"
   779    re_Union P = (%x::'a::type. EX s::'a::type => bool. P s & s x)"
   792   by (import topology re_Union)
   780   by (import topology re_Union)
   793 
   781 
   794 constdefs
   782 definition re_union :: "('a => bool) => ('a => bool) => 'a => bool" where 
   795   re_union :: "('a => bool) => ('a => bool) => 'a => bool" 
       
   796   "re_union ==
   783   "re_union ==
   797 %(P::'a::type => bool) (Q::'a::type => bool) x::'a::type. P x | Q x"
   784 %(P::'a::type => bool) (Q::'a::type => bool) x::'a::type. P x | Q x"
   798 
   785 
   799 lemma re_union: "ALL (P::'a::type => bool) Q::'a::type => bool.
   786 lemma re_union: "ALL (P::'a::type => bool) Q::'a::type => bool.
   800    re_union P Q = (%x::'a::type. P x | Q x)"
   787    re_union P Q = (%x::'a::type. P x | Q x)"
   801   by (import topology re_union)
   788   by (import topology re_union)
   802 
   789 
   803 constdefs
   790 definition re_intersect :: "('a => bool) => ('a => bool) => 'a => bool" where 
   804   re_intersect :: "('a => bool) => ('a => bool) => 'a => bool" 
       
   805   "re_intersect ==
   791   "re_intersect ==
   806 %(P::'a::type => bool) (Q::'a::type => bool) x::'a::type. P x & Q x"
   792 %(P::'a::type => bool) (Q::'a::type => bool) x::'a::type. P x & Q x"
   807 
   793 
   808 lemma re_intersect: "ALL (P::'a::type => bool) Q::'a::type => bool.
   794 lemma re_intersect: "ALL (P::'a::type => bool) Q::'a::type => bool.
   809    re_intersect P Q = (%x::'a::type. P x & Q x)"
   795    re_intersect P Q = (%x::'a::type. P x & Q x)"
   810   by (import topology re_intersect)
   796   by (import topology re_intersect)
   811 
   797 
   812 constdefs
   798 definition re_null :: "'a => bool" where 
   813   re_null :: "'a => bool" 
       
   814   "re_null == %x::'a::type. False"
   799   "re_null == %x::'a::type. False"
   815 
   800 
   816 lemma re_null: "re_null = (%x::'a::type. False)"
   801 lemma re_null: "re_null = (%x::'a::type. False)"
   817   by (import topology re_null)
   802   by (import topology re_null)
   818 
   803 
   819 constdefs
   804 definition re_universe :: "'a => bool" where 
   820   re_universe :: "'a => bool" 
       
   821   "re_universe == %x::'a::type. True"
   805   "re_universe == %x::'a::type. True"
   822 
   806 
   823 lemma re_universe: "re_universe = (%x::'a::type. True)"
   807 lemma re_universe: "re_universe = (%x::'a::type. True)"
   824   by (import topology re_universe)
   808   by (import topology re_universe)
   825 
   809 
   826 constdefs
   810 definition re_subset :: "('a => bool) => ('a => bool) => bool" where 
   827   re_subset :: "('a => bool) => ('a => bool) => bool" 
       
   828   "re_subset ==
   811   "re_subset ==
   829 %(P::'a::type => bool) Q::'a::type => bool. ALL x::'a::type. P x --> Q x"
   812 %(P::'a::type => bool) Q::'a::type => bool. ALL x::'a::type. P x --> Q x"
   830 
   813 
   831 lemma re_subset: "ALL (P::'a::type => bool) Q::'a::type => bool.
   814 lemma re_subset: "ALL (P::'a::type => bool) Q::'a::type => bool.
   832    re_subset P Q = (ALL x::'a::type. P x --> Q x)"
   815    re_subset P Q = (ALL x::'a::type. P x --> Q x)"
   833   by (import topology re_subset)
   816   by (import topology re_subset)
   834 
   817 
   835 constdefs
   818 definition re_compl :: "('a => bool) => 'a => bool" where 
   836   re_compl :: "('a => bool) => 'a => bool" 
       
   837   "re_compl == %(P::'a::type => bool) x::'a::type. ~ P x"
   819   "re_compl == %(P::'a::type => bool) x::'a::type. ~ P x"
   838 
   820 
   839 lemma re_compl: "ALL P::'a::type => bool. re_compl P = (%x::'a::type. ~ P x)"
   821 lemma re_compl: "ALL P::'a::type => bool. re_compl P = (%x::'a::type. ~ P x)"
   840   by (import topology re_compl)
   822   by (import topology re_compl)
   841 
   823 
   851 
   833 
   852 lemma SUBSET_TRANS: "ALL (P::'a::type => bool) (Q::'a::type => bool) R::'a::type => bool.
   834 lemma SUBSET_TRANS: "ALL (P::'a::type => bool) (Q::'a::type => bool) R::'a::type => bool.
   853    re_subset P Q & re_subset Q R --> re_subset P R"
   835    re_subset P Q & re_subset Q R --> re_subset P R"
   854   by (import topology SUBSET_TRANS)
   836   by (import topology SUBSET_TRANS)
   855 
   837 
   856 constdefs
   838 definition istopology :: "(('a => bool) => bool) => bool" where 
   857   istopology :: "(('a => bool) => bool) => bool" 
       
   858   "istopology ==
   839   "istopology ==
   859 %L::('a::type => bool) => bool.
   840 %L::('a::type => bool) => bool.
   860    L re_null &
   841    L re_null &
   861    L re_universe &
   842    L re_universe &
   862    (ALL (a::'a::type => bool) b::'a::type => bool.
   843    (ALL (a::'a::type => bool) b::'a::type => bool.
   898 
   879 
   899 lemma TOPOLOGY_UNION: "ALL (x::'a::type topology) xa::('a::type => bool) => bool.
   880 lemma TOPOLOGY_UNION: "ALL (x::'a::type topology) xa::('a::type => bool) => bool.
   900    re_subset xa (open x) --> open x (re_Union xa)"
   881    re_subset xa (open x) --> open x (re_Union xa)"
   901   by (import topology TOPOLOGY_UNION)
   882   by (import topology TOPOLOGY_UNION)
   902 
   883 
   903 constdefs
   884 definition neigh :: "'a topology => ('a => bool) * 'a => bool" where 
   904   neigh :: "'a topology => ('a => bool) * 'a => bool" 
       
   905   "neigh ==
   885   "neigh ==
   906 %(top::'a::type topology) (N::'a::type => bool, x::'a::type).
   886 %(top::'a::type topology) (N::'a::type => bool, x::'a::type).
   907    EX P::'a::type => bool. open top P & re_subset P N & P x"
   887    EX P::'a::type => bool. open top P & re_subset P N & P x"
   908 
   888 
   909 lemma neigh: "ALL (top::'a::type topology) (N::'a::type => bool) x::'a::type.
   889 lemma neigh: "ALL (top::'a::type topology) (N::'a::type => bool) x::'a::type.
   930    open top S' =
   910    open top S' =
   931    (ALL x::'a::type.
   911    (ALL x::'a::type.
   932        S' x --> (EX N::'a::type => bool. neigh top (N, x) & re_subset N S'))"
   912        S' x --> (EX N::'a::type => bool. neigh top (N, x) & re_subset N S'))"
   933   by (import topology OPEN_NEIGH)
   913   by (import topology OPEN_NEIGH)
   934 
   914 
   935 constdefs
   915 definition closed :: "'a topology => ('a => bool) => bool" where 
   936   closed :: "'a topology => ('a => bool) => bool" 
       
   937   "closed == %(L::'a::type topology) S'::'a::type => bool. open L (re_compl S')"
   916   "closed == %(L::'a::type topology) S'::'a::type => bool. open L (re_compl S')"
   938 
   917 
   939 lemma closed: "ALL (L::'a::type topology) S'::'a::type => bool.
   918 lemma closed: "ALL (L::'a::type topology) S'::'a::type => bool.
   940    closed L S' = open L (re_compl S')"
   919    closed L S' = open L (re_compl S')"
   941   by (import topology closed)
   920   by (import topology closed)
   942 
   921 
   943 constdefs
   922 definition limpt :: "'a topology => 'a => ('a => bool) => bool" where 
   944   limpt :: "'a topology => 'a => ('a => bool) => bool" 
       
   945   "limpt ==
   923   "limpt ==
   946 %(top::'a::type topology) (x::'a::type) S'::'a::type => bool.
   924 %(top::'a::type topology) (x::'a::type) S'::'a::type => bool.
   947    ALL N::'a::type => bool.
   925    ALL N::'a::type => bool.
   948       neigh top (N, x) --> (EX y::'a::type. x ~= y & S' y & N y)"
   926       neigh top (N, x) --> (EX y::'a::type. x ~= y & S' y & N y)"
   949 
   927 
   955 
   933 
   956 lemma CLOSED_LIMPT: "ALL (top::'a::type topology) S'::'a::type => bool.
   934 lemma CLOSED_LIMPT: "ALL (top::'a::type topology) S'::'a::type => bool.
   957    closed top S' = (ALL x::'a::type. limpt top x S' --> S' x)"
   935    closed top S' = (ALL x::'a::type. limpt top x S' --> S' x)"
   958   by (import topology CLOSED_LIMPT)
   936   by (import topology CLOSED_LIMPT)
   959 
   937 
   960 constdefs
   938 definition ismet :: "('a * 'a => real) => bool" where 
   961   ismet :: "('a * 'a => real) => bool" 
       
   962   "ismet ==
   939   "ismet ==
   963 %m::'a::type * 'a::type => real.
   940 %m::'a::type * 'a::type => real.
   964    (ALL (x::'a::type) y::'a::type. (m (x, y) = 0) = (x = y)) &
   941    (ALL (x::'a::type) y::'a::type. (m (x, y) = 0) = (x = y)) &
   965    (ALL (x::'a::type) (y::'a::type) z::'a::type.
   942    (ALL (x::'a::type) (y::'a::type) z::'a::type.
   966        m (y, z) <= m (x, y) + m (x, z))"
   943        m (y, z) <= m (x, y) + m (x, z))"
  1010 
   987 
  1011 lemma METRIC_NZ: "ALL (m::'a::type metric) (x::'a::type) y::'a::type.
   988 lemma METRIC_NZ: "ALL (m::'a::type metric) (x::'a::type) y::'a::type.
  1012    x ~= y --> 0 < dist m (x, y)"
   989    x ~= y --> 0 < dist m (x, y)"
  1013   by (import topology METRIC_NZ)
   990   by (import topology METRIC_NZ)
  1014 
   991 
  1015 constdefs
   992 definition mtop :: "'a metric => 'a topology" where 
  1016   mtop :: "'a metric => 'a topology" 
       
  1017   "mtop ==
   993   "mtop ==
  1018 %m::'a::type metric.
   994 %m::'a::type metric.
  1019    topology
   995    topology
  1020     (%S'::'a::type => bool.
   996     (%S'::'a::type => bool.
  1021         ALL x::'a::type.
   997         ALL x::'a::type.
  1040    open (mtop x) S' =
  1016    open (mtop x) S' =
  1041    (ALL xa::'a::type.
  1017    (ALL xa::'a::type.
  1042        S' xa --> (EX e>0. ALL y::'a::type. dist x (xa, y) < e --> S' y))"
  1018        S' xa --> (EX e>0. ALL y::'a::type. dist x (xa, y) < e --> S' y))"
  1043   by (import topology MTOP_OPEN)
  1019   by (import topology MTOP_OPEN)
  1044 
  1020 
  1045 constdefs
  1021 definition B :: "'a metric => 'a * real => 'a => bool" where 
  1046   B :: "'a metric => 'a * real => 'a => bool" 
       
  1047   "B ==
  1022   "B ==
  1048 %(m::'a::type metric) (x::'a::type, e::real) y::'a::type. dist m (x, y) < e"
  1023 %(m::'a::type metric) (x::'a::type, e::real) y::'a::type. dist m (x, y) < e"
  1049 
  1024 
  1050 lemma ball: "ALL (m::'a::type metric) (x::'a::type) e::real.
  1025 lemma ball: "ALL (m::'a::type metric) (x::'a::type) e::real.
  1051    B m (x, e) = (%y::'a::type. dist m (x, y) < e)"
  1026    B m (x, e) = (%y::'a::type. dist m (x, y) < e)"
  1065   by (import topology MTOP_LIMPT)
  1040   by (import topology MTOP_LIMPT)
  1066 
  1041 
  1067 lemma ISMET_R1: "ismet (%(x::real, y::real). abs (y - x))"
  1042 lemma ISMET_R1: "ismet (%(x::real, y::real). abs (y - x))"
  1068   by (import topology ISMET_R1)
  1043   by (import topology ISMET_R1)
  1069 
  1044 
  1070 constdefs
  1045 definition mr1 :: "real metric" where 
  1071   mr1 :: "real metric" 
       
  1072   "mr1 == metric (%(x::real, y::real). abs (y - x))"
  1046   "mr1 == metric (%(x::real, y::real). abs (y - x))"
  1073 
  1047 
  1074 lemma mr1: "mr1 = metric (%(x::real, y::real). abs (y - x))"
  1048 lemma mr1: "mr1 = metric (%(x::real, y::real). abs (y - x))"
  1075   by (import topology mr1)
  1049   by (import topology mr1)
  1076 
  1050 
  1103 
  1077 
  1104 ;end_setup
  1078 ;end_setup
  1105 
  1079 
  1106 ;setup_theory nets
  1080 ;setup_theory nets
  1107 
  1081 
  1108 constdefs
  1082 definition dorder :: "('a => 'a => bool) => bool" where 
  1109   dorder :: "('a => 'a => bool) => bool" 
       
  1110   "dorder ==
  1083   "dorder ==
  1111 %g::'a::type => 'a::type => bool.
  1084 %g::'a::type => 'a::type => bool.
  1112    ALL (x::'a::type) y::'a::type.
  1085    ALL (x::'a::type) y::'a::type.
  1113       g x x & g y y -->
  1086       g x x & g y y -->
  1114       (EX z::'a::type. g z z & (ALL w::'a::type. g w z --> g w x & g w y))"
  1087       (EX z::'a::type. g z z & (ALL w::'a::type. g w z --> g w x & g w y))"
  1118    (ALL (x::'a::type) y::'a::type.
  1091    (ALL (x::'a::type) y::'a::type.
  1119        g x x & g y y -->
  1092        g x x & g y y -->
  1120        (EX z::'a::type. g z z & (ALL w::'a::type. g w z --> g w x & g w y)))"
  1093        (EX z::'a::type. g z z & (ALL w::'a::type. g w z --> g w x & g w y)))"
  1121   by (import nets dorder)
  1094   by (import nets dorder)
  1122 
  1095 
  1123 constdefs
  1096 definition tends :: "('b => 'a) => 'a => 'a topology * ('b => 'b => bool) => bool" where 
  1124   tends :: "('b => 'a) => 'a => 'a topology * ('b => 'b => bool) => bool" 
       
  1125   "tends ==
  1097   "tends ==
  1126 %(s::'b::type => 'a::type) (l::'a::type) (top::'a::type topology,
  1098 %(s::'b::type => 'a::type) (l::'a::type) (top::'a::type topology,
  1127    g::'b::type => 'b::type => bool).
  1099    g::'b::type => 'b::type => bool).
  1128    ALL N::'a::type => bool.
  1100    ALL N::'a::type => bool.
  1129       neigh top (N, l) -->
  1101       neigh top (N, l) -->
  1135    (ALL N::'a::type => bool.
  1107    (ALL N::'a::type => bool.
  1136        neigh top (N, l) -->
  1108        neigh top (N, l) -->
  1137        (EX n::'b::type. g n n & (ALL m::'b::type. g m n --> N (s m))))"
  1109        (EX n::'b::type. g n n & (ALL m::'b::type. g m n --> N (s m))))"
  1138   by (import nets tends)
  1110   by (import nets tends)
  1139 
  1111 
  1140 constdefs
  1112 definition bounded :: "'a metric * ('b => 'b => bool) => ('b => 'a) => bool" where 
  1141   bounded :: "'a metric * ('b => 'b => bool) => ('b => 'a) => bool" 
       
  1142   "bounded ==
  1113   "bounded ==
  1143 %(m::'a::type metric, g::'b::type => 'b::type => bool)
  1114 %(m::'a::type metric, g::'b::type => 'b::type => bool)
  1144    f::'b::type => 'a::type.
  1115    f::'b::type => 'a::type.
  1145    EX (k::real) (x::'a::type) N::'b::type.
  1116    EX (k::real) (x::'a::type) N::'b::type.
  1146       g N N & (ALL n::'b::type. g n N --> dist m (f n, x) < k)"
  1117       g N N & (ALL n::'b::type. g n N --> dist m (f n, x) < k)"
  1150    bounded (m, g) f =
  1121    bounded (m, g) f =
  1151    (EX (k::real) (x::'a::type) N::'b::type.
  1122    (EX (k::real) (x::'a::type) N::'b::type.
  1152        g N N & (ALL n::'b::type. g n N --> dist m (f n, x) < k))"
  1123        g N N & (ALL n::'b::type. g n N --> dist m (f n, x) < k))"
  1153   by (import nets bounded)
  1124   by (import nets bounded)
  1154 
  1125 
  1155 constdefs
  1126 definition tendsto :: "'a metric * 'a => 'a => 'a => bool" where 
  1156   tendsto :: "'a metric * 'a => 'a => 'a => bool" 
       
  1157   "tendsto ==
  1127   "tendsto ==
  1158 %(m::'a::type metric, x::'a::type) (y::'a::type) z::'a::type.
  1128 %(m::'a::type metric, x::'a::type) (y::'a::type) z::'a::type.
  1159    0 < dist m (x, y) & dist m (x, y) <= dist m (x, z)"
  1129    0 < dist m (x, y) & dist m (x, y) <= dist m (x, z)"
  1160 
  1130 
  1161 lemma tendsto: "ALL (m::'a::type metric) (x::'a::type) (y::'a::type) z::'a::type.
  1131 lemma tendsto: "ALL (m::'a::type metric) (x::'a::type) (y::'a::type) z::'a::type.
  1364 
  1334 
  1365 lemma SEQ_UNIQ: "ALL (x::nat => real) (x1::real) x2::real.
  1335 lemma SEQ_UNIQ: "ALL (x::nat => real) (x1::real) x2::real.
  1366    hol4--> x x1 & hol4--> x x2 --> x1 = x2"
  1336    hol4--> x x1 & hol4--> x x2 --> x1 = x2"
  1367   by (import seq SEQ_UNIQ)
  1337   by (import seq SEQ_UNIQ)
  1368 
  1338 
  1369 constdefs
  1339 definition convergent :: "(nat => real) => bool" where 
  1370   convergent :: "(nat => real) => bool" 
       
  1371   "convergent == %f::nat => real. Ex (hol4--> f)"
  1340   "convergent == %f::nat => real. Ex (hol4--> f)"
  1372 
  1341 
  1373 lemma convergent: "ALL f::nat => real. convergent f = Ex (hol4--> f)"
  1342 lemma convergent: "ALL f::nat => real. convergent f = Ex (hol4--> f)"
  1374   by (import seq convergent)
  1343   by (import seq convergent)
  1375 
  1344 
  1376 constdefs
  1345 definition cauchy :: "(nat => real) => bool" where 
  1377   cauchy :: "(nat => real) => bool" 
       
  1378   "cauchy ==
  1346   "cauchy ==
  1379 %f::nat => real.
  1347 %f::nat => real.
  1380    ALL e>0.
  1348    ALL e>0.
  1381       EX N::nat.
  1349       EX N::nat.
  1382          ALL (m::nat) n::nat. N <= m & N <= n --> abs (f m - f n) < e"
  1350          ALL (m::nat) n::nat. N <= m & N <= n --> abs (f m - f n) < e"
  1386    (ALL e>0.
  1354    (ALL e>0.
  1387        EX N::nat.
  1355        EX N::nat.
  1388           ALL (m::nat) n::nat. N <= m & N <= n --> abs (f m - f n) < e)"
  1356           ALL (m::nat) n::nat. N <= m & N <= n --> abs (f m - f n) < e)"
  1389   by (import seq cauchy)
  1357   by (import seq cauchy)
  1390 
  1358 
  1391 constdefs
  1359 definition lim :: "(nat => real) => real" where 
  1392   lim :: "(nat => real) => real" 
       
  1393   "lim == %f::nat => real. Eps (hol4--> f)"
  1360   "lim == %f::nat => real. Eps (hol4--> f)"
  1394 
  1361 
  1395 lemma lim: "ALL f::nat => real. lim f = Eps (hol4--> f)"
  1362 lemma lim: "ALL f::nat => real. lim f = Eps (hol4--> f)"
  1396   by (import seq lim)
  1363   by (import seq lim)
  1397 
  1364 
  1398 lemma SEQ_LIM: "ALL f::nat => real. convergent f = hol4--> f (lim f)"
  1365 lemma SEQ_LIM: "ALL f::nat => real. convergent f = hol4--> f (lim f)"
  1399   by (import seq SEQ_LIM)
  1366   by (import seq SEQ_LIM)
  1400 
  1367 
  1401 constdefs
  1368 definition subseq :: "(nat => nat) => bool" where 
  1402   subseq :: "(nat => nat) => bool" 
       
  1403   "subseq == %f::nat => nat. ALL (m::nat) n::nat. m < n --> f m < f n"
  1369   "subseq == %f::nat => nat. ALL (m::nat) n::nat. m < n --> f m < f n"
  1404 
  1370 
  1405 lemma subseq: "ALL f::nat => nat. subseq f = (ALL (m::nat) n::nat. m < n --> f m < f n)"
  1371 lemma subseq: "ALL f::nat => nat. subseq f = (ALL (m::nat) n::nat. m < n --> f m < f n)"
  1406   by (import seq subseq)
  1372   by (import seq subseq)
  1407 
  1373 
  1539           ALL (a::real) b::real.
  1505           ALL (a::real) b::real.
  1540              a <= x & x <= b & b - a < d --> P (a, b)) -->
  1506              a <= x & x <= b & b - a < d --> P (a, b)) -->
  1541    (ALL (a::real) b::real. a <= b --> P (a, b))"
  1507    (ALL (a::real) b::real. a <= b --> P (a, b))"
  1542   by (import seq BOLZANO_LEMMA)
  1508   by (import seq BOLZANO_LEMMA)
  1543 
  1509 
  1544 constdefs
  1510 definition sums :: "(nat => real) => real => bool" where 
  1545   sums :: "(nat => real) => real => bool" 
       
  1546   "sums == %f::nat => real. hol4--> (%n::nat. real.sum (0, n) f)"
  1511   "sums == %f::nat => real. hol4--> (%n::nat. real.sum (0, n) f)"
  1547 
  1512 
  1548 lemma sums: "ALL (f::nat => real) s::real.
  1513 lemma sums: "ALL (f::nat => real) s::real.
  1549    sums f s = hol4--> (%n::nat. real.sum (0, n) f) s"
  1514    sums f s = hol4--> (%n::nat. real.sum (0, n) f) s"
  1550   by (import seq sums)
  1515   by (import seq sums)
  1551 
  1516 
  1552 constdefs
  1517 definition summable :: "(nat => real) => bool" where 
  1553   summable :: "(nat => real) => bool" 
       
  1554   "summable == %f::nat => real. Ex (sums f)"
  1518   "summable == %f::nat => real. Ex (sums f)"
  1555 
  1519 
  1556 lemma summable: "ALL f::nat => real. summable f = Ex (sums f)"
  1520 lemma summable: "ALL f::nat => real. summable f = Ex (sums f)"
  1557   by (import seq summable)
  1521   by (import seq summable)
  1558 
  1522 
  1559 constdefs
  1523 definition suminf :: "(nat => real) => real" where 
  1560   suminf :: "(nat => real) => real" 
       
  1561   "suminf == %f::nat => real. Eps (sums f)"
  1524   "suminf == %f::nat => real. Eps (sums f)"
  1562 
  1525 
  1563 lemma suminf: "ALL f::nat => real. suminf f = Eps (sums f)"
  1526 lemma suminf: "ALL f::nat => real. suminf f = Eps (sums f)"
  1564   by (import seq suminf)
  1527   by (import seq suminf)
  1565 
  1528 
  1690 
  1653 
  1691 ;end_setup
  1654 ;end_setup
  1692 
  1655 
  1693 ;setup_theory lim
  1656 ;setup_theory lim
  1694 
  1657 
  1695 constdefs
  1658 definition tends_real_real :: "(real => real) => real => real => bool" where 
  1696   tends_real_real :: "(real => real) => real => real => bool" 
       
  1697   "tends_real_real ==
  1659   "tends_real_real ==
  1698 %(f::real => real) (l::real) x0::real.
  1660 %(f::real => real) (l::real) x0::real.
  1699    tends f l (mtop mr1, tendsto (mr1, x0))"
  1661    tends f l (mtop mr1, tendsto (mr1, x0))"
  1700 
  1662 
  1701 lemma tends_real_real: "ALL (f::real => real) (l::real) x0::real.
  1663 lemma tends_real_real: "ALL (f::real => real) (l::real) x0::real.
  1761 lemma LIM_TRANSFORM: "ALL (f::real => real) (g::real => real) (x0::real) l::real.
  1723 lemma LIM_TRANSFORM: "ALL (f::real => real) (g::real => real) (x0::real) l::real.
  1762    tends_real_real (%x::real. f x - g x) 0 x0 & tends_real_real g l x0 -->
  1724    tends_real_real (%x::real. f x - g x) 0 x0 & tends_real_real g l x0 -->
  1763    tends_real_real f l x0"
  1725    tends_real_real f l x0"
  1764   by (import lim LIM_TRANSFORM)
  1726   by (import lim LIM_TRANSFORM)
  1765 
  1727 
  1766 constdefs
  1728 definition diffl :: "(real => real) => real => real => bool" where 
  1767   diffl :: "(real => real) => real => real => bool" 
       
  1768   "diffl ==
  1729   "diffl ==
  1769 %(f::real => real) (l::real) x::real.
  1730 %(f::real => real) (l::real) x::real.
  1770    tends_real_real (%h::real. (f (x + h) - f x) / h) l 0"
  1731    tends_real_real (%h::real. (f (x + h) - f x) / h) l 0"
  1771 
  1732 
  1772 lemma diffl: "ALL (f::real => real) (l::real) x::real.
  1733 lemma diffl: "ALL (f::real => real) (l::real) x::real.
  1773    diffl f l x = tends_real_real (%h::real. (f (x + h) - f x) / h) l 0"
  1734    diffl f l x = tends_real_real (%h::real. (f (x + h) - f x) / h) l 0"
  1774   by (import lim diffl)
  1735   by (import lim diffl)
  1775 
  1736 
  1776 constdefs
  1737 definition contl :: "(real => real) => real => bool" where 
  1777   contl :: "(real => real) => real => bool" 
       
  1778   "contl ==
  1738   "contl ==
  1779 %(f::real => real) x::real. tends_real_real (%h::real. f (x + h)) (f x) 0"
  1739 %(f::real => real) x::real. tends_real_real (%h::real. f (x + h)) (f x) 0"
  1780 
  1740 
  1781 lemma contl: "ALL (f::real => real) x::real.
  1741 lemma contl: "ALL (f::real => real) x::real.
  1782    contl f x = tends_real_real (%h::real. f (x + h)) (f x) 0"
  1742    contl f x = tends_real_real (%h::real. f (x + h)) (f x) 0"
  1783   by (import lim contl)
  1743   by (import lim contl)
  1784 
  1744 
  1785 constdefs
  1745 definition differentiable :: "(real => real) => real => bool" where 
  1786   differentiable :: "(real => real) => real => bool" 
       
  1787   "differentiable == %(f::real => real) x::real. EX l::real. diffl f l x"
  1746   "differentiable == %(f::real => real) x::real. EX l::real. diffl f l x"
  1788 
  1747 
  1789 lemma differentiable: "ALL (f::real => real) x::real.
  1748 lemma differentiable: "ALL (f::real => real) x::real.
  1790    differentiable f x = (EX l::real. diffl f l x)"
  1749    differentiable f x = (EX l::real. diffl f l x)"
  1791   by (import lim differentiable)
  1750   by (import lim differentiable)
  2125 lemma POWSER_INSIDE: "ALL (f::nat => real) (x::real) z::real.
  2084 lemma POWSER_INSIDE: "ALL (f::nat => real) (x::real) z::real.
  2126    summable (%n::nat. f n * x ^ n) & abs z < abs x -->
  2085    summable (%n::nat. f n * x ^ n) & abs z < abs x -->
  2127    summable (%n::nat. f n * z ^ n)"
  2086    summable (%n::nat. f n * z ^ n)"
  2128   by (import powser POWSER_INSIDE)
  2087   by (import powser POWSER_INSIDE)
  2129 
  2088 
  2130 constdefs
  2089 definition diffs :: "(nat => real) => nat => real" where 
  2131   diffs :: "(nat => real) => nat => real" 
       
  2132   "diffs == %(c::nat => real) n::nat. real (Suc n) * c (Suc n)"
  2090   "diffs == %(c::nat => real) n::nat. real (Suc n) * c (Suc n)"
  2133 
  2091 
  2134 lemma diffs: "ALL c::nat => real. diffs c = (%n::nat. real (Suc n) * c (Suc n))"
  2092 lemma diffs: "ALL c::nat => real. diffs c = (%n::nat. real (Suc n) * c (Suc n))"
  2135   by (import powser diffs)
  2093   by (import powser diffs)
  2136 
  2094 
  2202 
  2160 
  2203 ;end_setup
  2161 ;end_setup
  2204 
  2162 
  2205 ;setup_theory transc
  2163 ;setup_theory transc
  2206 
  2164 
  2207 constdefs
  2165 definition exp :: "real => real" where 
  2208   exp :: "real => real" 
       
  2209   "exp == %x::real. suminf (%n::nat. inverse (real (FACT n)) * x ^ n)"
  2166   "exp == %x::real. suminf (%n::nat. inverse (real (FACT n)) * x ^ n)"
  2210 
  2167 
  2211 lemma exp: "ALL x::real. exp x = suminf (%n::nat. inverse (real (FACT n)) * x ^ n)"
  2168 lemma exp: "ALL x::real. exp x = suminf (%n::nat. inverse (real (FACT n)) * x ^ n)"
  2212   by (import transc exp)
  2169   by (import transc exp)
  2213 
  2170 
  2214 constdefs
  2171 definition cos :: "real => real" where 
  2215   cos :: "real => real" 
       
  2216   "cos ==
  2172   "cos ==
  2217 %x::real.
  2173 %x::real.
  2218    suminf
  2174    suminf
  2219     (%n::nat.
  2175     (%n::nat.
  2220         (if EVEN n then (- 1) ^ (n div 2) / real (FACT n) else 0) * x ^ n)"
  2176         (if EVEN n then (- 1) ^ (n div 2) / real (FACT n) else 0) * x ^ n)"
  2224    suminf
  2180    suminf
  2225     (%n::nat.
  2181     (%n::nat.
  2226         (if EVEN n then (- 1) ^ (n div 2) / real (FACT n) else 0) * x ^ n)"
  2182         (if EVEN n then (- 1) ^ (n div 2) / real (FACT n) else 0) * x ^ n)"
  2227   by (import transc cos)
  2183   by (import transc cos)
  2228 
  2184 
  2229 constdefs
  2185 definition sin :: "real => real" where 
  2230   sin :: "real => real" 
       
  2231   "sin ==
  2186   "sin ==
  2232 %x::real.
  2187 %x::real.
  2233    suminf
  2188    suminf
  2234     (%n::nat.
  2189     (%n::nat.
  2235         (if EVEN n then 0 else (- 1) ^ ((n - 1) div 2) / real (FACT n)) *
  2190         (if EVEN n then 0 else (- 1) ^ ((n - 1) div 2) / real (FACT n)) *
  2362   by (import transc EXP_TOTAL_LEMMA)
  2317   by (import transc EXP_TOTAL_LEMMA)
  2363 
  2318 
  2364 lemma EXP_TOTAL: "ALL y>0. EX x::real. exp x = y"
  2319 lemma EXP_TOTAL: "ALL y>0. EX x::real. exp x = y"
  2365   by (import transc EXP_TOTAL)
  2320   by (import transc EXP_TOTAL)
  2366 
  2321 
  2367 constdefs
  2322 definition ln :: "real => real" where 
  2368   ln :: "real => real" 
       
  2369   "ln == %x::real. SOME u::real. exp u = x"
  2323   "ln == %x::real. SOME u::real. exp u = x"
  2370 
  2324 
  2371 lemma ln: "ALL x::real. ln x = (SOME u::real. exp u = x)"
  2325 lemma ln: "ALL x::real. ln x = (SOME u::real. exp u = x)"
  2372   by (import transc ln)
  2326   by (import transc ln)
  2373 
  2327 
  2408   by (import transc LN_LT_X)
  2362   by (import transc LN_LT_X)
  2409 
  2363 
  2410 lemma LN_POS: "ALL x>=1. 0 <= ln x"
  2364 lemma LN_POS: "ALL x>=1. 0 <= ln x"
  2411   by (import transc LN_POS)
  2365   by (import transc LN_POS)
  2412 
  2366 
  2413 constdefs
  2367 definition root :: "nat => real => real" where 
  2414   root :: "nat => real => real" 
       
  2415   "root == %(n::nat) x::real. SOME u::real. (0 < x --> 0 < u) & u ^ n = x"
  2368   "root == %(n::nat) x::real. SOME u::real. (0 < x --> 0 < u) & u ^ n = x"
  2416 
  2369 
  2417 lemma root: "ALL (n::nat) x::real.
  2370 lemma root: "ALL (n::nat) x::real.
  2418    root n x = (SOME u::real. (0 < x --> 0 < u) & u ^ n = x)"
  2371    root n x = (SOME u::real. (0 < x --> 0 < u) & u ^ n = x)"
  2419   by (import transc root)
  2372   by (import transc root)
  2420 
  2373 
  2421 constdefs
  2374 definition sqrt :: "real => real" where 
  2422   sqrt :: "real => real" 
       
  2423   "sqrt == root 2"
  2375   "sqrt == root 2"
  2424 
  2376 
  2425 lemma sqrt: "ALL x::real. sqrt x = root 2 x"
  2377 lemma sqrt: "ALL x::real. sqrt x = root 2 x"
  2426   by (import transc sqrt)
  2378   by (import transc sqrt)
  2427 
  2379 
  2582   by (import transc COS_2)
  2534   by (import transc COS_2)
  2583 
  2535 
  2584 lemma COS_ISZERO: "EX! x::real. 0 <= x & x <= 2 & cos x = 0"
  2536 lemma COS_ISZERO: "EX! x::real. 0 <= x & x <= 2 & cos x = 0"
  2585   by (import transc COS_ISZERO)
  2537   by (import transc COS_ISZERO)
  2586 
  2538 
  2587 constdefs
  2539 definition pi :: "real" where 
  2588   pi :: "real" 
       
  2589   "pi == 2 * (SOME x::real. 0 <= x & x <= 2 & cos x = 0)"
  2540   "pi == 2 * (SOME x::real. 0 <= x & x <= 2 & cos x = 0)"
  2590 
  2541 
  2591 lemma pi: "pi = 2 * (SOME x::real. 0 <= x & x <= 2 & cos x = 0)"
  2542 lemma pi: "pi = 2 * (SOME x::real. 0 <= x & x <= 2 & cos x = 0)"
  2592   by (import transc pi)
  2543   by (import transc pi)
  2593 
  2544 
  2687    (sin x = 0) =
  2638    (sin x = 0) =
  2688    ((EX n::nat. EVEN n & x = real n * (pi / 2)) |
  2639    ((EX n::nat. EVEN n & x = real n * (pi / 2)) |
  2689     (EX n::nat. EVEN n & x = - (real n * (pi / 2))))"
  2640     (EX n::nat. EVEN n & x = - (real n * (pi / 2))))"
  2690   by (import transc SIN_ZERO)
  2641   by (import transc SIN_ZERO)
  2691 
  2642 
  2692 constdefs
  2643 definition tan :: "real => real" where 
  2693   tan :: "real => real" 
       
  2694   "tan == %x::real. sin x / cos x"
  2644   "tan == %x::real. sin x / cos x"
  2695 
  2645 
  2696 lemma tan: "ALL x::real. tan x = sin x / cos x"
  2646 lemma tan: "ALL x::real. tan x = sin x / cos x"
  2697   by (import transc tan)
  2647   by (import transc tan)
  2698 
  2648 
  2734   by (import transc TAN_TOTAL_POS)
  2684   by (import transc TAN_TOTAL_POS)
  2735 
  2685 
  2736 lemma TAN_TOTAL: "ALL y::real. EX! x::real. - (pi / 2) < x & x < pi / 2 & tan x = y"
  2686 lemma TAN_TOTAL: "ALL y::real. EX! x::real. - (pi / 2) < x & x < pi / 2 & tan x = y"
  2737   by (import transc TAN_TOTAL)
  2687   by (import transc TAN_TOTAL)
  2738 
  2688 
  2739 constdefs
  2689 definition asn :: "real => real" where 
  2740   asn :: "real => real" 
       
  2741   "asn == %y::real. SOME x::real. - (pi / 2) <= x & x <= pi / 2 & sin x = y"
  2690   "asn == %y::real. SOME x::real. - (pi / 2) <= x & x <= pi / 2 & sin x = y"
  2742 
  2691 
  2743 lemma asn: "ALL y::real.
  2692 lemma asn: "ALL y::real.
  2744    asn y = (SOME x::real. - (pi / 2) <= x & x <= pi / 2 & sin x = y)"
  2693    asn y = (SOME x::real. - (pi / 2) <= x & x <= pi / 2 & sin x = y)"
  2745   by (import transc asn)
  2694   by (import transc asn)
  2746 
  2695 
  2747 constdefs
  2696 definition acs :: "real => real" where 
  2748   acs :: "real => real" 
       
  2749   "acs == %y::real. SOME x::real. 0 <= x & x <= pi & cos x = y"
  2697   "acs == %y::real. SOME x::real. 0 <= x & x <= pi & cos x = y"
  2750 
  2698 
  2751 lemma acs: "ALL y::real. acs y = (SOME x::real. 0 <= x & x <= pi & cos x = y)"
  2699 lemma acs: "ALL y::real. acs y = (SOME x::real. 0 <= x & x <= pi & cos x = y)"
  2752   by (import transc acs)
  2700   by (import transc acs)
  2753 
  2701 
  2754 constdefs
  2702 definition atn :: "real => real" where 
  2755   atn :: "real => real" 
       
  2756   "atn == %y::real. SOME x::real. - (pi / 2) < x & x < pi / 2 & tan x = y"
  2703   "atn == %y::real. SOME x::real. - (pi / 2) < x & x < pi / 2 & tan x = y"
  2757 
  2704 
  2758 lemma atn: "ALL y::real. atn y = (SOME x::real. - (pi / 2) < x & x < pi / 2 & tan x = y)"
  2705 lemma atn: "ALL y::real. atn y = (SOME x::real. - (pi / 2) < x & x < pi / 2 & tan x = y)"
  2759   by (import transc atn)
  2706   by (import transc atn)
  2760 
  2707 
  2843   by (import transc DIFF_ACS)
  2790   by (import transc DIFF_ACS)
  2844 
  2791 
  2845 lemma DIFF_ATN: "ALL x::real. diffl atn (inverse (1 + x ^ 2)) x"
  2792 lemma DIFF_ATN: "ALL x::real. diffl atn (inverse (1 + x ^ 2)) x"
  2846   by (import transc DIFF_ATN)
  2793   by (import transc DIFF_ATN)
  2847 
  2794 
  2848 constdefs
  2795 definition division :: "real * real => (nat => real) => bool" where 
  2849   division :: "real * real => (nat => real) => bool" 
       
  2850   "(op ==::(real * real => (nat => real) => bool)
  2796   "(op ==::(real * real => (nat => real) => bool)
  2851         => (real * real => (nat => real) => bool) => prop)
  2797         => (real * real => (nat => real) => bool) => prop)
  2852  (division::real * real => (nat => real) => bool)
  2798  (division::real * real => (nat => real) => bool)
  2853  ((split::(real => real => (nat => real) => bool)
  2799  ((split::(real => real => (nat => real) => bool)
  2854           => real * real => (nat => real) => bool)
  2800           => real * real => (nat => real) => bool)
  2896                                 ((op <=::nat => nat => bool) N n)
  2842                                 ((op <=::nat => nat => bool) N n)
  2897                                 ((op =::real => real => bool) (D n)
  2843                                 ((op =::real => real => bool) (D n)
  2898                                   b)))))))))"
  2844                                   b)))))))))"
  2899   by (import transc division)
  2845   by (import transc division)
  2900 
  2846 
  2901 constdefs
  2847 definition dsize :: "(nat => real) => nat" where 
  2902   dsize :: "(nat => real) => nat" 
       
  2903   "(op ==::((nat => real) => nat) => ((nat => real) => nat) => prop)
  2848   "(op ==::((nat => real) => nat) => ((nat => real) => nat) => prop)
  2904  (dsize::(nat => real) => nat)
  2849  (dsize::(nat => real) => nat)
  2905  (%D::nat => real.
  2850  (%D::nat => real.
  2906      (Eps::(nat => bool) => nat)
  2851      (Eps::(nat => bool) => nat)
  2907       (%N::nat.
  2852       (%N::nat.
  2935                    (op -->::bool => bool => bool)
  2880                    (op -->::bool => bool => bool)
  2936                     ((op <=::nat => nat => bool) N n)
  2881                     ((op <=::nat => nat => bool) N n)
  2937                     ((op =::real => real => bool) (D n) (D N)))))))"
  2882                     ((op =::real => real => bool) (D n) (D N)))))))"
  2938   by (import transc dsize)
  2883   by (import transc dsize)
  2939 
  2884 
  2940 constdefs
  2885 definition tdiv :: "real * real => (nat => real) * (nat => real) => bool" where 
  2941   tdiv :: "real * real => (nat => real) * (nat => real) => bool" 
       
  2942   "tdiv ==
  2886   "tdiv ==
  2943 %(a::real, b::real) (D::nat => real, p::nat => real).
  2887 %(a::real, b::real) (D::nat => real, p::nat => real).
  2944    division (a, b) D & (ALL n::nat. D n <= p n & p n <= D (Suc n))"
  2888    division (a, b) D & (ALL n::nat. D n <= p n & p n <= D (Suc n))"
  2945 
  2889 
  2946 lemma tdiv: "ALL (a::real) (b::real) (D::nat => real) p::nat => real.
  2890 lemma tdiv: "ALL (a::real) (b::real) (D::nat => real) p::nat => real.
  2947    tdiv (a, b) (D, p) =
  2891    tdiv (a, b) (D, p) =
  2948    (division (a, b) D & (ALL n::nat. D n <= p n & p n <= D (Suc n)))"
  2892    (division (a, b) D & (ALL n::nat. D n <= p n & p n <= D (Suc n)))"
  2949   by (import transc tdiv)
  2893   by (import transc tdiv)
  2950 
  2894 
  2951 constdefs
  2895 definition gauge :: "(real => bool) => (real => real) => bool" where 
  2952   gauge :: "(real => bool) => (real => real) => bool" 
       
  2953   "gauge == %(E::real => bool) g::real => real. ALL x::real. E x --> 0 < g x"
  2896   "gauge == %(E::real => bool) g::real => real. ALL x::real. E x --> 0 < g x"
  2954 
  2897 
  2955 lemma gauge: "ALL (E::real => bool) g::real => real.
  2898 lemma gauge: "ALL (E::real => bool) g::real => real.
  2956    gauge E g = (ALL x::real. E x --> 0 < g x)"
  2899    gauge E g = (ALL x::real. E x --> 0 < g x)"
  2957   by (import transc gauge)
  2900   by (import transc gauge)
  2958 
  2901 
  2959 constdefs
  2902 definition fine :: "(real => real) => (nat => real) * (nat => real) => bool" where 
  2960   fine :: "(real => real) => (nat => real) * (nat => real) => bool" 
       
  2961   "(op ==::((real => real) => (nat => real) * (nat => real) => bool)
  2903   "(op ==::((real => real) => (nat => real) * (nat => real) => bool)
  2962         => ((real => real) => (nat => real) * (nat => real) => bool)
  2904         => ((real => real) => (nat => real) * (nat => real) => bool)
  2963            => prop)
  2905            => prop)
  2964  (fine::(real => real) => (nat => real) * (nat => real) => bool)
  2906  (fine::(real => real) => (nat => real) * (nat => real) => bool)
  2965  (%g::real => real.
  2907  (%g::real => real.
  2998                          ((op -::real => real => real)
  2940                          ((op -::real => real => real)
  2999                            (D ((Suc::nat => nat) n)) (D n))
  2941                            (D ((Suc::nat => nat) n)) (D n))
  3000                          (g (p n))))))))"
  2942                          (g (p n))))))))"
  3001   by (import transc fine)
  2943   by (import transc fine)
  3002 
  2944 
  3003 constdefs
  2945 definition rsum :: "(nat => real) * (nat => real) => (real => real) => real" where 
  3004   rsum :: "(nat => real) * (nat => real) => (real => real) => real" 
       
  3005   "rsum ==
  2946   "rsum ==
  3006 %(D::nat => real, p::nat => real) f::real => real.
  2947 %(D::nat => real, p::nat => real) f::real => real.
  3007    real.sum (0, dsize D) (%n::nat. f (p n) * (D (Suc n) - D n))"
  2948    real.sum (0, dsize D) (%n::nat. f (p n) * (D (Suc n) - D n))"
  3008 
  2949 
  3009 lemma rsum: "ALL (D::nat => real) (p::nat => real) f::real => real.
  2950 lemma rsum: "ALL (D::nat => real) (p::nat => real) f::real => real.
  3010    rsum (D, p) f =
  2951    rsum (D, p) f =
  3011    real.sum (0, dsize D) (%n::nat. f (p n) * (D (Suc n) - D n))"
  2952    real.sum (0, dsize D) (%n::nat. f (p n) * (D (Suc n) - D n))"
  3012   by (import transc rsum)
  2953   by (import transc rsum)
  3013 
  2954 
  3014 constdefs
  2955 definition Dint :: "real * real => (real => real) => real => bool" where 
  3015   Dint :: "real * real => (real => real) => real => bool" 
       
  3016   "Dint ==
  2956   "Dint ==
  3017 %(a::real, b::real) (f::real => real) k::real.
  2957 %(a::real, b::real) (f::real => real) k::real.
  3018    ALL e>0.
  2958    ALL e>0.
  3019       EX g::real => real.
  2959       EX g::real => real.
  3020          gauge (%x::real. a <= x & x <= b) g &
  2960          gauge (%x::real. a <= x & x <= b) g &
  3311 specification (poly_diff_aux_primdef: poly_diff_aux) poly_diff_aux_def: "(ALL n::nat. poly_diff_aux n [] = []) &
  3251 specification (poly_diff_aux_primdef: poly_diff_aux) poly_diff_aux_def: "(ALL n::nat. poly_diff_aux n [] = []) &
  3312 (ALL (n::nat) (h::real) t::real list.
  3252 (ALL (n::nat) (h::real) t::real list.
  3313     poly_diff_aux n (h # t) = real n * h # poly_diff_aux (Suc n) t)"
  3253     poly_diff_aux n (h # t) = real n * h # poly_diff_aux (Suc n) t)"
  3314   by (import poly poly_diff_aux_def)
  3254   by (import poly poly_diff_aux_def)
  3315 
  3255 
  3316 constdefs
  3256 definition diff :: "real list => real list" where 
  3317   diff :: "real list => real list" 
       
  3318   "diff == %l::real list. if l = [] then [] else poly_diff_aux 1 (tl l)"
  3257   "diff == %l::real list. if l = [] then [] else poly_diff_aux 1 (tl l)"
  3319 
  3258 
  3320 lemma poly_diff_def: "ALL l::real list. diff l = (if l = [] then [] else poly_diff_aux 1 (tl l))"
  3259 lemma poly_diff_def: "ALL l::real list. diff l = (if l = [] then [] else poly_diff_aux 1 (tl l))"
  3321   by (import poly poly_diff_def)
  3260   by (import poly poly_diff_def)
  3322 
  3261 
  3620 
  3559 
  3621 lemma POLY_DIFF_WELLDEF: "ALL (p::real list) q::real list.
  3560 lemma POLY_DIFF_WELLDEF: "ALL (p::real list) q::real list.
  3622    poly p = poly q --> poly (diff p) = poly (diff q)"
  3561    poly p = poly q --> poly (diff p) = poly (diff q)"
  3623   by (import poly POLY_DIFF_WELLDEF)
  3562   by (import poly POLY_DIFF_WELLDEF)
  3624 
  3563 
  3625 constdefs
  3564 definition poly_divides :: "real list => real list => bool" where 
  3626   poly_divides :: "real list => real list => bool" 
       
  3627   "poly_divides ==
  3565   "poly_divides ==
  3628 %(p1::real list) p2::real list.
  3566 %(p1::real list) p2::real list.
  3629    EX q::real list. poly p2 = poly (poly_mul p1 q)"
  3567    EX q::real list. poly p2 = poly (poly_mul p1 q)"
  3630 
  3568 
  3631 lemma poly_divides: "ALL (p1::real list) p2::real list.
  3569 lemma poly_divides: "ALL (p1::real list) p2::real list.
  3679    (EX! n::nat.
  3617    (EX! n::nat.
  3680        poly_divides (poly_exp [- a, 1] n) p &
  3618        poly_divides (poly_exp [- a, 1] n) p &
  3681        ~ poly_divides (poly_exp [- a, 1] (Suc n)) p)"
  3619        ~ poly_divides (poly_exp [- a, 1] (Suc n)) p)"
  3682   by (import poly POLY_ORDER)
  3620   by (import poly POLY_ORDER)
  3683 
  3621 
  3684 constdefs
  3622 definition poly_order :: "real => real list => nat" where 
  3685   poly_order :: "real => real list => nat" 
       
  3686   "poly_order ==
  3623   "poly_order ==
  3687 %(a::real) p::real list.
  3624 %(a::real) p::real list.
  3688    SOME n::nat.
  3625    SOME n::nat.
  3689       poly_divides (poly_exp [- a, 1] n) p &
  3626       poly_divides (poly_exp [- a, 1] n) p &
  3690       ~ poly_divides (poly_exp [- a, 1] (Suc n)) p"
  3627       ~ poly_divides (poly_exp [- a, 1] (Suc n)) p"
  3752    poly (diff p) = poly (poly_mul e d) &
  3689    poly (diff p) = poly (poly_mul e d) &
  3753    poly d = poly (poly_add (poly_mul r p) (poly_mul s (diff p))) -->
  3690    poly d = poly (poly_add (poly_mul r p) (poly_mul s (diff p))) -->
  3754    (ALL a::real. poly_order a q = (if poly_order a p = 0 then 0 else 1))"
  3691    (ALL a::real. poly_order a q = (if poly_order a p = 0 then 0 else 1))"
  3755   by (import poly POLY_SQUAREFREE_DECOMP_ORDER)
  3692   by (import poly POLY_SQUAREFREE_DECOMP_ORDER)
  3756 
  3693 
  3757 constdefs
  3694 definition rsquarefree :: "real list => bool" where 
  3758   rsquarefree :: "real list => bool" 
       
  3759   "rsquarefree ==
  3695   "rsquarefree ==
  3760 %p::real list.
  3696 %p::real list.
  3761    poly p ~= poly [] &
  3697    poly p ~= poly [] &
  3762    (ALL a::real. poly_order a p = 0 | poly_order a p = 1)"
  3698    (ALL a::real. poly_order a p = 0 | poly_order a p = 1)"
  3763 
  3699 
  3796   by (import poly normalize)
  3732   by (import poly normalize)
  3797 
  3733 
  3798 lemma POLY_NORMALIZE: "ALL t::real list. poly (normalize t) = poly t"
  3734 lemma POLY_NORMALIZE: "ALL t::real list. poly (normalize t) = poly t"
  3799   by (import poly POLY_NORMALIZE)
  3735   by (import poly POLY_NORMALIZE)
  3800 
  3736 
  3801 constdefs
  3737 definition degree :: "real list => nat" where 
  3802   degree :: "real list => nat" 
       
  3803   "degree == %p::real list. PRE (length (normalize p))"
  3738   "degree == %p::real list. PRE (length (normalize p))"
  3804 
  3739 
  3805 lemma degree: "ALL p::real list. degree p = PRE (length (normalize p))"
  3740 lemma degree: "ALL p::real list. degree p = PRE (length (normalize p))"
  3806   by (import poly degree)
  3741   by (import poly degree)
  3807 
  3742