I'd initially supposed that predicate_refuted_by(..., true) ought to
say that "A refutes B" means "non-falsity of A implies non-truth of B".
But it seems better to define it as "truth of A implies non-truth of B".
This is more useful in the current system, slightly easier to prove,
and in closer correspondence to the existing code behavior.
With this change, test_predtest no longer claims that any existing
test cases show false proof reports, though there still are cases
where we could prove something and fail to.
Discussion: https://postgr.es/m/5983.
1520487191@sss.pgh.pa.us
select x is not true, x
from booleans
$$);
-WARNING: weak_refuted_by result is incorrect
-[ RECORD 1 ]-----+--
strong_implied_by | f
weak_implied_by | f
s_i_holds | f
w_i_holds | f
s_r_holds | t
-w_r_holds | f
+w_r_holds | t
select * from test_predtest($$
select x, x is not true
select x is unknown, x
from booleans
$$);
-WARNING: weak_refuted_by result is incorrect
-[ RECORD 1 ]-----+--
strong_implied_by | f
weak_implied_by | f
s_i_holds | f
w_i_holds | f
s_r_holds | t
-w_r_holds | f
+w_r_holds | t
select * from test_predtest($$
select x, x is unknown
s_i_holds | f
w_i_holds | f
s_r_holds | t
-w_r_holds | f
+w_r_holds | t
select * from test_predtest($$
select x, x is null
s_i_holds | f
w_i_holds | f
s_r_holds | t
-w_r_holds | f
+w_r_holds | t
select * from test_predtest($$
select x is null, int4lt(x,8)
s_i_holds | f
w_i_holds | f
s_r_holds | t
-w_r_holds | f
+w_r_holds | t
select * from test_predtest($$
select x is not null, x < 'foo'
c2 = 'f';
/* Check for violations of various proof conditions */
+
+ /* strong implication: truth of c2 implies truth of c1 */
if (c2 == 't' && c1 != 't')
s_i_holds = false;
+ /* weak implication: non-falsity of c2 implies non-falsity of c1 */
if (c2 != 'f' && c1 == 'f')
w_i_holds = false;
+ /* strong refutation: truth of c2 implies falsity of c1 */
if (c2 == 't' && c1 != 'f')
s_r_holds = false;
- /* XXX is this the correct definition for weak refutation? */
- if (c2 != 'f' && c1 == 't')
+ /* weak refutation: truth of c2 implies non-truth of c1 */
+ if (c2 == 't' && c1 == 't')
w_r_holds = false;
}