.TH LIBNORMALFORM_IMPLY 3 LIBNORMALFORM .SH NAME libnormalform_imply \- Material implication .SH SYNOPSIS .nf #include LIBNORMALFORM_SENTENCE *libnormalform_imply(LIBNORMALFORM_SENTENCE **\fIxs\fP); LIBNORMALFORM_SENTENCE *libnormalform_implyl(LIBNORMALFORM_SENTENCE *\fIa\fP, ... /*, NULL */); LIBNORMALFORM_SENTENCE *libnormalform_vimply(LIBNORMALFORM_SENTENCE *\fIa\fP, va_list \fPargs\fP); LIBNORMALFORM_SENTENCE *libnormalform_imply_checked(size_t \fIn\fP, LIBNORMALFORM_SENTENCE **\fIxs\fP); LIBNORMALFORM_SENTENCE *libnormalform_implyl_checked(size_t \fIn\fP, LIBNORMALFORM_SENTENCE *\fIa\fP, ... /*, NULL */); LIBNORMALFORM_SENTENCE *libnormalform_vimply_checked(size_t \fIn\fP, LIBNORMALFORM_SENTENCE *\fIa\fP, va_list \fPargs\fP); LIBNORMALFORM_SENTENCE *libnormalform_imply2(LIBNORMALFORM_SENTENCE *\fIp\fP, LIBNORMALFORM_SENTENCE *\fIq\fP); #define LIBNORMALFORM_IMPLY(...) /* ... */ .fi .PP Link with .IR -lnormalform . .SH DESCRIPTION The .BR libnormalform_imply () function creates a sentence that is logically equivalent to the material implication of the arguments, that is, a clause that is only false when the last term is false despite all other terms being true. .PP The value of the .I xs parameter shall be a null-pointer terminated list of subsentences. .PP The .BR libnormalform_implyl () function is a variant of .BR libnormalform_imply () which uses variadic arguments instead of an array. .PP The .BR libnormalform_vimply () function is a variant of .BR libnormalform_implyl () which takes an .I va_list in place of variadic arguments. .PP The .BR libnormalform_imply_checked (), .BR libnormalform_implyl_checked (), and .BR libnormalform_vimply_checked () functions are variants of the .BR libnormalform_imply (), .BR libnormalform_implyl (), and .BR libnormalform_vimply () functions respectively which assumes that it is given .I n subsentances, and checks that all are .RI non- NULL . However, these functions still require the list of subsentences to be terminated using a null-pointer. .PP .I "libnormalform_imply2(p, q)" is equivalent to .IR "libnormalform_implyl_checked(2, p, q, NULL)" . .PP The .BR LIBNORMALFORM_IMPLY macro is a wrapper for the .BR libnormalform_imply_checked () but is more similar to .BR libnormalform_implyl (). Unlike .BR libnormalform_implyl (), the argument list .I must not be terminated by a null-pointer, instead the macro automatically as the null-pointer. The macro will count the number of arguments it is given, therefore it will fail it the argument list is has an extra null-pointer. .PP The returned pointer shall either be deallocated with the .BR libnormalform_free (3) function or be relinquished by being used as part of another sentence. .PP These functions adopt the ownership of any .I LIBNORMALFORM_SENTENCE * passed into it. Therefore, the user shall not attempt to deallocate input sentences. This holds even on failure: if the function fails, input sentences are deallocated. .SH RETURN VALUE Upon successful completion, the .BR libnormalform_imply () function and its variants return an object representing the sentence; otherwise, the functions return .I NULL and set .I errno to indicate the error. .SH ERRORS These functions fail if: .TP .B ENOMEM Insufficient memory was available to create the sentence object. .PP The .BR libnormalform_imply_checked (), .BR libnormalform_implyl_checked (), and .BR libnormalform_vimply_checked () functions will also fail without setting .I errno if any of the first .I n .IR "LIBNORMALFORM_SENTENCE *" 's are .IR NULL . Likewise, the .BR libnormalform_imply2 () function will fail without setting .I errno if .I p or .I q is .IR NULL . .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7) and .IR "info \(dq(libc)POSIX Safety Concepts\(dq" . .TS allbox; lb lb lb l l l. Interface Attribute Value T{ .BR libnormalform_imply (), .br .BR libnormalform_imply_checked () T} Thread safety MT-Safe race:\fIxs\fP and elements in \fIxs\fP T{ .BR libnormalform_implyl (), .br .BR libnormalform_implyl_checked (), .br .BR libnormalform_imply2 (), .br .BR LIBNORMALFORM_IMPLY () T} Thread safety MT-Safe race:parameters T{ .BR libnormalform_vimply (), .br .BR libnormalform_vimply_checked () T} Thread safety MT-Safe race:parameters and arguments in \fIargs\fP T{ .BR libnormalform_imply (), .br .BR libnormalform_implyl (), .br .BR libnormalform_vimply (), .br .BR libnormalform_imply_checked (), .br .BR libnormalform_implyl_checked (), .br .BR libnormalform_vimply_checked (), .br .BR libnormalform_vimply2 (), .br .BR LIBNORMALFORM_IMPLY () T} Async-signal safety AS-Unsafe heap T{ .BR libnormalform_imply (), .br .BR libnormalform_implyl (), .br .BR libnormalform_vimply (), .br .BR libnormalform_imply_checked (), .br .BR libnormalform_implyl_checked (), .br .BR libnormalform_vimply_checked (), .br .BR libnormalform_vimply2 (), .br .BR LIBNORMALFORM_IMPLY () T} Async-cancel safety AC-Safe mem, AC-Unsafe heap .TE .SH NOTES If there are no subsentences, the resulting sentence is a tautology. .PP The connective is non-commutative and right-associative. It's truthtable is (1011). .PP The .BR LIBNORMALFORM_IMPLY () macro requires ISO C23 support. .PP The .BR libnormalform_imply () is primary function, the other functions are just wrappers for the .BR libnormalform_imply () function, however .BR libnormalform_imply () itself uses the .BR libnormalform_if () function if it has subsentences. .PP Side-effects in the arguments of the macro .BR LIBNORMALFORM_IMPLY () are guaranteed to be applied exactly once. The side-effects in each macro are applied in no particular order. .SH SEE ALSO .BR libnormalform (7)