author | huffman |
Wed, 27 Sep 2006 07:09:19 +0200 | |
changeset 20730 | da903f59e9ba |
parent 20539 | a7b2f90f698d |
child 21404 | eb85850d3eb7 |
permissions | -rw-r--r-- |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
1 |
(* Title: HOL/HyperArith.thy |
14369 | 2 |
ID: $Id$ |
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1999 University of Cambridge |
|
5 |
*) |
|
6 |
||
7 |
header{*Binary arithmetic and Simplification for the Hyperreals*} |
|
8 |
||
15131 | 9 |
theory HyperArith |
15140 | 10 |
imports HyperDef |
16417 | 11 |
uses ("hypreal_arith.ML") |
15131 | 12 |
begin |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14378
diff
changeset
|
13 |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
14 |
subsection{*Absolute Value Function for the Hyperreals*} |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
15 |
|
15003 | 16 |
lemma hrabs_add_less: |
17 |
"[| abs x < r; abs y < s |] ==> abs(x+y) < r + (s::hypreal)" |
|
18 |
by (simp add: abs_if split: split_if_asm) |
|
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
19 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
20 |
lemma hrabs_less_gt_zero: "abs x < r ==> (0::hypreal) < r" |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
21 |
by (blast intro!: order_le_less_trans abs_ge_zero) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
22 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
23 |
lemma hrabs_disj: "abs x = (x::hypreal) | abs x = -x" |
15003 | 24 |
by (simp add: abs_if) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
25 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
26 |
lemma hrabs_add_lemma_disj: "(y::hypreal) + - x + (y + - z) = abs (x + - z) ==> y = z | x = y" |
15003 | 27 |
by (simp add: abs_if split add: split_if_asm) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
28 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
29 |
lemma hypreal_of_real_hrabs: |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
30 |
"abs (hypreal_of_real r) = hypreal_of_real (abs r)" |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
31 |
by (rule star_of_abs [symmetric]) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
32 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
33 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
34 |
subsection{*Embedding the Naturals into the Hyperreals*} |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
35 |
|
20730 | 36 |
abbreviation |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
37 |
hypreal_of_nat :: "nat => hypreal" |
20730 | 38 |
"hypreal_of_nat == of_nat" |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
39 |
|
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
40 |
lemma SNat_eq: "Nats = {n. \<exists>N. n = hypreal_of_nat N}" |
20730 | 41 |
by (simp add: Nats_def image_def) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
42 |
|
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
43 |
(*------------------------------------------------------------*) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
44 |
(* naturals embedded in hyperreals *) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
45 |
(* is a hyperreal c.f. NS extension *) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
46 |
(*------------------------------------------------------------*) |
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
47 |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
48 |
lemma hypreal_of_nat_eq: |
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
49 |
"hypreal_of_nat (n::nat) = hypreal_of_real (real n)" |
20730 | 50 |
by (simp add: real_of_nat_def) |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
51 |
|
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
52 |
lemma hypreal_of_nat: |
17318
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
53 |
"hypreal_of_nat m = star_n (%n. real m)" |
bc1c75855f3d
starfun, starset, and other functions on NS types are now polymorphic;
huffman
parents:
17298
diff
changeset
|
54 |
apply (fold star_of_def) |
20730 | 55 |
apply (simp add: real_of_nat_def) |
14378
69c4d5997669
generic of_nat and of_int functions, and generalization of iszero
paulson
parents:
14371
diff
changeset
|
56 |
done |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
57 |
|
14309 | 58 |
(* |
14371
c78c7da09519
Conversion of HyperNat to Isar format and its declaration as a semiring
paulson
parents:
14370
diff
changeset
|
59 |
FIXME: we should declare this, as for type int, but many proofs would break. |
14309 | 60 |
It replaces x+-y by x-y. |
61 |
Addsimps [symmetric hypreal_diff_def] |
|
62 |
*) |
|
63 |
||
20254
58b71535ed00
lin_arith_prover splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
64 |
|
58b71535ed00
lin_arith_prover splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
65 |
use "hypreal_arith.ML" |
58b71535ed00
lin_arith_prover splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
66 |
|
58b71535ed00
lin_arith_prover splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
67 |
setup hypreal_arith_setup |
58b71535ed00
lin_arith_prover splits certain operators (e.g. min, max, abs)
webertj
parents:
19765
diff
changeset
|
68 |
|
10751 | 69 |
end |