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