Hi Walid,

It's been a while since I touched HOL so I don't know if there are any theorems about trunc/ceiling, but how about a measure like
m(x) = nat(ceil(2x))

Then
m(x) is nat(ceil(2x))
m(x-1/2) is nat(ceil(2x-1))

Giving
!x, ~(x<=0) ==> nat(ceil(2x-1)) < nat(ceil(2x))


Just a guess, due to a new found interest in termination...

cheers
Daryl


[EMAIL PROTECTED] wrote:
I am trying to define the following:
val F_defn = Hol_defn "F"
     `F (x:rat) = if x <= 0 then 0 else x + F(x - 1/2)`;

I tried to prove termination in analogy with the definition of a similar function that uses int.

- What shall I use as an argument for measure.
For int, we used Num o ABS, we cast it to num, we cannot do this for rat.

-  I skipped this step and tried to prove:
`!x. ~(x <= 0) ==> x - 1/2 < x`;

I did not find an equivalence for
e(Q.SPEC_THEN `i` STRIP_ASSUME_TAC INT_NUM_CASES );

I skipped this and tried to apply few other things; however, this did not help.

2- I tried to define the same function for real, the following exception was raised.

val F_defn = Hol_defn "F"
     `F (x:real) = if x <= 0.0 then 0.0 else x + F(x - 0.5)`;
Exception raised at Parse.Term:
at line 25, character 29:
Record selection must have single id to right (possibly non-integer numeric literal)
! Uncaught exception:
! HOL_ERR
-

3- I like to be able to restrict my domain to a subset of rat.
e.g. multiple of 1/2.

I modified my def as follow:
val F_defn = Hol_defn "F"
     `F (x:rat) = if x <= 0 then 0
                       else if ~ ( is_int_literal (2.0 * x ) ) then 0
                       else x + F(x - 1/2)`;


with 2.0 is_int fail (see below). it also returns wrong result after I load some theories.
aslo * do not work for rat (see below).


- is_int_literal ``1.0``;

Exception raised at Parse.Term:
at line 5, character 20:
Record selection must have single id to right (possibly non-integer numeric literal)
! Uncaught exception:
! HOL_ERR
-
- is_int_literal ``1``;
<<HOL message: more than one resolution of overloading was possible>>
val it = false : bool
-

- (1/2) * 2;
! Toplevel input:
! (1/2) * 2;
!  ^
! Type clash: expression of type
!   int
! cannot have type
!   real
- (1/2) * 2.0 ;
! Toplevel input:
! (1/2) * 2.0 ;
!  ^
! Type clash: expression of type
!   int
! cannot have type
!   real
- (1.0 / 2.0) * 2.0;
val it = 1.0 : real
-


Walid


I


-------------------------------------------------------------------------
SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
hol-info mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hol-info

--

Tel:   +44 1223 706479
Fax:   +44 1223 470030
Email: [EMAIL PROTECTED] Unless otherwise expressly stated, this message does not create or vary any contractual relationship between you and ARC International. The contents of this e-mail may be confidential and if you have received it in error, please delete it from your system, destroy any hard copies and telephone the above number. Incoming emails to ARC may be subject to monitoring other than by the addressee. SJ




-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
hol-info mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hol-info

Reply via email to