ar.falsy.cat/note/word-play/two-lolita-devils-and-chess-board/index.html
2023-04-22 16:18:12 +00:00

19 lines
20 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html><html lang=en><head><meta charset=utf-8><meta name=description content="概要 「2人の幼女とチェス盤の部屋」という次のような論理問題を解説する 以下の手順の後幼女Bが任意の整数$x\left(0\leq x<64\right)$を求められるようにするには幼女Aはどのような操作を行うべきか 悪魔が8x8チェス盤の各マスに1個ずつ合計0個以上64個以下のポーンをランダムに配置する 悪魔は幼女Aにチェス盤を見せ任意の数字$x\left(0\leq x<64\right)$を伝える 幼女Aはチェス盤に対して次のいずれかの操作のうち可能であるものを1回だけ必ず行う 任意のマスからポーンを1個だけ取り除く 任意のマスにポーンを1個だけ追加する 悪魔は幼女Bにチェス盤を見せる 問題の簡潔化 $f(g(b,x))=x$とできるような写像$f,g$を求めよ $B=\left\{0,1\right\}$ $b\in B^{64}$ $x\in B^6$ $f: B^{64} \rightarrow B^6$ $g: B^{64} \times B^6\rightarrow B^{64}$ $b$と$g(b,x)$は1ビットだけ異なる 解答 $f(b)=f_0\oplus f_1\oplus f_2 \oplus \dots \oplus f_{63} \quad\left(f_i=i b_i\right)$ $b&rsquo;=g(b,x) \implies b&rsquo;_m \neq b_m\quad\left(m=x\oplus f(b)\right)$ チェス盤が16x16の場合のプログラム 解説 $x=f(b)\oplus m$となるような$m\in B^6$は必ず存在する 盤面の各マスに$m$の値を割り当てることで1マスの操作だけで$m$を表現できる 盤面のマス目の数も,$m$がとりうる値の数も64 $f(g(b,x))=f(b)\oplus m=f(b)\oplus f_m\oplus m(1-b_m)$ 応用 長さ$2^N$の任意のビット列について任意の1ビットだけを反転させることで長さ$N$のビット列を表現できる 参考文献 # 超難問論理クイズ「2人の幼女とチェス盤の部屋」が本当に難しすぎた - 明日は未来だ! 幼女問題まとめ - GItHub Gist Impossible Escape?"><meta property="og:title" content="2人の幼女と悪魔とチェス盤"><meta property="og:description" content="概要 「2人の幼女とチェス盤の部屋」という次のような論理問題を解説する 以下の手順の後幼女Bが任意の整数$x\left(0\leq x<64\right)$を求められるようにするには幼女Aはどのような操作を行うべきか 悪魔が8x8チェス盤の各マスに1個ずつ合計0個以上64個以下のポーンをランダムに配置する 悪魔は幼女Aにチェス盤を見せ任意の数字$x\left(0\leq x<64\right)$を伝える 幼女Aはチェス盤に対して次のいずれかの操作のうち可能であるものを1回だけ必ず行う 任意のマスからポーンを1個だけ取り除く 任意のマスにポーンを1個だけ追加する 悪魔は幼女Bにチェス盤を見せる 問題の簡潔化 $f(g(b,x))=x$とできるような写像$f,g$を求めよ $B=\left\{0,1\right\}$ $b\in B^{64}$ $x\in B^6$ $f: B^{64} \rightarrow B^6$ $g: B^{64} \times B^6\rightarrow B^{64}$ $b$と$g(b,x)$は1ビットだけ異なる 解答 $f(b)=f_0\oplus f_1\oplus f_2 \oplus \dots \oplus f_{63} \quad\left(f_i=i b_i\right)$ $b&rsquo;=g(b,x) \implies b&rsquo;_m \neq b_m\quad\left(m=x\oplus f(b)\right)$ チェス盤が16x16の場合のプログラム 解説 $x=f(b)\oplus m$となるような$m\in B^6$は必ず存在する 盤面の各マスに$m$の値を割り当てることで1マスの操作だけで$m$を表現できる 盤面のマス目の数も,$m$がとりうる値の数も64 $f(g(b,x))=f(b)\oplus m=f(b)\oplus f_m\oplus m(1-b_m)$ 応用 長さ$2^N$の任意のビット列について任意の1ビットだけを反転させることで長さ$N$のビット列を表現できる 参考文献 # 超難問論理クイズ「2人の幼女とチェス盤の部屋」が本当に難しすぎた - 明日は未来だ! 幼女問題まとめ - GItHub Gist Impossible Escape?"><meta property="og:type" content="website"><meta property="og:image" content="https://ar.falsy.cat/icon.png"><meta property="og:url" content="https://ar.falsy.cat/note/word-play/two-lolita-devils-and-chess-board/"><meta property="og:width" content="200"><meta property="og:height" content="200"><meta name=twitter:card content="summary"><meta name=twitter:title content="2人の幼女と悪魔とチェス盤"><meta name=twitter:description content="概要 「2人の幼女とチェス盤の部屋」という次のような論理問題を解説する 以下の手順の後幼女Bが任意の整数$x\left(0\leq x<64\right)$を求められるようにするには幼女Aはどのような操作を行うべきか 悪魔が8x8チェス盤の各マスに1個ずつ合計0個以上64個以下のポーンをランダムに配置する 悪魔は幼女Aにチェス盤を見せ任意の数字$x\left(0\leq x<64\right)$を伝える 幼女Aはチェス盤に対して次のいずれかの操作のうち可能であるものを1回だけ必ず行う 任意のマスからポーンを1個だけ取り除く 任意のマスにポーンを1個だけ追加する 悪魔は幼女Bにチェス盤を見せる 問題の簡潔化 $f(g(b,x))=x$とできるような写像$f,g$を求めよ $B=\left\{0,1\right\}$ $b\in B^{64}$ $x\in B^6$ $f: B^{64} \rightarrow B^6$ $g: B^{64} \times B^6\rightarrow B^{64}$ $b$と$g(b,x)$は1ビットだけ異なる 解答 $f(b)=f_0\oplus f_1\oplus f_2 \oplus \dots \oplus f_{63} \quad\left(f_i=i b_i\right)$ $b&rsquo;=g(b,x) \implies b&rsquo;_m \neq b_m\quad\left(m=x\oplus f(b)\right)$ チェス盤が16x16の場合のプログラム 解説 $x=f(b)\oplus m$となるような$m\in B^6$は必ず存在する 盤面の各マスに$m$の値を割り当てることで1マスの操作だけで$m$を表現できる 盤面のマス目の数も,$m$がとりうる値の数も64 $f(g(b,x))=f(b)\oplus m=f(b)\oplus f_m\oplus m(1-b_m)$ 応用 長さ$2^N$の任意のビット列について任意の1ビットだけを反転させることで長さ$N$のビット列を表現できる 参考文献 # 超難問論理クイズ「2人の幼女とチェス盤の部屋」が本当に難しすぎた - 明日は未来だ! 幼女問題まとめ - GItHub Gist Impossible Escape?"><meta name=twitter:image content="https://ar.falsy.cat/icon.png"><title>2人の幼女と悪魔とチェス盤</title><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" type=image/png href=https://ar.falsy.cat//icon.png><link href=https://ar.falsy.cat/styles.b369a84b3c6e6bfd686ad1f9da65641c.min.css rel=stylesheet><link href=https://ar.falsy.cat/styles/_light_syntax.86a48a52faebeaaf42158b72922b1c90.min.css rel=stylesheet id=theme-link><script src=https://ar.falsy.cat/js/darkmode.557cde7fcc3511a3d7ca8545ecd46d77.min.js></script>
<script src=https://ar.falsy.cat/js/util.a0ccf91e1937fe761a74da4946452710.min.js></script>
<link rel=preload href=https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css as=style onload='this.onload=null,this.rel="stylesheet"' integrity=sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs crossorigin=anonymous><script defer src=https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js integrity=sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx crossorigin=anonymous></script>
<script defer src=https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js integrity=sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR crossorigin=anonymous></script>
<script defer src=https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/copy-tex.min.js integrity=sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A crossorigin=anonymous></script>
<script async src=https://unpkg.com/@floating-ui/core@0.7.3></script>
<script async src=https://unpkg.com/@floating-ui/dom@0.5.4></script>
<script async src=https://ar.falsy.cat/js/popover.aa9bc99c7c38d3ae9538f218f1416adb.min.js></script>
<script defer src=https://ar.falsy.cat/js/code-title.ce4a43f09239a9efb48fee342e8ef2df.min.js></script>
<script defer src=https://ar.falsy.cat/js/clipboard.2913da76d3cb21c5deaa4bae7da38c9f.min.js></script>
<script defer src=https://ar.falsy.cat/js/callouts.7723cac461d613d118ee8bb8216b9838.min.js></script>
<script>const SEARCH_ENABLED=!1,LATEX_ENABLED=!0,PRODUCTION=!0,BASE_URL="https://ar.falsy.cat/",fetchData=Promise.all([fetch("https://ar.falsy.cat/indices/linkIndex.583d314a2b3673aeeb61bc5e80c0e369.min.json").then(e=>e.json()).then(e=>({index:e.index,links:e.links})),fetch("https://ar.falsy.cat/indices/contentIndex.a8a72aaf40d4f32d7983da44ed2921fd.min.json").then(e=>e.json())]).then(([{index:e,links:t},n])=>({index:e,links:t,content:n})),render=()=>{const e=new URL(BASE_URL),t=e.pathname,n=window.location.pathname,s=t==n;addCopyButtons(),addTitleToCodeBlocks(),addCollapsibleCallouts(),initPopover("https://ar.falsy.cat",!0);const o=document.getElementById("footer");if(o){const e=document.getElementById("graph-container");if(!e)return requestAnimationFrame(render);e.textContent="";const t=s&&!0;drawGraph("https://ar.falsy.cat",t,[{"/moc":"#4388cc"}],t?{centerForce:1,depth:-1,enableDrag:!0,enableLegend:!1,enableZoom:!0,fontSize:.5,linkDistance:1,opacityScale:3,repelForce:1,scale:1.4}:{centerForce:1,depth:1,enableDrag:!0,enableLegend:!1,enableZoom:!0,fontSize:.6,linkDistance:1,opacityScale:3,repelForce:2,scale:1.2})}var i=document.getElementsByClassName("mermaid");i.length>0&&import("https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs").then(e=>{e.default.init()});function a(n){const e=n.target,t=e.className.split(" "),s=t.includes("broken"),o=t.includes("internal-link");plausible("Link Click",{props:{href:e.href,broken:s,internal:o,graph:!1}})}const r=document.querySelectorAll("a");for(link of r)link.className.includes("root-title")&&link.addEventListener("click",a,{once:!0})},init=(e=document)=>{addCopyButtons(),addTitleToCodeBlocks(),renderMathInElement(e.body,{delimiters:[{left:"$$",right:"$$",display:!0},{left:"$",right:"$",display:!1}],macros:{'':"'"},throwOnError:!1})}</script><script type=module>
import { attachSPARouting } from "https:\/\/ar.falsy.cat\/js\/router.d6fe6bd821db9ea97f9aeefae814d8e7.min.js"
attachSPARouting(init, render)
</script><script defer data-domain=ar.falsy.cat src=https://plausible.io/js/script.js></script>
<script>window.plausible=window.plausible||function(){(window.plausible.q=window.plausible.q||[]).push(arguments)}</script></head><body><div id=search-container><div id=search-space><input autocomplete=off id=search-bar name=search type=text aria-label=Search placeholder="Search for something..."><div id=results-container></div></div></div><script src=https://cdn.jsdelivr.net/npm/flexsearch@0.7.21/dist/flexsearch.bundle.js integrity="sha256-i3A0NZGkhsKjVMzFxv3ksk0DZh3aXqu0l49Bbh0MdjE=" crossorigin=anonymous defer></script>
<script defer src=https://ar.falsy.cat/js/full-text-search.e6e2e0c213187ca0c703d6e2c7a77fcd.min.js></script><div class=singlePage><header><h1 id=page-title><a class=root-title href=https://ar.falsy.cat/>ar.falsy.cat</a></h1><div class=spacer></div><div id=search-icon><p>Search</p><svg tabindex="0" aria-labelledby="title desc" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 19.9 19.7"><title id="title">Search Icon</title><desc id="desc">Icon to open search</desc><g class="search-path" fill="none"><path stroke-linecap="square" d="M18.5 18.3l-5.4-5.4"/><circle cx="8" cy="8" r="7"/></g></svg></div><div class=darkmode><input class=toggle id=darkmode-toggle type=checkbox tabindex=-1>
<label id=toggle-label-light for=darkmode-toggle tabindex=-1><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="dayIcon" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35"><title>Light Mode</title><path d="M6 17.5C6 16.672 5.328 16 4.5 16h-3C.672 16 0 16.672.0 17.5S.672 19 1.5 19h3C5.328 19 6 18.328 6 17.5zM7.5 26c-.414.0-.789.168-1.061.439l-2 2C4.168 28.711 4 29.086 4 29.5 4 30.328 4.671 31 5.5 31c.414.0.789-.168 1.06-.44l2-2C8.832 28.289 9 27.914 9 27.5 9 26.672 8.329 26 7.5 26zm10-20C18.329 6 19 5.328 19 4.5v-3C19 .672 18.329.0 17.5.0S16 .672 16 1.5v3C16 5.328 16.671 6 17.5 6zm10 3c.414.0.789-.168 1.06-.439l2-2C30.832 6.289 31 5.914 31 5.5 31 4.672 30.329 4 29.5 4c-.414.0-.789.168-1.061.44l-2 2C26.168 6.711 26 7.086 26 7.5 26 8.328 26.671 9 27.5 9zM6.439 8.561C6.711 8.832 7.086 9 7.5 9 8.328 9 9 8.328 9 7.5c0-.414-.168-.789-.439-1.061l-2-2C6.289 4.168 5.914 4 5.5 4 4.672 4 4 4.672 4 5.5c0 .414.168.789.439 1.06l2 2.001zM33.5 16h-3c-.828.0-1.5.672-1.5 1.5s.672 1.5 1.5 1.5h3c.828.0 1.5-.672 1.5-1.5S34.328 16 33.5 16zM28.561 26.439C28.289 26.168 27.914 26 27.5 26c-.828.0-1.5.672-1.5 1.5.0.414.168.789.439 1.06l2 2C28.711 30.832 29.086 31 29.5 31c.828.0 1.5-.672 1.5-1.5.0-.414-.168-.789-.439-1.061l-2-2zM17.5 29c-.829.0-1.5.672-1.5 1.5v3c0 .828.671 1.5 1.5 1.5s1.5-.672 1.5-1.5v-3C19 29.672 18.329 29 17.5 29zm0-22C11.71 7 7 11.71 7 17.5S11.71 28 17.5 28 28 23.29 28 17.5 23.29 7 17.5 7zm0 18c-4.136.0-7.5-3.364-7.5-7.5s3.364-7.5 7.5-7.5 7.5 3.364 7.5 7.5S21.636 25 17.5 25z"/></svg></label><label id=toggle-label-dark for=darkmode-toggle tabindex=-1><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="nightIcon" viewBox="0 0 100 100" style="enable-background='new 0 0 100 100'"><title>Dark Mode</title><path d="M96.76 66.458c-.853-.852-2.15-1.064-3.23-.534-6.063 2.991-12.858 4.571-19.655 4.571C62.022 70.495 50.88 65.88 42.5 57.5 29.043 44.043 25.658 23.536 34.076 6.47c.532-1.08.318-2.379-.534-3.23-.851-.852-2.15-1.064-3.23-.534-4.918 2.427-9.375 5.619-13.246 9.491-9.447 9.447-14.65 22.008-14.65 35.369.0 13.36 5.203 25.921 14.65 35.368s22.008 14.65 35.368 14.65c13.361.0 25.921-5.203 35.369-14.65 3.872-3.871 7.064-8.328 9.491-13.246C97.826 68.608 97.611 67.309 96.76 66.458z"/></svg></label></div></header><article><h1>2人の幼女と悪魔とチェス盤</h1><p class=meta>Last updated
Apr 23, 2023</p><ul class=tags><li><a href=https://ar.falsy.cat/tags/note/>Note</a></li><li><a href=https://ar.falsy.cat/tags/word-play/>Word play</a></li></ul><aside class=mainTOC><details><summary>Table of Contents</summary><nav id=TableOfContents><ol><li><a href=#概要>概要</a></li><li><a href=#問題の簡潔化>問題の簡潔化</a></li><li><a href=#解答>解答</a></li><li><a href=#解説>解説</a></li><li><a href=#応用>応用</a></li><li><a href=#参考文献>参考文献</a></li></ol></nav></details></aside><a href=#概要><h2 id=概要><span class=hanchor arialabel=Anchor># </span>概要</h2></a><ul><li>「2人の幼女とチェス盤の部屋」という次のような論理問題を解説する<ul><li>以下の手順の後幼女Bが任意の整数$x\left(0\leq x&lt;64\right)$を求められるようにするには幼女Aはどのような操作を行うべきか<ol><li>悪魔が8x8チェス盤の各マスに1個ずつ合計0個以上64個以下のポーンをランダムに配置する</li><li>悪魔は幼女Aにチェス盤を見せ任意の数字$x\left(0\leq x&lt;64\right)$を伝える</li><li>幼女Aはチェス盤に対して次のいずれかの操作のうち可能であるものを1回だけ必ず行う<ul><li>任意のマスからポーンを1個だけ取り除く</li><li>任意のマスにポーンを1個だけ追加する</li></ul></li><li>悪魔は幼女Bにチェス盤を見せる</li></ol></li></ul></li></ul><a href=#問題の簡潔化><h2 id=問題の簡潔化><span class=hanchor arialabel=Anchor># </span>問題の簡潔化</h2></a><ul><li>$f(g(b,x))=x$とできるような写像$f,g$を求めよ<ul><li>$B=\left\{0,1\right\}$</li><li>$b\in B^{64}$</li><li>$x\in B^6$</li><li>$f: B^{64} \rightarrow B^6$</li><li>$g: B^{64} \times B^6\rightarrow B^{64}$<ul><li>$b$と$g(b,x)$は1ビットだけ異なる</li></ul></li></ul></li></ul><a href=#解答><h2 id=解答><span class=hanchor arialabel=Anchor># </span>解答</h2></a><ul><li>$f(b)=f_0\oplus f_1\oplus f_2 \oplus \dots \oplus f_{63} \quad\left(f_i=i b_i\right)$</li><li>$b&rsquo;=g(b,x) \implies b&rsquo;_m \neq b_m\quad\left(m=x\oplus f(b)\right)$</li><li><a href=https://wandbox.org/permlink/XLo1pGURvrU4Y4Jj rel=noopener>チェス盤が16x16の場合のプログラム</a></li></ul><a href=#解説><h2 id=解説><span class=hanchor arialabel=Anchor># </span>解説</h2></a><ul><li>$x=f(b)\oplus m$となるような$m\in B^6$は必ず存在する</li><li>盤面の各マスに$m$の値を割り当てることで1マスの操作だけで$m$を表現できる<ul><li>盤面のマス目の数も,$m$がとりうる値の数も64</li><li>$f(g(b,x))=f(b)\oplus m=f(b)\oplus f_m\oplus m(1-b_m)$</li></ul></li></ul><a href=#応用><h2 id=応用><span class=hanchor arialabel=Anchor># </span>応用</h2></a><ul><li>長さ$2^N$の任意のビット列について任意の1ビットだけを反転させることで長さ$N$のビット列を表現できる</li></ul><a href=#参考文献><h2 id=参考文献><span class=hanchor arialabel=Anchor># </span>参考文献</h2></a><ul><li><a href=https://sist8.com/chess2you rel=noopener># 超難問論理クイズ「2人の幼女とチェス盤の部屋」が本当に難しすぎた - 明日は未来だ!</a></li><li><a href=https://gist.github.com/catupper/5678658 rel=noopener>幼女問題まとめ - GItHub Gist</a></li><li><a href=http://datagenetics.com/blog/december12014/index.html rel=noopener>Impossible Escape? - DataGenetics</a></li></ul><div class=content-list><h2>Related Notes</h2><ul class=section-ul><li class=section-li><div class=section><p class=meta>Mar 11, 2023</p><div class=desc><h3><a href=https://ar.falsy.cat/note/word-play/japanese-text-all-stars/ class=internal-link data-src=/note/word-play/japanese-text-all-stars/>国語教科書オールスターズ</a></h3></div><div class=spacer></div><ul class=tags><li><a href=https://ar.falsy.cat/tags/note/>Note</a></li><li><a href=https://ar.falsy.cat/tags/word-play/>Word-Play</a></li><li><a href=https://ar.falsy.cat/tags/lifehack/>Lifehack</a></li></ul></div></li><li class=section-li><div class=section><p class=meta>Mar 11, 2023</p><div class=desc><h3><a href=https://ar.falsy.cat/note/word-play/proof-of-reality-using-lucid-dream/ class=internal-link data-src=/note/word-play/proof-of-reality-using-lucid-dream/>明晰夢を利用した現実の証明</a></h3></div><div class=spacer></div><ul class=tags><li><a href=https://ar.falsy.cat/tags/note/>Note</a></li><li><a href=https://ar.falsy.cat/tags/word-play/>Word-Play</a></li><li><a href=https://ar.falsy.cat/tags/lifehack/>Lifehack</a></li></ul></div></li><li class=section-li><div class=section><p class=meta>Mar 18, 2023</p><div class=desc><h3><a href=https://ar.falsy.cat/note/info-tech/install-archlinux/ class=internal-link data-src=/note/info-tech/install-archlinux/>ArchLinuxのインストール</a></h3></div><div class=spacer></div><ul class=tags><li><a href=https://ar.falsy.cat/tags/note/>Note</a></li><li><a href=https://ar.falsy.cat/tags/info-tech/>Info-Tech</a></li><li><a href=https://ar.falsy.cat/tags/linux/>Linux</a></li></ul></div></li></ul></div></article><hr><div class=page-end id=footer><div class=backlinks-container><h3>Backlinks</h3><ul class=backlinks><li>No backlinks found</li></ul></div><div><script async src=https://cdn.jsdelivr.net/npm/d3@6.7.0/dist/d3.min.js integrity="sha256-+7jaYCp29O1JusNWHaYtgUn6EhuP0VaFuswhNV06MyI=" crossorigin=anonymous></script><h3>Interactive Graph</h3><div id=graph-container></div><style>:root{--g-node:var(--secondary);--g-node-active:var(--primary);--g-node-inactive:var(--visited);--g-link:var(--outlinegray);--g-link-active:#5a7282}</style><script src=https://ar.falsy.cat/js/graph.6579af7b10c818dbd2ca038702db0224.js></script></div></div><div id=contact_buttons><footer><p>Made by falsycat using <a href=https://github.com/jackyzha0/quartz>Quartz</a>, © 2023</p><ul><li><a href=https://ar.falsy.cat/>Home</a></li><li><a href=https://falsy.cat/>Portfolio</a></li><li><a href=https://falsy.cat/admin>Fediverse</a></li><li><a href=https://github.com/falsycat>GitHub</a></li><li><a href=https://youtube.com/@falsycat>YouTube</a></li></ul></footer></div></div></body></html>