\starttext
\startluacode
function document.logicFa(p,q,r)
local p,q,r
if ((p or r) and (not q)) then
return "1"
else
return "0"
end
end
function document.logicFb(p,q)
local p,q
if ((not p) or q) then
return "1"
else
return "0"
end
end
function document.MakeHead(p,a)
if not a then
local t = p
p = string.rep("|mcw(1cm)",#p-1) .. "|mcw(1.5cm)|"
a = t
end
context.starttabulate { p }
context.FL()
for i=1,#a do
context.NC() context(a[i])
end
context.NC() context.NR()
context.LL()
-- context.stoptabulate()
end
\stopluacode
\startluacode
a = { "x", "y","z", "\\overbar{y}(x+z)" }
document.MakeHead (a)
-- "|mcw(1cm)|mcw(1cm)|mcw(1cm)|mcw(2cm)|”,
for i,p in ipairs({true,false}) do
for j,q in ipairs({true,false}) do
for k,r in ipairs({true,false}) do
context.NC()
if p then val=1 else val=0 end
context(val)
context.NC()
if q then val=1 else val=0 end
context(val)
context.NC()
if r then val=1 else val=0 end
context(val)
context.NC()
con=document.logicFa(p,q,r)
context(con)
context.NC()
context.AR()
end
end
end
context.HL()
context.stoptabulate()
\stopluacode
\stoptext