({{, (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[k,n]
represents a Boolean function of n variables that gives (RefLink[True, paclet:ref/True]) if k consecutive variables are (RefLink[True, paclet:ref/True]).}, {, (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{k,(RefLink[True, paclet:ref/True])},n]
treats the variable list as cyclic.}, {, (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{(Subscript[k, 1]),(Subscript[k, 2]),…,(Subscript[k, d])},{(Subscript[n, 1]),(Subscript[n, 2]),…,(Subscript[n, d])}]
represents a Boolean function of (Subscript[n, 1]) (Subscript[n, 2]) ⋯ (Subscript[n, d]) variables that gives (RefLink[True, paclet:ref/True]) if all variables in a (Subscript[k, 1])×(Subscript[k, 2])×…×(Subscript[k, d]) block of the (Subscript[n, 1])×(Subscript[n, 2])×…×(Subscript[n, d]) variable array are (RefLink[True, paclet:ref/True]).}, {, (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{{(Subscript[k, 1]),(Subscript[k, 2]),…,(Subscript[k, d])},{(Subscript[c, 1]),(Subscript[c, 2]),…,(Subscript[c, d])}},{(Subscript[n, 1]),(Subscript[n, 2]),…,(Subscript[n, d])}]
treats the i(^th) level of the variable array as cyclic if (Subscript[c, i]) is (RefLink[True, paclet:ref/True]). }, {, (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec,{(Subscript[a, 1]),(Subscript[a, 2]),…}]
gives the Boolean expression in variables (Subscript[a, i]) corresponding to the Boolean consecutive function specified by spec.}, {, (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec,{(Subscript[a, 1]),(Subscript[a, 2]),…},form]
gives the Boolean expression in the form specified by form.}})

OpenersNotesSection(Spacer1)Details

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[k,n] is also known as linear consecutive-k-out-of-n:F.

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{k,(RefLink[True, paclet:ref/True])},n] is also known as circular consecutive-k-out-of-n:F.

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{k,(RefLink[False, paclet:ref/False])},n] is equivalent to (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[k,n].

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{{(Subscript[k, 1]),(Subscript[k, 2]),…,(Subscript[k, d])},c},{(Subscript[n, 1]),(Subscript[n, 2]),…,(Subscript[n, d])}] is equivalent to (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{{(Subscript[k, 1]),(Subscript[k, 2]),…,(Subscript[k, d])},{c,c,…,c}},{(Subscript[n, 1]),(Subscript[n, 2]),…,(Subscript[n, d])}].

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec] gives a Boolean function object that works like (RefLink[Function, paclet:ref/Function]).

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec][(Subscript[a, 1]),(Subscript[a, 2]),…] gives an implicit representation equivalent to the explicit Boolean expression (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec,{(Subscript[a, 1]),(Subscript[a, 2]),…}].

In (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[…,{(Subscript[n, 1]),(Subscript[n, 2]),…,(Subscript[n, d])},…][vars], vars can be either an array of dimension-{(Subscript[n, 1]),(Subscript[n, 2]),…,(Subscript[n, d])} variables, or a list of (Subscript[n, 1]) (Subscript[n, 2]) ⋯ (Subscript[n, d]) variables.

In (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[{(Subscript[k, 1]),(Subscript[k, 2]),…,(Subscript[k, d])},vars], vars needs to be a depth-d array of variables.

(RefLink[BooleanConvert, paclet:ref/BooleanConvert]) converts (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec][vars] to an explicit Boolean expression.

In (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec,vars,form], the possible forms are as given for (RefLink[BooleanConvert, paclet:ref/BooleanConvert]).

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction])[spec,vars] by default gives an expression in disjunctive normal form (DNF).

OpenersPrimaryExamplesSection(Spacer1)Examples  (18)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Create a consecutive-2-out-of-3 Boolean function:

BooleanConsecutiveFunction[2,3][(Subscript[x, 1]),(Subscript[x, 2]),(Subscript[x, 3])]

Convert to explicit form:

BooleanConvert[%]

Use (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) in (RefLink[ReliabilityDistribution, paclet:ref/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]//Simplify

Use (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) in (RefLink[FailureDistribution, paclet:ref/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]//Simplify

OpenersExampleSection1(Spacer1)Scope  (10)

OpenersExampleSubsection0(Spacer1)Linear Model  (4)

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) stays unevaluated:

BooleanConsecutiveFunction[2,4][x,y,z,v]

Use (RefLink[BooleanConvert, paclet:ref/BooleanConvert]) to expand it:

BooleanConvert[%]

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]

(RefLink[BooleanConsecutiveFunction, paclet:ref/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]

(RefLink[BooleanConsecutiveFunction, paclet:ref/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]

OpenersExampleSubsection1(Spacer1)Circular Model  (4)

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) stays unevaluated:

BooleanConsecutiveFunction[{2,True},3][x,y,z]

Use (RefLink[BooleanConvert, paclet:ref/BooleanConvert]) to expand it:

BooleanConvert[%]

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]//PiecewiseExpand

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) 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]//PiecewiseExpand

A 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]//PiecewiseExpand

(RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) 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]//PiecewiseExpand

OpenersExampleSubsection2(Spacer1)Mixed 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 (RefLink[BooleanConvert, paclet:ref/BooleanConvert]) to expand it:

BooleanConvert[%]

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 (RefLink[BooleanConvert, paclet:ref/BooleanConvert]) to expand it:

BooleanConvert[%]

OpenersExampleSection3(Spacer1)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\[Distributed]ℱ]//N

Cameras 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 (RefLink[FailureDistribution, paclet:ref/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]

OpenersExampleSection4(Spacer1)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[%%,%]//TautologyQ

A (RefLink[ReliabilityDistribution, paclet:ref/ReliabilityDistribution]) with a (RefLink[BooleanConsecutiveFunction, paclet:ref/BooleanConsecutiveFunction]) is equal to the negated corresponding Boolean expression in a (RefLink[FailureDistribution, paclet:ref/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]

OpenersExampleSection5(Spacer1)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])\[UndirectedEdge](Subscript[x, j+1]),{j,n-1}],VertexSize->Large,PlotLabel->"t = "<>ToString[t]<>", system "<>meaning[failed]]];
];
res//ColumnForm
]

When requiring four out of 10 components to fail for the system to fail, with failure rate 1/3:

simulate[4,10,1/3]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BooleanCountingFunction, paclet:ref/BooleanCountingFunction])  ▪  (RefLink[BooleanConvert, paclet:ref/BooleanConvert])  ▪  (RefLink[ReliabilityDistribution, paclet:ref/ReliabilityDistribution])  ▪  (RefLink[FailureDistribution, paclet:ref/FailureDistribution])  ▪  (RefLink[UnateQ, paclet:ref/UnateQ])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Boolean Computation, paclet:guide/BooleanComputation])}, {▪(RefLinkPlain[Reliability, paclet:guide/Reliability])}})}})