//m, n are of type: [i:nat] int (i)
// This works
val mn_i = m * n
val () = assertloc(mn_i > 0)
val mn = i2sz(mn_i)
// This doesn't work
val () = assertloc(m > 2)
val () = assertloc(n > 2)
val mn = i2sz(m * n)
(* ****** ****** *)
//
#include
"share/atspre_define.hats"
#include
"share/atspre_staload.hats"
//
(* ****** ****** *)
extern
fun myCharFun(): char
typedef myInt = [i:nat] int (i)
typedef Point = @{m = myInt, n = myInt}
val mc = myCharFun()
val nc = myCharFun()
val m_in = g1ofg0_int(char2i(mc))
val n_in = g1ofg0_int(char2i(nc))
var data: Point?
val () = data.m := m_in
val () = data.n := n_in
// This works
val mn_i = data.m * data.n
val () = assertloc(mn_i > 0)
val mn = i2sz(mn_i)
// This doesn't work
(* val () = assertloc(data.m > 2) *)
(* val () = assertloc(data.n > 2) *)
(* val mn = i2sz(data.m * data.n) *)
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/9c7bedb5-17e2-4f32-ace7-683c7d5b0ea6%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
extern
praxi
m_times_n_Gt0
{m,n,mn:int | m > 0; n > 0; mn == m*n}
(m: int (m), n: int (n), mn: int(mn)): [mn > 0] void
val () = assertloc(m_in > 2)
val () = assertloc(n_in > 2)
val mn_j = data.m * data.n
prval mn_iGt0pf = m_times_n_Gt0(m_in, n_in, mn_j)
OK, just wanted to verify, thanks.
On Wed, May 14, 2014 at 9:13 PM, gmhwxi <gmh...@gmail.com> wrote:
only equalities (no inequalities) involving multiplication can be handled
(in a very limited way).
On Wednesday, May 14, 2014 7:34:57 PM UTC-4, Brandon Barker wrote:I seem to recall that integer multiplication can be handled by the solver, but ..
//m, n are of type: [i:nat] int (i)
// This works
val mn_i = m * n
val () = assertloc(mn_i > 0)
val mn = i2sz(mn_i)
// This doesn't work
val () = assertloc(m > 2)
val () = assertloc(n > 2)
val mn = i2sz(m * n)
error(3): unsolved constraint: C3NSTRprop(main; S2Eapp(S2Ecst(>=); S2EVar(3769->S2Eapp(S2Ecst(mul_int_int); S2EVar(3767->S2Evar(n$6252(11369))), S2EVar(3768->S2Evar(n$6253(11370))))), S2Eintinf(0)))
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
//This does work
val () = boardSetup(board_conf)
val m = board_conf.m
val n = board_conf.n
//But if I comment these out, it doesn't work
val () = assertloc(m > 2)
val () = assertloc(n > 2)
val mn_i = m * n
prval mnGt0pf = m_times_n_Gt0(m, n, mn_i)
val mn = i2sz(mn_i)
local
val () = assertloc(data.m > 2)
val () = assertloc(data.n > 2)
in end
val mn_j = data.m * data.
n
prval mn_iGt0pf = m_times_n_Gt0(data.m, data.n, mn_j)
// Didn't work
val () = assertloc(board_conf.m > 2)
val () = assertloc(board_conf.n > 2)
val mn_i = board_conf.m * board_conf.n
prval mnGt0pf = m_times_n_Gt0(board_conf.m, board_conf.n, mn_i)
>> //But if I comment these out, it doesn't work
It should not work. Both m and n are natural numbers,
which implies that they may be zeros. The compiler cannot
prove that the product of two natural numbers is positive.
//This does work
val () = boardSetup(board_conf)
val m = board_conf.m
val n = board_conf.n
//But if I comment these out, it doesn't work
val () = assertloc(m > 2)
val () = assertloc(n > 2)
val mn_i = m * n
prval mnGt0pf = m_times_n_Gt0(m, n, mn_i)
val mn = i2sz(mn_i)
praxi
m_times_n_Gte0
{m,n:nat}
(m: int (m), n: int (n)): [m*n >= 0] void
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/b9ea779c-1847-4d48-a55d-03d15a7d55f3%40googlegroups.com.
//
// Get user input and configure board
//
val () = boardSetup(board_conf)
// Works:
val m = board_conf.m
val n = board_conf.
n
val mn_i = m * n
prval mnGt0pf = m_times_n_Gt0(m, n, mn_i)
(* // Doesn't work: *)
(* val mn_i = board_conf.m * board_conf.n *)
(* prval mnGt0pf = m_times_n_Gt0(board_conf.m, board_conf.n, mn_i) *)
val mn = i2sz(mn_i)
typedef board_conf_type =@{, m = [m:int | m > 2] int (m), n = [n:int | n > 2] int (n), k = [k: int| k > 2] int (k), cursor = board_point, num_players = int, player_turn = int}
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/bc26f9cd-6c7b-4a67-b320-3c68d46af2ca%40googlegroups.com.
typedef
board_conf_type = [m,n,k:int | m > 2; n > 2; k > 2]
@{, m = int (m), n = int (n), k = int (k)
, cursor = board_point, num_players = int, player_turn = int}
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/5975a385-0ea3-446f-a1bf-9e408b32177c%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/baa45331-24e5-4091-a4c4-9ad7f7545660%40googlegroups.com.