Too many constraints?

7 views
Skip to first unread message

Christopher Heuer

unread,
Apr 10, 2011, 6:27:50 PM4/10/11
to byu-cs-330-...@googlegroups.com
Working on generate-constraints, and for something like bif, we could generate a lot of constraints. For example:

[[test]] = boolean
[[bif(test then else)]] = [[then]]
[[bif(test then else)]] = [[else]]
[[then]] = [[else]]

Should the last one be included? I don't think it's technically necessary for the expression to unify but it is something that can be concluded at this step. Is it a problem to include extra constraints like this one?

Dan Burton

unread,
Apr 10, 2011, 6:46:44 PM4/10/11
to byu-cs-330-...@googlegroups.com, Christopher Heuer
It shouldn't be a problem. During unification, [[bif(test then else)]] will get replaced with [[then]], thus the third constraint will turn into [[then]] = [[else]]. Then you replace [[then]] with [[else]], and the fourth constraint will turn into [[else]] = [[else]], which is the "identical idenfiers" unification case, and it will simply be discarded as unnecessary.
 
But since it is logically redundant with constraints 2 and 3, I'd leave constraint 4 out anyways.

Dan Burton
801-513-1596

Bryan Morse

unread,
Apr 11, 2011, 9:19:59 AM4/11/11
to byu-cs-330-...@googlegroups.com
That's correct. Having additional constraints doesn't hurt anything as long as they're mutually consistent, but you normally want to keep it as simple as possible.
Reply all
Reply to author
Forward
0 new messages