BooleanConsecutiveFunction[k,n]
represents a Boolean function of n variables that gives True if k consecutive variables are True.
BooleanConsecutiveFunction[{k,True},n]
treats the variable list as cyclic.
BooleanConsecutiveFunction[{k1,k2,…,kd},{n1,n2,…,nd}]
represents a Boolean function of n1 n2 ⋯ nd variables that gives True if all variables in a
block of the
variable array are True.
BooleanConsecutiveFunction[{{k1,k2,…,kd},{c1,c2,…,cd}},{n1,n2,…,nd}]
treats the i
level of the variable array as cyclic if ci is True.
BooleanConsecutiveFunction[spec,{a1,a2,…}]
gives the Boolean expression in variables ai corresponding to the Boolean consecutive function specified by spec.
BooleanConsecutiveFunction[spec,{a1,a2,…},form]
gives the Boolean expression in the form specified by form.
BooleanConsecutiveFunction
BooleanConsecutiveFunction[k,n]
represents a Boolean function of n variables that gives True if k consecutive variables are True.
BooleanConsecutiveFunction[{k,True},n]
treats the variable list as cyclic.
BooleanConsecutiveFunction[{k1,k2,…,kd},{n1,n2,…,nd}]
represents a Boolean function of n1 n2 ⋯ nd variables that gives True if all variables in a
block of the
variable array are True.
BooleanConsecutiveFunction[{{k1,k2,…,kd},{c1,c2,…,cd}},{n1,n2,…,nd}]
treats the i
level of the variable array as cyclic if ci is True.
BooleanConsecutiveFunction[spec,{a1,a2,…}]
gives the Boolean expression in variables ai corresponding to the Boolean consecutive function specified by spec.
BooleanConsecutiveFunction[spec,{a1,a2,…},form]
gives the Boolean expression in the form specified by form.
Details
- BooleanConsecutiveFunction[k,n] is also known as linear consecutive-k-out-of-n:F.
- BooleanConsecutiveFunction[{k,True},n] is also known as circular consecutive-k-out-of-n:F.
- BooleanConsecutiveFunction[{k,False},n] is equivalent to BooleanConsecutiveFunction[k,n].
- BooleanConsecutiveFunction[{{k1,k2,…,kd},c},{n1,n2,…,nd}] is equivalent to BooleanConsecutiveFunction[{{k1,k2,…,kd},{c,c,…,c}},{n1,n2,…,nd}].
- BooleanConsecutiveFunction[spec] gives a Boolean function object that works like Function.
- BooleanConsecutiveFunction[spec][a1,a2,…] gives an implicit representation equivalent to the explicit Boolean expression BooleanConsecutiveFunction[spec,{a1,a2,…}].
- In BooleanConsecutiveFunction[…,{n1,n2,…,nd},…][vars], vars can be either an array of dimension-{n1,n2,…,nd} variables, or a list of n1 n2 ⋯ nd variables.
- In BooleanConsecutiveFunction[{k1,k2,…,kd},vars], vars needs to be a depth-d array of variables.
- BooleanConvert converts BooleanConsecutiveFunction[spec][vars] to an explicit Boolean expression.
- In BooleanConsecutiveFunction[spec,vars,form], the possible forms are as given for BooleanConvert.
- BooleanConsecutiveFunction[spec,vars] by default gives an expression in disjunctive normal form (DNF).
Examples
open all close allBasic Examples (3)
Create a consecutive-2-out-of-3 Boolean function:
BooleanConsecutiveFunction[2, 3][Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]]BooleanConvert[%]Use BooleanConsecutiveFunction in ReliabilityDistribution:
{Subscript[𝒟, 1], Subscript[𝒟, 2], Subscript[𝒟, 3]} = Table[ExponentialDistribution[Subscript[λ, i]], {i, 3}];ℛ = ReliabilityDistribution[BooleanConsecutiveFunction[2, 3][x, y, z], {{x, Subscript[𝒟, 1]}, {y, Subscript[𝒟, 2]}, {z, Subscript[𝒟, 3]}}];Compute the survival function:
SurvivalFunction[ℛ, t]//SimplifyUse BooleanConsecutiveFunction in FailureDistribution:
{Subscript[𝒟, 1], Subscript[𝒟, 2], Subscript[𝒟, 3]} = Table[ExponentialDistribution[Subscript[λ, i]], {i, 3}];ℱ = FailureDistribution[BooleanConsecutiveFunction[2, 3][x, y, z], {{x, Subscript[𝒟, 1]}, {y, Subscript[𝒟, 2]}, {z, Subscript[𝒟, 3]}}];Compute the survival function:
SurvivalFunction[ℱ, t]//SimplifyScope (10)
Linear Model (4)
BooleanConsecutiveFunction stays unevaluated:
BooleanConsecutiveFunction[2, 4][x, y, z, v]Use BooleanConvert to expand it:
BooleanConvert[%]Construct the function as an expression in the conjunctive normal form:
BooleanConsecutiveFunction[2, {x, y, z, v}, "CNF"]Define a two-dimensional function, shaped as a grid:
BooleanConvert[BooleanConsecutiveFunction[{2, 2}, {3, 3}][Array[Subscript[x, #1, #2]&, {3, 3}]]]Variables can also be given in a flat list:
BooleanConvert[BooleanConsecutiveFunction[{2, 2}, {3, 3}][Array[Subscript[x, #]&, 9]]]A system works if at least three out of four consecutive components on a line work:
𝒟 = ExponentialDistribution[λ];ℛ = ReliabilityDistribution[BooleanConsecutiveFunction[3, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}}];SurvivalFunction[ℛ, t]BooleanConsecutiveFunction can be used in a structure:
ℛ2 = ReliabilityDistribution[w∨BooleanConsecutiveFunction[3, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}, {w, 𝒟}}];SurvivalFunction[ℛ2, t]A system fails if at least three out of four consecutive components on a line fail:
𝒟 = ExponentialDistribution[λ];ℱ = FailureDistribution[BooleanConsecutiveFunction[3, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}}];SurvivalFunction[ℱ, t]BooleanConsecutiveFunction can be used in a structure:
ℱ2 = FailureDistribution[w∨BooleanConsecutiveFunction[3, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}, {w, 𝒟}}];SurvivalFunction[ℱ2, t]Circular Model (4)
BooleanConsecutiveFunction stays unevaluated:
BooleanConsecutiveFunction[{2, True}, 3][x, y, z]Use BooleanConvert to expand it:
BooleanConvert[%]Construct the function as an expression in the algebraic normal form:
BooleanConsecutiveFunction[{2, True}, {x, y, z}, "ANF"]Define a two-dimensional function, in the shape of a torus:
BooleanConvert[BooleanConsecutiveFunction[{{2, 2}, True}, {3, 3}][Array[Subscript[x, #1, #2]&, {3, 3}]]]Variables can also be given in a flat list:
BooleanConvert[BooleanConsecutiveFunction[{{2, 2}, True}, {3, 3}][Array[Subscript[x, #]&, 9]]]A system fails if at least three out of four consecutive components in a circle fail:
𝒟 = ExponentialDistribution[λ];ℛ = FailureDistribution[BooleanConsecutiveFunction[{3, True}, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}}];SurvivalFunction[ℛ, t]//PiecewiseExpandBooleanConsecutiveFunction can be used in a structure:
ℛ2 = FailureDistribution[w∨BooleanConsecutiveFunction[{3, True}, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}, {w, 𝒟}}];SurvivalFunction[ℛ2, t]//PiecewiseExpandA system works if at least three out of four consecutive components in a circle work:
𝒟 = ExponentialDistribution[λ];ℱ = ReliabilityDistribution[BooleanConsecutiveFunction[{3, True}, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}}];SurvivalFunction[ℱ, t]//PiecewiseExpandBooleanConsecutiveFunction can be used in a structure:
ℱ2 = ReliabilityDistribution[w∨BooleanConsecutiveFunction[{3, True}, 4][x, y, z, v], {{x, 𝒟}, {y, 𝒟}, {z, 𝒟}, {v, 𝒟}, {w, 𝒟}}];SurvivalFunction[ℱ2, t]//PiecewiseExpandMixed Model (2)
Wrapping can be different in different dimensions. Define a cylinder:
BooleanConsecutiveFunction[{{2, 2}, {True, False}}, {3, 3}][Array[Subscript[x, #1, #2]&, {3, 3}]]Use BooleanConvert to expand it:
BooleanConvert[%]Construct the function as an expression in the conjunctive normal form:
BooleanConsecutiveFunction[{{2, 2}, {True, False}}, Array[Subscript[x, #1, #2]&, {3, 3}], "CNF"]Connected cylinders stacked inside each other:
BooleanConsecutiveFunction[{{2, 3, 3}, {False, False, True}}, {3, 3, 3}][Flatten[Array[Subscript[x, #1, #2, #3]&, {3, 3, 3}]]];Use BooleanConvert to expand it:
BooleanConvert[%]Applications (2)
A chain of 10 radio towers fails if two neighboring towers fail:
structure = BooleanConsecutiveFunction[2, 10][Array[Subscript[x, #]&, 10]]Each tower has an exponential lifetime distribution with an expected lifetime of 10 years:
𝒟tower = ExponentialDistribution[1 / 10];The survival function for communication from one end of the tower chain to the other:
ℱ = FailureDistribution[structure, Array[{Subscript[x, #], 𝒟tower}&, 10]];Plot[Evaluate@SurvivalFunction[ℱ, t], {t, 0, 10}, Filling -> Axis]The probability of functioning communication after five years without maintenance:
Probability[t > 5, tℱ]//NCameras are arranged in an overlapping grid. All areas are covered until a 2×2 grid fails:
structure = BooleanConsecutiveFunction[{2, 2}, {4, 4}][Array[Subscript[x, #1, #2]&, {4, 4}]];Each camera has an expected lifetime of six years:
𝒟camera = ExponentialDistribution[1 / 6];The lifetime distribution of a complete camera system is modeled with FailureDistribution:
ℱ = FailureDistribution[structure, Join@@Array[{Subscript[x, #1, #2], 𝒟camera}&, {4, 4}]];To cover the same area with minimal overlap, four cameras are needed:
ℱnooverlap = FailureDistribution[Subscript[x, 1] || Subscript[x, 2] || Subscript[x, 3] || Subscript[x, 4], {{Subscript[x, 1], 𝒟camera}, {Subscript[x, 2], 𝒟camera}, {Subscript[x, 3], 𝒟camera}, {Subscript[x, 4], 𝒟camera}}];The overlapping structure has a higher reliability, but uses more cameras:
Plot[Evaluate@{SurvivalFunction[ℱ, t], SurvivalFunction[ℱnooverlap, t]}, {t, 0, 15}, Filling -> Axis]Use the same amount of cameras in standby mode instead:
𝒟standby = StandbyDistribution[𝒟camera, {𝒟camera, 𝒟camera, 𝒟camera}, 0.9];ℱstandby = FailureDistribution[Subscript[x, 1] || Subscript[x, 2] || Subscript[x, 3] || Subscript[x, 4], {{Subscript[x, 1], 𝒟standby}, {Subscript[x, 2], 𝒟standby}, {Subscript[x, 3], 𝒟standby}, {Subscript[x, 4], 𝒟standby}}];Depending on mission time, a standby setup has higher reliability than an overlapping grid:
Plot[Evaluate@{SurvivalFunction[ℱ, t], SurvivalFunction[ℱstandby, t]}, {t, 0, 15}, Filling -> Axis]Properties & Relations (2)
Lower dimensions are special cases of higher dimensions:
BooleanConvert[BooleanConsecutiveFunction[{3, True}, 4][Array[Subscript[x, 1, #]&, 4]]]BooleanConvert[BooleanConsecutiveFunction[{{1, 3}, True}, {1, 4}][Array[Subscript[x, #1, #2]&, {1, 4}]]]Equivalent[%%, %]//TautologyQA ReliabilityDistribution with a BooleanConsecutiveFunction is equal to the negated corresponding Boolean expression in a FailureDistribution:
{Subscript[𝒟, 1], Subscript[𝒟, 2], Subscript[𝒟, 3]} = Table[ExponentialDistribution[Subscript[λ, i]], {i, 3}];ℛ = ReliabilityDistribution[BooleanConsecutiveFunction[2, 3][x, y, z], {{x, Subscript[𝒟, 1]}, {y, Subscript[𝒟, 2]}, {z, Subscript[𝒟, 3]}}];ℱ = FailureDistribution[¬BooleanConsecutiveFunction[2, 3][¬x, ¬y, ¬z], {{x, Subscript[𝒟, 1]}, {y, Subscript[𝒟, 2]}, {z, Subscript[𝒟, 3]}}];CDF[ℛ, t] - CDF[ℱ, t]Neat Examples (1)
Simulate a linear consecutive-k-out-of-n system:
meaning[False] = "working";meaning[True] = "failed";simulate[k_, n_, λ_ : 1 / 2] := Block[{failed = False, deaths, t = -1, res = {}},
deaths = RandomVariate[ExponentialDistribution[λ], n];
While[!failed,
t++;
tab = Table[Style[Subscript[x, i], If[deaths[[i]] < t, Red, Green]], {i, n}];
failed = BooleanConvert@BooleanConsecutiveFunction[k, n][Map[t > #&, deaths]];
AppendTo[res, Graph[tab, Table[Subscript[x, j]Subscript[x, j + 1], {j, n - 1}], VertexSize -> Large, PlotLabel -> "t = " <> ToString[t] <> ", system " <> meaning[failed]]];
];
res//Column]When requiring four out of 10 components to fail for the system to fail, with failure rate
:
simulate[4, 10, 1 / 3]Related Guides
History
Text
Wolfram Research (2012), BooleanConsecutiveFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/BooleanConsecutiveFunction.html.
CMS
Wolfram Language. 2012. "BooleanConsecutiveFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BooleanConsecutiveFunction.html.
APA
Wolfram Language. (2012). BooleanConsecutiveFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BooleanConsecutiveFunction.html
BibTeX
@misc{reference.wolfram_2026_booleanconsecutivefunction, author="Wolfram Research", title="{BooleanConsecutiveFunction}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/BooleanConsecutiveFunction.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_booleanconsecutivefunction, organization={Wolfram Research}, title={BooleanConsecutiveFunction}, year={2012}, url={https://reference.wolfram.com/language/ref/BooleanConsecutiveFunction.html}, note=[Accessed: 12-June-2026]}