BooleanFunction[k,n]
変数が n 個である k
次のブール関数を表す.
BooleanFunction[values]
真理値の指定されたベクトルに対応するブール関数を表す.
BooleanFunction[{{i11,i12,…}o1,…}]
入力から出力への指定されたマッピングで定義されるブール関数を表す.
BooleanFunction[spec,{a1,a2,…}]
spec で指定されたブール関数に対応する変数 aiのブール式を返す.
BooleanFunction[spec,{a1,a2,…},form]
form で指定された形式のブール式を返す.
BooleanFunction
BooleanFunction[k,n]
変数が n 個である k
次のブール関数を表す.
BooleanFunction[values]
真理値の指定されたベクトルに対応するブール関数を表す.
BooleanFunction[{{i11,i12,…}o1,…}]
入力から出力への指定されたマッピングで定義されるブール関数を表す.
BooleanFunction[spec,{a1,a2,…}]
spec で指定されたブール関数に対応する変数 aiのブール式を返す.
BooleanFunction[spec,{a1,a2,…},form]
form で指定された形式のブール式を返す.
詳細
- BooleanFunction[spec]は,Functionのように働くブール関数オブジェクトを返す.
- BooleanFunction[fun]は,ブール純関数 fun をブール関数オブジェクトに変換する.
- BooleanFunction[spec][a1,a2,…]は明示的ブール式BooleanFunction[spec,{a1,a2,…}]と等価の暗示的表現を返す.
- BooleanConvertはBooleanFunction[spec][vars]を明示的ブール式に変換する.
- BooleanFunction[values]等では,値はTrueまたはFalseあるいは1または0のどちらかで指定することができる.
- BooleanFunctionで表される関数は常にTrueまたはFalseを返す.
- BooleanFunction[values]では,値は111, … で始まるバイナリ順で指定される.
- BooleanFunction[k,n]はBooleanFunction[IntegerDigits[k,2,2^n]]と等価である.
- BooleanFunction[values]において,各値はベクトル値を持つブール関数を表すリストでもよい.
- BooleanFunction[{{i11,i12,…}->o1,…}]において,oiはベクトル値を持つブール関数を表すリストでもよい.
- 入出力両方の要素を,TrueまたはFalseあるいは1または0のどちらかで指定することができる.
- 入出力両方の要素に「無関係」を表す_の任意の数を入れることができる.
- 入出力両方の要素に連続する「無関係」を表す最高で1個の__を入れることができる.
- BooleanFunction[spec,{a1,a2,…},form]では,可能な形式はBooleanConvertで与えられる.
- BooleanFunction[spec,{a1,a2,…}]は,デフォルトで式を加法標準形(disjunctive normal form, DNF)で与える.
- BooleanFunction[k]は,変数が n 個の k
次のブール関数を返す.ただし,n は
である最小の値を持つ. - BooleanFunction[k,…]内のブール関数の付番方式はCellularAutomatonにおけるそれに等しい.
- BooleanFunction[CellularAutomaton[n]]はBooleanFunction[n,3]に等しい.
- BooleanFunction[CellularAutomaton[{n,2,r}]]はBooleanFunction[n,2r+1]に等しい.
- BooleanMinimize,BooleanTable等の操作はBooleanFunctionオブジェクトに直接行うことができる.
- BooleanFunctionオブジェクトは,AndやOr等の他のブール関数と同じように変数に適用することができる.
- StandardFormおよびその関連形式では,BooleanFunctionオブジェクトは変数の数だけが表示された省略形で出力される.
- BooleanVariablesはBooleanFunctionオブジェクトの変数の数を返す.
例題
すべて開く すべて閉じる例 (4)
f = BooleanFunction[30, 3]f[True, False, True]BooleanConvert[f[x, y, z], "DNF"]BooleanFunction[30, {x, y, z}]BooleanFunction[{{False, False} -> True, {False, True} -> False, {True, False} -> True, {True, True} -> True}, {x, y}]BooleanFunction[{{True, True, False} -> True, {False, __} -> False}, {x, y, z}]ブール式をBooleanFunctionに変換する:
f = BooleanConvert[Xor[x, y, z], "BooleanFunction"]BooleanTable[{f, Xor[x, y, z]}, {x, y, z}]ブール純関数をBooleanFunctionオブジェクトに変換する:
BooleanFunction[#1 && #2 || #3&]BooleanFunction[BooleanCountingFunction[3, 5]]スコープ (15)
基本的な用法 (3)
索引を施すことで2引数のBooleanFunctionを作る:
f = BooleanFunction[11, 2]f[False, True]f[x, y]BooleanFunctionは他のブール演算子と同じように使うことができる:
FindInstance[f[x, y], {x, y}, Booleans]RegionPlot[f[x ^ 2 + y < 1, x - y ^ 2 > 0], {x, -2, 2}, {y, -2, 2}]Integrate[Boole[f[x ^ 2 + y < 1, x - y ^ 2 > 0]], {x, 0, 2}, {y, 0, 2}]Reduce[f[x + y < 1, x + y ^ 2 > 0], {x, y}]Sum[Boole[f[x ^ 2 + y < 1, x - y ^ 2 > 0]], {x, 0, 10}, {y, 0, 10}]任意のブール式をBooleanFunction式に変換することができる:
BooleanConvert[x && (y || z), "BFF"]BooleanFunction式の組合せを含ませる:
BooleanConvert[f[%, w], "BFF"]TrueまたはFalseと等価であるBooleanFunction式は自動的に簡約される:
{g, h} = {BooleanFunction[0, 10], BooleanFunction[2 ^ 2 ^ 10 - 1, 10]}g@@Array[x, 10]h@@Array[x, 10]BooleanFunctionは標準表現で,SameQを使って等価性をテストすることができる:
g = BooleanConvert[a && b, "BFF"]h = BooleanConvert[x && y, "BFF"]Head[g] === Head[h]真理値表を使う (7)
f1 = x && (y || z);t1 = BooleanTable[f1, {x, y, z}]これと等価のBooleanFunction式を作る:
f2 = BooleanFunction[t1][x, y, z]TautologyQ[Equivalent[f1, f2]]t2 = BooleanTable[f2, {x, y, z}]t1 === t2f1 = x && (y || z);t1 = BooleanTable[{x, y, z} -> f1, {x, y, z}]対応するBooleanFunction式を作る:
f2 = BooleanFunction[t1][x, y, z]f3 = BooleanFunction[Reverse[t1]][x, y, z]TautologyQ[Equivalent[f1, f2, f3]]t1 = {False, _, _, True};BooleanFunctionを作る:
f1 = BooleanFunction[t1][x, y]t2 = BooleanTable[f1, {x, y}]MatchQ[t2, t1]_と__を使って真理規則の「don't cares」を示す:
r1 = {{True, True, _} -> True, {__} -> False};BooleanFunctionを作る:
f1 = BooleanFunction[r1][x, y, z]r2 = BooleanTable[{x, y, z} -> f1, {x, y, z}]もとの規則は完全に関数を指定し,結果の真理値表は全く等しい:
Replace[Tuples[{True, False}, 3], r1, {1}]Replace[Tuples[{True, False}, 3], r2, {1}]t1 = {{True, False}, {__}, {_, False}, {False, True}};BooleanFunctionを作る:
f1 = BooleanFunction[t1][x, y]t2 = BooleanTable[f1, {x, y}]MatchQ[t2, t1]r1 = {{True, True, False} -> {False, True}, {False, __} -> {True, False}};BooleanFunctionを作る:
f1 = BooleanFunction[r1][x, y, z]r2 = BooleanTable[{x, y, z} -> f1, {x, y, z}]t1 = Replace[Tuples[{True, False}, 3], Append[r1, _ -> _], {1}]t2 = Replace[Tuples[{True, False}, 3], r2, {1}]MatchQ[t2, t1]真理値表はFalseの代りに0,Trueの代りに1を使っても得ることができる:
t1 = RandomInteger[{0, 1}, 8]f = BooleanFunction[t1][x, y, z]t2 = Boole@BooleanTable[f, {x, y, z}]t1 === t2他の表記法を使う (5)
任意のブール式をBooleanFunction式に変換する:
f1 = Nand[Nor[x, y], Xor[y, z]];f2 = BooleanConvert[f1, "BFF"]TautologyQ[Equivalent[f1, f2]]指定された標準形でBooleanFunction式を構築する:
f = BooleanFunction[123, {x, y, z}, "DNF"]f = BooleanFunction[123, {x, y, z}, "CNF"]f = BooleanFunction[123, {x, y, z}, "ANF"]f = BooleanFunction[123, {x, y, z}, "NAND"]f = BooleanFunction[123, {x, y, z}, "NOR"]f = BooleanFunction[123, {x, y, z}, "Implies"]f1 = BooleanMinterms[{1, 4, 7}, 3][x, BooleanFunction[110, 3][x, y, z], BooleanCountingFunction[{3, 5}, 5][x, y, x, y, z]]f2 = BooleanConvert[f1, "BFF"]TautologyQ[Equivalent[f1, f2]]BooleanFunction式を他の標準形式に変換する:
f = BooleanFunction[123, 3][x, y, z]BooleanConvert[f, "DNF"]BooleanConvert[f, "CNF"]BooleanConvert[f, "ANF"]BooleanConvert[f, "NAND"]BooleanConvert[f, "NOR"]BooleanConvert[f, "Implies"]BooleanTable[f, {x, y, z}]BooleanTable[{x, y, z} -> f, {x, y, z}]CellularAutomatonを使ってBooleanFunctionを指定する:
BooleanFunction[CellularAutomaton[77]]% === BooleanFunction[77, 3]BooleanFunction[CellularAutomaton[{123, 2, 7 / 2}]]% === BooleanFunction[123, 2 7 / 2 + 1]アプリケーション (4)
ブール関数の列挙 (2)
Table[ArrayPlot[BooleanTable[BooleanFunction[i, 2][x, y], {x}, {y}], ColorRules -> {False -> White, True -> Black}, ImageSize -> 15, PlotLabel -> Style[i, Small]], {i, 0, 15}]Table[ArrayPlot[BooleanTable[BooleanFunction[i, 3][x, y, z], {x}, {y, z}], ColorRules -> {False -> White, True -> Black}, ImageSize -> 25, PlotLabel -> Style[i, Small]], {i, 0, 255}]Table[ArrayPlot[BooleanTable[BooleanFunction[i, 4][x, y, z, w], {x, y}, {z, w}], ColorRules -> {False -> White, True -> Black}, ImageSize -> 30, PlotLabel -> Style[i, Small]], {i, RandomInteger[{0, 2 ^ 2 ^ 4 - 1}, 50]}]size[h_] := If[Head[h] === Or, Length[h], 1]Tally@Table[size@BooleanFunction[i, {x, y, z}], {i, 0, 2 ^ 2 ^ 3 - 1}]Tally@Table[size@BooleanMinimize[BooleanFunction[i, {x, y, z}]], {i, 0, 2 ^ 2 ^ 3 - 1}]ListLinePlot[{%%, %}]Tally@Table[size@BooleanFunction[i, {x, y, z, w}], {i, 0, 1000}]Tally@Table[size@BooleanMinimize[BooleanFunction[i, {x, y, z, w}]], {i, 0, 1000}]ListLinePlot[{%%, %}]新たなプリミティブの作成 (1)
BooleanLessEqual = BooleanFunction[{{0, 0} -> 1, {0, 1} -> 1, {1, 0} -> 0, {1, 1} -> 1}];BooleanGreaterEqual = BooleanFunction[{{0, 0} -> 1, {0, 1} -> 0, {1, 0} -> 1, {1, 1} -> 1}];BooleanLess = BooleanFunction[{{0, 0} -> 0, {0, 1} -> 1, {1, 0} -> 0, {1, 1} -> 0}];BooleanGreater = BooleanFunction[{{0, 0} -> 0, {0, 1} -> 0, {1, 0} -> 1, {1, 1} -> 0}];TautologyQ[Equivalent[Not[BooleanLessEqual[x, y]], BooleanGreater[x, y]]]TautologyQ[Equivalent[Not[BooleanGreaterEqual[x, y]], BooleanLess[x, y]]]Impliesは x<=y に等しい:
TautologyQ[Equivalent[BooleanLessEqual[x, y], Implies[x, y]]]
f[u]≤g[u]でありそれ以外ではない場合の,ブール関数 f≼g の関係を定義する:
Conjunction[BooleanLessEqual[x, x∨y], {x, y}]BooleanTable[{x, x∨y}, {x, y}]BooleanLessEqual@@@%Boole@BooleanTable[{x, x∨y}, {x, y}]LessEqual@@@%すべてのブール関数 f と g について f∧g≼f≼f∨g である:
Conjunction[BooleanLessEqual[f∧g, f], {f, g}]Conjunction[BooleanLessEqual[f, f∨g], {f, g}]これは,f∧g⇔f でありそれ以外ではない場合に f≼g であることを証明する:
TautologyQ[Equivalent[BooleanLessEqual[f, g], Equivalent[f∧g, f]]]同様に,f∨g⇔g ありそれ以外ではない場合に f≼g であることを証明する:
TautologyQ[Equivalent[BooleanLessEqual[f, g], Equivalent[f∨g, g]]]あるいは f≼g で g≼h であると f≼h が含意されることを証明する:
TautologyQ[Implies[BooleanLessEqual[f, g]∧BooleanLessEqual[g, h], BooleanLessEqual[f, h]]]セルオートマトン (1)
f = Function[{v, i}, BooleanFunction[30, 3]@@v]CellularAutomaton[{f, {}, 1}, {False, False, True, False, False}, 2]Boole[%]CellularAutomaton[30, {0, 0, 1, 0, 0}, 2]特性と関係 (7)
省略形で表示されたBooleanFunctionには引数の数が示される:
f = BooleanFunction[30, 3]{AtomQ[f], Length[f]}InputFormはそのオブジェクトの再構築に使うことができる符号化を与える:
InputForm[f]与えられた符号化を使ってBooleanFunctionを構築する:
g = BooleanFunction["BDD" -> {-3, 0, 2, -2, 1, 1, 3, 2, 1, -1}]f === gBooleanFunctionの値の順序はBooleanTableのものと等しい:
t1 = BooleanTable[Xor[x, y], {x, y}]対応するBooleanFunctionは全く同じ真理値表を持つ:
f = BooleanFunction[t1]BooleanTable[f[x, y], {x, y}]順序はTuplesと一致する:
f@@@Tuples[{True, False}, 2]BooleanFunctionの指標付けはIntegerDigitsと一致する:
With[{m = 1234, k = 5}, BooleanFunction[m, k] === BooleanFunction[IntegerDigits[m, 2, 2 ^ k]]]BooleanFunctionから指標に変換する:
f = BooleanFunction[1234, 5]FromDigits[Boole@BooleanTable[f], 2]FromDigits[Boole@BooleanTable[Xor[x, y, x || z], {x, y, z}], 2]指標付きのBooleanFunction式で等価性を示す:
TautologyQ[Equivalent[BooleanFunction[%, 3][x, y, z], Xor[x, y, x || z]]]ブール関数の指標付けはセルオートマトンの指標付けに一致する:
CellularAutomaton[30, #][[2]]& /@ Tuples[{1, 0}, 3]Boole@BooleanTable[BooleanFunction[30, 3]]より一般的には,整数
と
のあるCellularAutomaton[{k,2,r}]について:
With[{k = 123, r = 5 / 2}, CellularAutomaton[{k, 2, r}, #][[Ceiling[r] + 1]]& /@ Tuples[{1, 0}, 2r + 1] === Boole@BooleanTable[BooleanFunction[k, 2r + 1]]]上記の特性を満足するCellularAutomatonを使ってBooleanFunctionを指定することができる:
BooleanFunction[CellularAutomaton[30]] === BooleanFunction[30, 3]BooleanFunction[CellularAutomaton[{123, 2, 5 / 2}]] === BooleanFunction[123, 6]BooleanMintermsは任意のBooleanFunctionを表すこともできる:
f1 = BooleanMinterms[{1, 5, 7}, 3]f2 = BooleanFunction[FromDigits[{1, 0, 1, 0, 0, 0, 1, 0}, 2], 3]f1 === f2mindex[l_, k_] := FromDigits[Table[If[MemberQ[l, i], 1, 0], {i, 2 ^ k - 1, 0, -1}], 2]mindex[{1, 5, 7}, 3]indmin[m_, k_] := Flatten@Position[Reverse[IntegerDigits[m, 2, 2 ^ k]], 1] - 1indmin[162, 3]With[{m = 123, k = 4}, BooleanMinterms[Select[Range[0, 2^k - 1], BitAnd[2^#, m] ≠ 0&], k] === BooleanFunction[m, k]]BooleanConvertを使ってBooleanFunctionを他の形式から変換する:
f1 = Xor[x, y && z];f2 = BooleanConvert[f1, "BFF"]同じく,BooleanConvertを使ってBooleanFunctionから他の形式に変換する:
f3 = BooleanConvert[f2, "NAND"]TautologyQ[Equivalent[f1, f2, f3]]BooleanTableを使ってBooleanFunctionから真理値表へ変換する:
f = BooleanFunction[23, 3]BooleanTable[f]BooleanTable[{x, y, z} -> f[x, y, z], {x, y, z}]関連するガイド
-
▪
- ブール計算 ▪
- 論理演算とブール代数 ▪
- 計算系 ▪
- 離散数学
テキスト
Wolfram Research (2008), BooleanFunction, Wolfram言語関数, https://reference.wolfram.com/language/ref/BooleanFunction.html.
CMS
Wolfram Language. 2008. "BooleanFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BooleanFunction.html.
APA
Wolfram Language. (2008). BooleanFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BooleanFunction.html
BibTeX
@misc{reference.wolfram_2026_booleanfunction, author="Wolfram Research", title="{BooleanFunction}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/BooleanFunction.html}", note=[Accessed: 16-September-2026]}
BibLaTeX
@online{reference.wolfram_2026_booleanfunction, organization={Wolfram Research}, title={BooleanFunction}, year={2008}, url={https://reference.wolfram.com/language/ref/BooleanFunction.html}, note=[Accessed: 16-September-2026]}