bsc-leon-vatthauer/agda/bsc-thesis/Relation.Nullary.Negation.html

111 lines
38 KiB
HTML
Raw Normal View History

2024-02-09 17:53:52 +01:00
<!DOCTYPE HTML>
<html><head><meta charset="utf-8"><title>Relation.Nullary.Negation</title><link rel="stylesheet" href="Agda.css"></head><body><pre class="Agda"><a id="1" class="Comment">------------------------------------------------------------------------</a>
<a id="74" class="Comment">-- The Agda standard library</a>
<a id="103" class="Comment">--</a>
<a id="106" class="Comment">-- Properties related to negation</a>
<a id="140" class="Comment">------------------------------------------------------------------------</a>
<a id="214" class="Symbol">{-#</a> <a id="218" class="Keyword">OPTIONS</a> <a id="226" class="Pragma">--cubical-compatible</a> <a id="247" class="Pragma">--safe</a> <a id="254" class="Symbol">#-}</a>
<a id="259" class="Keyword">module</a> <a id="266" href="Relation.Nullary.Negation.html" class="Module">Relation.Nullary.Negation</a> <a id="292" class="Keyword">where</a>
<a id="299" class="Keyword">open</a> <a id="304" class="Keyword">import</a> <a id="311" href="Effect.Monad.html" class="Module">Effect.Monad</a> <a id="324" class="Keyword">using</a> <a id="330" class="Symbol">(</a><a id="331" href="Effect.Monad.html#779" class="Record">RawMonad</a><a id="339" class="Symbol">;</a> <a id="341" href="Effect.Monad.html#1683" class="Function">mkRawMonad</a><a id="351" class="Symbol">)</a>
<a id="353" class="Keyword">open</a> <a id="358" class="Keyword">import</a> <a id="365" href="Data.Bool.Base.html" class="Module">Data.Bool.Base</a> <a id="380" class="Keyword">using</a> <a id="386" class="Symbol">(</a><a id="387" href="Agda.Builtin.Bool.html#173" class="Datatype">Bool</a><a id="391" class="Symbol">;</a> <a id="393" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a><a id="398" class="Symbol">;</a> <a id="400" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a><a id="404" class="Symbol">;</a> <a id="406" href="Data.Bool.Base.html#1505" class="Function Operator">if_then_else_</a><a id="419" class="Symbol">;</a> <a id="421" href="Data.Bool.Base.html#941" class="Function">not</a><a id="424" class="Symbol">)</a>
<a id="426" class="Keyword">open</a> <a id="431" class="Keyword">import</a> <a id="438" href="Data.Empty.html" class="Module">Data.Empty</a> <a id="449" class="Keyword">using</a> <a id="455" class="Symbol">(</a><a id="456" href="Data.Empty.html#1050" class="Function">⊥-elim</a><a id="462" class="Symbol">)</a>
<a id="464" class="Keyword">open</a> <a id="469" class="Keyword">import</a> <a id="476" href="Data.Product.Base.html" class="Module">Data.Product.Base</a> <a id="494" class="Symbol">as</a> <a id="497" class="Module">Prod</a> <a id="502" class="Keyword">using</a> <a id="508" class="Symbol">(</a><a id="509" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">_,_</a><a id="512" class="Symbol">;</a> <a id="514" href="Agda.Builtin.Sigma.html#165" class="Record">Σ</a><a id="515" class="Symbol">;</a> <a id="517" href="Data.Product.Base.html#1244" class="Function">Σ-syntax</a><a id="525" class="Symbol">;</a> <a id="527" href="Data.Product.Base.html#852" class="Function"></a><a id="528" class="Symbol">;</a> <a id="530" href="Data.Product.Base.html#2952" class="Function">curry</a><a id="535" class="Symbol">;</a> <a id="537" href="Data.Product.Base.html#3109" class="Function">uncurry</a><a id="544" class="Symbol">)</a>
<a id="546" class="Keyword">open</a> <a id="551" class="Keyword">import</a> <a id="558" href="Data.Sum.Base.html" class="Module">Data.Sum.Base</a> <a id="572" class="Symbol">as</a> <a id="575" class="Module">Sum</a> <a id="579" class="Keyword">using</a> <a id="585" class="Symbol">(</a><a id="586" href="Data.Sum.Base.html#625" class="Datatype Operator">_⊎_</a><a id="589" class="Symbol">;</a> <a id="591" href="Data.Sum.Base.html#675" class="InductiveConstructor">inj₁</a><a id="595" class="Symbol">;</a> <a id="597" href="Data.Sum.Base.html#700" class="InductiveConstructor">inj₂</a><a id="601" class="Symbol">;</a> <a id="603" href="Data.Sum.Base.html#811" class="Function Operator">[_,_]</a><a id="608" class="Symbol">)</a>
<a id="610" class="Keyword">open</a> <a id="615" class="Keyword">import</a> <a id="622" href="Function.Base.html" class="Module">Function.Base</a> <a id="636" class="Keyword">using</a> <a id="642" class="Symbol">(</a><a id="643" href="Function.Base.html#1638" class="Function">flip</a><a id="647" class="Symbol">;</a> <a id="649" href="Function.Base.html#1115" class="Function Operator">_∘_</a><a id="652" class="Symbol">;</a> <a id="654" href="Function.Base.html#725" class="Function">const</a><a id="659" class="Symbol">;</a> <a id="661" href="Function.Base.html#3626" class="Function Operator">_∘_</a><a id="665" class="Symbol">)</a>
<a id="667" class="Keyword">open</a> <a id="672" class="Keyword">import</a> <a id="679" href="Level.html" class="Module">Level</a> <a id="685" class="Keyword">using</a> <a id="691" class="Symbol">(</a><a id="692" href="Agda.Primitive.html#742" class="Postulate">Level</a><a id="697" class="Symbol">)</a>
<a id="699" class="Keyword">open</a> <a id="704" class="Keyword">import</a> <a id="711" href="Relation.Nullary.Decidable.Core.html" class="Module">Relation.Nullary.Decidable.Core</a> <a id="743" class="Keyword">using</a> <a id="749" class="Symbol">(</a><a id="750" href="Relation.Nullary.Decidable.Core.html#1485" class="Record">Dec</a><a id="753" class="Symbol">;</a> <a id="755" href="Relation.Nullary.Decidable.Core.html#1618" class="InductiveConstructor">yes</a><a id="758" class="Symbol">;</a> <a id="760" href="Relation.Nullary.Decidable.Core.html#1655" class="InductiveConstructor">no</a><a id="762" class="Symbol">;</a> <a id="764" href="Relation.Nullary.Decidable.Core.html#5630" class="Function">¬¬-excluded-middle</a><a id="782" class="Symbol">)</a>
<a id="784" class="Keyword">open</a> <a id="789" class="Keyword">import</a> <a id="796" href="Relation.Unary.html" class="Module">Relation.Unary</a> <a id="811" class="Keyword">using</a> <a id="817" class="Symbol">(</a><a id="818" href="Relation.Unary.html#3491" class="Function">Universal</a><a id="827" class="Symbol">;</a> <a id="829" href="Relation.Unary.html#1232" class="Function">Pred</a><a id="833" class="Symbol">)</a>
<a id="836" class="Keyword">private</a>
<a id="846" class="Keyword">variable</a>
<a id="859" href="Relation.Nullary.Negation.html#859" class="Generalizable">a</a> <a id="861" href="Relation.Nullary.Negation.html#861" class="Generalizable">b</a> <a id="863" href="Relation.Nullary.Negation.html#863" class="Generalizable">c</a> <a id="865" href="Relation.Nullary.Negation.html#865" class="Generalizable">d</a> <a id="867" href="Relation.Nullary.Negation.html#867" class="Generalizable">p</a> <a id="869" href="Relation.Nullary.Negation.html#869" class="Generalizable">w</a> <a id="871" class="Symbol">:</a> <a id="873" href="Agda.Primitive.html#742" class="Postulate">Level</a>
<a id="883" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="885" href="Relation.Nullary.Negation.html#885" class="Generalizable">B</a> <a id="887" href="Relation.Nullary.Negation.html#887" class="Generalizable">C</a> <a id="889" href="Relation.Nullary.Negation.html#889" class="Generalizable">D</a> <a id="891" class="Symbol">:</a> <a id="893" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="897" href="Relation.Nullary.Negation.html#859" class="Generalizable">a</a>
<a id="903" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="905" class="Symbol">:</a> <a id="907" href="Relation.Unary.html#1232" class="Function">Pred</a> <a id="912" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="914" href="Relation.Nullary.Negation.html#867" class="Generalizable">p</a>
<a id="920" href="Relation.Nullary.Negation.html#920" class="Generalizable">Whatever</a> <a id="929" class="Symbol">:</a> <a id="931" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="935" href="Relation.Nullary.Negation.html#869" class="Generalizable">w</a>
<a id="938" class="Comment">------------------------------------------------------------------------</a>
<a id="1011" class="Comment">-- Re-export public definitions</a>
<a id="1044" class="Keyword">open</a> <a id="1049" class="Keyword">import</a> <a id="1056" href="Relation.Nullary.Negation.Core.html" class="Module">Relation.Nullary.Negation.Core</a> <a id="1087" class="Keyword">public</a>
<a id="1095" class="Comment">------------------------------------------------------------------------</a>
<a id="1168" class="Comment">-- Quantifier juggling</a>
<a id="∃⟶¬∀¬"></a><a id="1192" href="Relation.Nullary.Negation.html#1192" class="Function">∃⟶¬∀¬</a> <a id="1198" class="Symbol">:</a> <a id="1200" href="Data.Product.Base.html#852" class="Function"></a> <a id="1202" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1204" class="Symbol"></a> <a id="1206" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1208" class="Symbol">(∀</a> <a id="1211" href="Relation.Nullary.Negation.html#1211" class="Bound">x</a> <a id="1213" class="Symbol"></a> <a id="1215" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1217" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1219" href="Relation.Nullary.Negation.html#1211" class="Bound">x</a><a id="1220" class="Symbol">)</a>
<a id="1222" href="Relation.Nullary.Negation.html#1192" class="Function">∃⟶¬∀¬</a> <a id="1228" class="Symbol">=</a> <a id="1230" href="Function.Base.html#1638" class="Function">flip</a> <a id="1235" href="Data.Product.Base.html#3109" class="Function">uncurry</a>
<a id="∀⟶¬∃¬"></a><a id="1244" href="Relation.Nullary.Negation.html#1244" class="Function">∀⟶¬∃¬</a> <a id="1250" class="Symbol">:</a> <a id="1252" class="Symbol">(∀</a> <a id="1255" href="Relation.Nullary.Negation.html#1255" class="Bound">x</a> <a id="1257" class="Symbol"></a> <a id="1259" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1261" href="Relation.Nullary.Negation.html#1255" class="Bound">x</a><a id="1262" class="Symbol">)</a> <a id="1264" class="Symbol"></a> <a id="1266" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1268" href="Data.Product.Base.html#852" class="Function"></a> <a id="1270" class="Symbol">λ</a> <a id="1272" href="Relation.Nullary.Negation.html#1272" class="Bound">x</a> <a id="1274" class="Symbol"></a> <a id="1276" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1278" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1280" href="Relation.Nullary.Negation.html#1272" class="Bound">x</a>
<a id="1282" href="Relation.Nullary.Negation.html#1244" class="Function">∀⟶¬∃¬</a> <a id="1288" href="Relation.Nullary.Negation.html#1288" class="Bound">∀xPx</a> <a id="1293" class="Symbol">(</a><a id="1294" href="Relation.Nullary.Negation.html#1294" class="Bound">x</a> <a id="1296" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">,</a> <a id="1298" href="Relation.Nullary.Negation.html#1298" class="Bound">¬Px</a><a id="1301" class="Symbol">)</a> <a id="1303" class="Symbol">=</a> <a id="1305" href="Relation.Nullary.Negation.html#1298" class="Bound">¬Px</a> <a id="1309" class="Symbol">(</a><a id="1310" href="Relation.Nullary.Negation.html#1288" class="Bound">∀xPx</a> <a id="1315" href="Relation.Nullary.Negation.html#1294" class="Bound">x</a><a id="1316" class="Symbol">)</a>
<a id="¬∃⟶∀¬"></a><a id="1319" href="Relation.Nullary.Negation.html#1319" class="Function">¬∃⟶∀¬</a> <a id="1325" class="Symbol">:</a> <a id="1327" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1329" href="Data.Product.Base.html#852" class="Function"></a> <a id="1331" class="Symbol"></a> <a id="1334" href="Relation.Nullary.Negation.html#1334" class="Bound">x</a> <a id="1336" class="Symbol"></a> <a id="1338" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1340" href="Relation.Nullary.Negation.html#1334" class="Bound">x</a><a id="1341" class="Symbol">)</a> <a id="1343" class="Symbol"></a> <a id="1345" class="Symbol"></a> <a id="1347" href="Relation.Nullary.Negation.html#1347" class="Bound">x</a> <a id="1349" class="Symbol"></a> <a id="1351" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1353" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1355" href="Relation.Nullary.Negation.html#1347" class="Bound">x</a>
<a id="1357" href="Relation.Nullary.Negation.html#1319" class="Function">¬∃⟶∀¬</a> <a id="1363" class="Symbol">=</a> <a id="1365" href="Data.Product.Base.html#2952" class="Function">curry</a>
<a id="∀¬⟶¬∃"></a><a id="1372" href="Relation.Nullary.Negation.html#1372" class="Function">∀¬⟶¬∃</a> <a id="1378" class="Symbol">:</a> <a id="1380" class="Symbol">(∀</a> <a id="1383" href="Relation.Nullary.Negation.html#1383" class="Bound">x</a> <a id="1385" class="Symbol"></a> <a id="1387" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1389" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1391" href="Relation.Nullary.Negation.html#1383" class="Bound">x</a><a id="1392" class="Symbol">)</a> <a id="1394" class="Symbol"></a> <a id="1396" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1398" href="Data.Product.Base.html#852" class="Function"></a> <a id="1400" class="Symbol"></a> <a id="1403" href="Relation.Nullary.Negation.html#1403" class="Bound">x</a> <a id="1405" class="Symbol"></a> <a id="1407" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1409" href="Relation.Nullary.Negation.html#1403" class="Bound">x</a><a id="1410" class="Symbol">)</a>
<a id="1412" href="Relation.Nullary.Negation.html#1372" class="Function">∀¬⟶¬∃</a> <a id="1418" class="Symbol">=</a> <a id="1420" href="Data.Product.Base.html#3109" class="Function">uncurry</a>
<a id="∃¬⟶¬∀"></a><a id="1429" href="Relation.Nullary.Negation.html#1429" class="Function">∃¬⟶¬∀</a> <a id="1435" class="Symbol">:</a> <a id="1437" href="Data.Product.Base.html#852" class="Function"></a> <a id="1439" class="Symbol"></a> <a id="1442" href="Relation.Nullary.Negation.html#1442" class="Bound">x</a> <a id="1444" class="Symbol"></a> <a id="1446" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1448" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1450" href="Relation.Nullary.Negation.html#1442" class="Bound">x</a><a id="1451" class="Symbol">)</a> <a id="1453" class="Symbol"></a> <a id="1455" href="Relation.Nullary.Negation.Core.html#698" class="Function Operator">¬</a> <a id="1457" class="Symbol">(∀</a> <a id="1460" href="Relation.Nullary.Negation.html#1460" class="Bound">x</a> <a id="1462" class="Symbol"></a> <a id="1464" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1466" href="Relation.Nullary.Negation.html#1460" class="Bound">x</a><a id="1467" class="Symbol">)</a>
<a id="1469" href="Relation.Nullary.Negation.html#1429" class="Function">∃¬⟶¬∀</a> <a id="1475" class="Symbol">=</a> <a id="1477" href="Function.Base.html#1638" class="Function">flip</a> <a id="1482" href="Relation.Nullary.Negation.html#1244" class="Function">∀⟶¬∃¬</a>
<a id="1489" class="Comment">------------------------------------------------------------------------</a>
<a id="1562" class="Comment">-- Double Negation</a>
<a id="1582" class="Comment">-- Double-negation is a monad (if we assume that all elements of ¬ ¬ P</a>
<a id="1653" class="Comment">-- are equal).</a>
<a id="¬¬-Monad"></a><a id="1669" href="Relation.Nullary.Negation.html#1669" class="Function">¬¬-Monad</a> <a id="1678" class="Symbol">:</a> <a id="1680" href="Effect.Monad.html#779" class="Record">RawMonad</a> <a id="1689" class="Symbol">{</a><a id="1690" href="Relation.Nullary.Negation.html#859" class="Generalizable">a</a><a id="1691" class="Symbol">}</a> <a id="1693" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a>
<a id="1708" href="Relation.Nullary.Negation.html#1669" class="Function">¬¬-Monad</a> <a id="1717" class="Symbol">=</a> <a id="1719" href="Effect.Monad.html#1683" class="Function">mkRawMonad</a>
<a id="1732" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a>
<a id="1749" href="Relation.Nullary.Negation.Core.html#1226" class="Function">contradiction</a>
<a id="1765" class="Symbol"></a> <a id="1768" href="Relation.Nullary.Negation.html#1768" class="Bound">x</a> <a id="1770" href="Relation.Nullary.Negation.html#1770" class="Bound">f</a> <a id="1772" class="Symbol"></a> <a id="1774" href="Relation.Nullary.Negation.Core.html#1711" class="Function">negated-stable</a> <a id="1789" class="Symbol">(</a><a id="1790" href="Relation.Nullary.Negation.Core.html#1778" class="Function">¬¬-map</a> <a id="1797" href="Relation.Nullary.Negation.html#1770" class="Bound">f</a> <a id="1799" href="Relation.Nullary.Negation.html#1768" class="Bound">x</a><a id="1800" class="Symbol">))</a>
<a id="¬¬-push"></a><a id="1804" href="Relation.Nullary.Negation.html#1804" class="Function">¬¬-push</a> <a id="1812" class="Symbol">:</a> <a id="1814" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="1829" href="Relation.Unary.html#3491" class="Function">Π[</a> <a id="1832" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1834" href="Relation.Unary.html#3491" class="Function">]</a> <a id="1836" class="Symbol"></a> <a id="1838" href="Relation.Unary.html#3491" class="Function">Π[</a> <a id="1841" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="1856" href="Function.Base.html#1115" class="Function Operator"></a> <a id="1858" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="1860" href="Relation.Unary.html#3491" class="Function">]</a>
<a id="1862" href="Relation.Nullary.Negation.html#1804" class="Function">¬¬-push</a> <a id="1870" href="Relation.Nullary.Negation.html#1870" class="Bound">¬¬∀P</a> <a id="1875" href="Relation.Nullary.Negation.html#1875" class="Bound">a</a> <a id="1877" href="Relation.Nullary.Negation.html#1877" class="Bound">¬Pa</a> <a id="1881" class="Symbol">=</a> <a id="1883" href="Relation.Nullary.Negation.html#1870" class="Bound">¬¬∀P</a> <a id="1888" class="Symbol"></a> <a id="1891" href="Relation.Nullary.Negation.html#1891" class="Bound">∀P</a> <a id="1894" class="Symbol"></a> <a id="1896" href="Relation.Nullary.Negation.html#1877" class="Bound">¬Pa</a> <a id="1900" class="Symbol">(</a><a id="1901" href="Relation.Nullary.Negation.html#1891" class="Bound">∀P</a> <a id="1904" href="Relation.Nullary.Negation.html#1875" class="Bound">a</a><a id="1905" class="Symbol">))</a>
<a id="1909" class="Comment">-- If Whatever is instantiated with ¬ ¬ something, then this function</a>
<a id="1979" class="Comment">-- is call with current continuation in the double-negation monad, or,</a>
<a id="2050" class="Comment">-- if you will, a double-negation translation of Peirce&#39;s law.</a>
<a id="2113" class="Comment">--</a>
<a id="2116" class="Comment">-- In order to prove ¬ ¬ P one can assume ¬ P and prove ⊥. However,</a>
<a id="2184" class="Comment">-- sometimes it is nice to avoid leaving the double-negation monad; in</a>
<a id="2255" class="Comment">-- that case this function can be used (with Whatever instantiated to</a>
<a id="2325" class="Comment">-- ⊥).</a>
<a id="call/cc"></a><a id="2333" href="Relation.Nullary.Negation.html#2333" class="Function">call/cc</a> <a id="2341" class="Symbol">:</a> <a id="2343" class="Symbol">((</a><a id="2345" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2347" class="Symbol"></a> <a id="2349" href="Relation.Nullary.Negation.html#920" class="Generalizable">Whatever</a><a id="2357" class="Symbol">)</a> <a id="2359" class="Symbol"></a> <a id="2361" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="2376" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a><a id="2377" class="Symbol">)</a> <a id="2379" class="Symbol"></a> <a id="2381" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="2396" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a>
<a id="2398" href="Relation.Nullary.Negation.html#2333" class="Function">call/cc</a> <a id="2406" href="Relation.Nullary.Negation.html#2406" class="Bound">hyp</a> <a id="2410" href="Relation.Nullary.Negation.html#2410" class="Bound">¬a</a> <a id="2413" class="Symbol">=</a> <a id="2415" href="Relation.Nullary.Negation.html#2406" class="Bound">hyp</a> <a id="2419" class="Symbol"></a> <a id="2422" href="Relation.Nullary.Negation.html#2422" class="Bound">a</a> <a id="2424" class="Symbol"></a> <a id="2426" href="Data.Empty.html#1050" class="Function">⊥-elim</a> <a id="2433" class="Symbol">(</a><a id="2434" href="Relation.Nullary.Negation.html#2410" class="Bound">¬a</a> <a id="2437" href="Relation.Nullary.Negation.html#2422" class="Bound">a</a><a id="2438" class="Symbol">))</a> <a id="2441" href="Relation.Nullary.Negation.html#2410" class="Bound">¬a</a>
<a id="2445" class="Comment">-- The &quot;independence of premise&quot; rule, in the double-negation monad.</a>
<a id="2514" class="Comment">-- It is assumed that the index set (A) is inhabited.</a>
<a id="independence-of-premise"></a><a id="2569" href="Relation.Nullary.Negation.html#2569" class="Function">independence-of-premise</a> <a id="2593" class="Symbol">:</a> <a id="2595" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2597" class="Symbol"></a> <a id="2599" class="Symbol">(</a><a id="2600" href="Relation.Nullary.Negation.html#885" class="Generalizable">B</a> <a id="2602" class="Symbol"></a> <a id="2604" href="Agda.Builtin.Sigma.html#165" class="Record">Σ</a> <a id="2606" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2608" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a><a id="2609" class="Symbol">)</a> <a id="2611" class="Symbol"></a> <a id="2613" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="2628" class="Symbol">(</a><a id="2629" href="Data.Product.Base.html#1244" class="Function">Σ[</a> <a id="2632" href="Relation.Nullary.Negation.html#2632" class="Bound">x</a> <a id="2634" href="Data.Product.Base.html#1244" class="Function"></a> <a id="2636" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2638" href="Data.Product.Base.html#1244" class="Function">]</a> <a id="2640" class="Symbol">(</a><a id="2641" href="Relation.Nullary.Negation.html#885" class="Generalizable">B</a> <a id="2643" class="Symbol"></a> <a id="2645" href="Relation.Nullary.Negation.html#903" class="Generalizable">P</a> <a id="2647" href="Relation.Nullary.Negation.html#2632" class="Bound">x</a><a id="2648" class="Symbol">))</a>
<a id="2651" href="Relation.Nullary.Negation.html#2569" class="Function">independence-of-premise</a> <a id="2675" class="Symbol">{</a><a id="2676" class="Argument">A</a> <a id="2678" class="Symbol">=</a> <a id="2680" href="Relation.Nullary.Negation.html#2680" class="Bound">A</a><a id="2681" class="Symbol">}</a> <a id="2683" class="Symbol">{</a><a id="2684" class="Argument">B</a> <a id="2686" class="Symbol">=</a> <a id="2688" href="Relation.Nullary.Negation.html#2688" class="Bound">B</a><a id="2689" class="Symbol">}</a> <a id="2691" class="Symbol">{</a><a id="2692" class="Argument">P</a> <a id="2694" class="Symbol">=</a> <a id="2696" href="Relation.Nullary.Negation.html#2696" class="Bound">P</a><a id="2697" class="Symbol">}</a> <a id="2699" href="Relation.Nullary.Negation.html#2699" class="Bound">q</a> <a id="2701" href="Relation.Nullary.Negation.html#2701" class="Bound">f</a> <a id="2703" class="Symbol">=</a> <a id="2705" href="Relation.Nullary.Negation.Core.html#1778" class="Function">¬¬-map</a> <a id="2712" href="Relation.Nullary.Negation.html#2748" class="Function">helper</a> <a id="2719" href="Relation.Nullary.Decidable.Core.html#5630" class="Function">¬¬-excluded-middle</a>
<a id="2740" class="Keyword">where</a>
<a id="2748" href="Relation.Nullary.Negation.html#2748" class="Function">helper</a> <a id="2755" class="Symbol">:</a> <a id="2757" href="Relation.Nullary.Decidable.Core.html#1485" class="Record">Dec</a> <a id="2761" href="Relation.Nullary.Negation.html#2688" class="Bound">B</a> <a id="2763" class="Symbol"></a> <a id="2765" href="Data.Product.Base.html#1244" class="Function">Σ[</a> <a id="2768" href="Relation.Nullary.Negation.html#2768" class="Bound">x</a> <a id="2770" href="Data.Product.Base.html#1244" class="Function"></a> <a id="2772" href="Relation.Nullary.Negation.html#2680" class="Bound">A</a> <a id="2774" href="Data.Product.Base.html#1244" class="Function">]</a> <a id="2776" class="Symbol">(</a><a id="2777" href="Relation.Nullary.Negation.html#2688" class="Bound">B</a> <a id="2779" class="Symbol"></a> <a id="2781" href="Relation.Nullary.Negation.html#2696" class="Bound">P</a> <a id="2783" href="Relation.Nullary.Negation.html#2768" class="Bound">x</a><a id="2784" class="Symbol">)</a>
<a id="2788" href="Relation.Nullary.Negation.html#2748" class="Function">helper</a> <a id="2795" class="Symbol">(</a><a id="2796" href="Relation.Nullary.Decidable.Core.html#1618" class="InductiveConstructor">yes</a> <a id="2800" href="Relation.Nullary.Negation.html#2800" class="Bound">p</a><a id="2801" class="Symbol">)</a> <a id="2803" class="Symbol">=</a> <a id="2805" href="Data.Product.Base.html#2362" class="Function">Prod.map₂</a> <a id="2815" href="Function.Base.html#725" class="Function">const</a> <a id="2821" class="Symbol">(</a><a id="2822" href="Relation.Nullary.Negation.html#2701" class="Bound">f</a> <a id="2824" href="Relation.Nullary.Negation.html#2800" class="Bound">p</a><a id="2825" class="Symbol">)</a>
<a id="2829" href="Relation.Nullary.Negation.html#2748" class="Function">helper</a> <a id="2836" class="Symbol">(</a><a id="2837" href="Relation.Nullary.Decidable.Core.html#1655" class="InductiveConstructor">no</a> <a id="2840" href="Relation.Nullary.Negation.html#2840" class="Bound">¬p</a><a id="2842" class="Symbol">)</a> <a id="2844" class="Symbol">=</a> <a id="2846" class="Symbol">(</a><a id="2847" href="Relation.Nullary.Negation.html#2699" class="Bound">q</a> <a id="2849" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">,</a> <a id="2851" href="Data.Empty.html#1050" class="Function">⊥-elim</a> <a id="2858" href="Function.Base.html#3626" class="Function Operator">∘′</a> <a id="2861" href="Relation.Nullary.Negation.html#2840" class="Bound">¬p</a><a id="2863" class="Symbol">)</a>
<a id="2866" class="Comment">-- The independence of premise rule for binary sums.</a>
<a id="independence-of-premise-⊎"></a><a id="2920" href="Relation.Nullary.Negation.html#2920" class="Function">independence-of-premise-⊎</a> <a id="2946" class="Symbol">:</a> <a id="2948" class="Symbol">(</a><a id="2949" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2951" class="Symbol"></a> <a id="2953" href="Relation.Nullary.Negation.html#885" class="Generalizable">B</a> <a id="2955" href="Data.Sum.Base.html#625" class="Datatype Operator"></a> <a id="2957" href="Relation.Nullary.Negation.html#887" class="Generalizable">C</a><a id="2958" class="Symbol">)</a> <a id="2960" class="Symbol"></a> <a id="2962" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="2977" class="Symbol">((</a><a id="2979" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2981" class="Symbol"></a> <a id="2983" href="Relation.Nullary.Negation.html#885" class="Generalizable">B</a><a id="2984" class="Symbol">)</a> <a id="2986" href="Data.Sum.Base.html#625" class="Datatype Operator"></a> <a id="2988" class="Symbol">(</a><a id="2989" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="2991" class="Symbol"></a> <a id="2993" href="Relation.Nullary.Negation.html#887" class="Generalizable">C</a><a id="2994" class="Symbol">))</a>
<a id="2997" href="Relation.Nullary.Negation.html#2920" class="Function">independence-of-premise-⊎</a> <a id="3023" class="Symbol">{</a><a id="3024" class="Argument">A</a> <a id="3026" class="Symbol">=</a> <a id="3028" href="Relation.Nullary.Negation.html#3028" class="Bound">A</a><a id="3029" class="Symbol">}</a> <a id="3031" class="Symbol">{</a><a id="3032" class="Argument">B</a> <a id="3034" class="Symbol">=</a> <a id="3036" href="Relation.Nullary.Negation.html#3036" class="Bound">B</a><a id="3037" class="Symbol">}</a> <a id="3039" class="Symbol">{</a><a id="3040" class="Argument">C</a> <a id="3042" class="Symbol">=</a> <a id="3044" href="Relation.Nullary.Negation.html#3044" class="Bound">C</a><a id="3045" class="Symbol">}</a> <a id="3047" href="Relation.Nullary.Negation.html#3047" class="Bound">f</a> <a id="3049" class="Symbol">=</a> <a id="3051" href="Relation.Nullary.Negation.Core.html#1778" class="Function">¬¬-map</a> <a id="3058" href="Relation.Nullary.Negation.html#3094" class="Function">helper</a> <a id="3065" href="Relation.Nullary.Decidable.Core.html#5630" class="Function">¬¬-excluded-middle</a>
<a id="3086" class="Keyword">where</a>
<a id="3094" href="Relation.Nullary.Negation.html#3094" class="Function">helper</a> <a id="3101" class="Symbol">:</a> <a id="3103" href="Relation.Nullary.Decidable.Core.html#1485" class="Record">Dec</a> <a id="3107" href="Relation.Nullary.Negation.html#3028" class="Bound">A</a> <a id="3109" class="Symbol"></a> <a id="3111" class="Symbol">(</a><a id="3112" href="Relation.Nullary.Negation.html#3028" class="Bound">A</a> <a id="3114" class="Symbol"></a> <a id="3116" href="Relation.Nullary.Negation.html#3036" class="Bound">B</a><a id="3117" class="Symbol">)</a> <a id="3119" href="Data.Sum.Base.html#625" class="Datatype Operator"></a> <a id="3121" class="Symbol">(</a><a id="3122" href="Relation.Nullary.Negation.html#3028" class="Bound">A</a> <a id="3124" class="Symbol"></a> <a id="3126" href="Relation.Nullary.Negation.html#3044" class="Bound">C</a><a id="3127" class="Symbol">)</a>
<a id="3131" href="Relation.Nullary.Negation.html#3094" class="Function">helper</a> <a id="3138" class="Symbol">(</a><a id="3139" href="Relation.Nullary.Decidable.Core.html#1618" class="InductiveConstructor">yes</a> <a id="3143" href="Relation.Nullary.Negation.html#3143" class="Bound">p</a><a id="3144" class="Symbol">)</a> <a id="3146" class="Symbol">=</a> <a id="3148" href="Data.Sum.Base.html#1253" class="Function">Sum.map</a> <a id="3156" href="Function.Base.html#725" class="Function">const</a> <a id="3162" href="Function.Base.html#725" class="Function">const</a> <a id="3168" class="Symbol">(</a><a id="3169" href="Relation.Nullary.Negation.html#3047" class="Bound">f</a> <a id="3171" href="Relation.Nullary.Negation.html#3143" class="Bound">p</a><a id="3172" class="Symbol">)</a>
<a id="3176" href="Relation.Nullary.Negation.html#3094" class="Function">helper</a> <a id="3183" class="Symbol">(</a><a id="3184" href="Relation.Nullary.Decidable.Core.html#1655" class="InductiveConstructor">no</a> <a id="3187" href="Relation.Nullary.Negation.html#3187" class="Bound">¬p</a><a id="3189" class="Symbol">)</a> <a id="3191" class="Symbol">=</a> <a id="3193" href="Data.Sum.Base.html#675" class="InductiveConstructor">inj₁</a> <a id="3198" class="Symbol">(</a><a id="3199" href="Data.Empty.html#1050" class="Function">⊥-elim</a> <a id="3206" href="Function.Base.html#3626" class="Function Operator">∘′</a> <a id="3209" href="Relation.Nullary.Negation.html#3187" class="Bound">¬p</a><a id="3211" class="Symbol">)</a>
<a id="3214" class="Keyword">private</a>
<a id="3225" class="Comment">-- Note that independence-of-premise-⊎ is a consequence of</a>
<a id="3286" class="Comment">-- independence-of-premise (for simplicity it is assumed that Q and</a>
<a id="3356" class="Comment">-- R have the same type here):</a>
<a id="corollary"></a><a id="3390" href="Relation.Nullary.Negation.html#3390" class="Function">corollary</a> <a id="3400" class="Symbol">:</a> <a id="3402" class="Symbol">{</a><a id="3403" href="Relation.Nullary.Negation.html#3403" class="Bound">B</a> <a id="3405" href="Relation.Nullary.Negation.html#3405" class="Bound">C</a> <a id="3407" class="Symbol">:</a> <a id="3409" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="3413" href="Relation.Nullary.Negation.html#861" class="Generalizable">b</a><a id="3414" class="Symbol">}</a> <a id="3416" class="Symbol"></a> <a id="3418" class="Symbol">(</a><a id="3419" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="3421" class="Symbol"></a> <a id="3423" href="Relation.Nullary.Negation.html#3403" class="Bound">B</a> <a id="3425" href="Data.Sum.Base.html#625" class="Datatype Operator"></a> <a id="3427" href="Relation.Nullary.Negation.html#3405" class="Bound">C</a><a id="3428" class="Symbol">)</a> <a id="3430" class="Symbol"></a> <a id="3432" href="Relation.Nullary.Negation.Core.html#837" class="Function">DoubleNegation</a> <a id="3447" class="Symbol">((</a><a id="3449" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="3451" class="Symbol"></a> <a id="3453" href="Relation.Nullary.Negation.html#3403" class="Bound">B</a><a id="3454" class="Symbol">)</a> <a id="3456" href="Data.Sum.Base.html#625" class="Datatype Operator"></a> <a id="3458" class="Symbol">(</a><a id="3459" href="Relation.Nullary.Negation.html#883" class="Generalizable">A</a> <a id="3461" class="Symbol"></a> <a id="3463" href="Relation.Nullary.Negation.html#3405" class="Bound">C</a><a id="3464" class="Symbol">))</a>
<a id="3469" href="Relation.Nullary.Negation.html#3390" class="Function">corollary</a> <a id="3479" class="Symbol">{</a><a id="3480" class="Argument">A</a> <a id="3482" class="Symbol">=</a> <a id="3484" href="Relation.Nullary.Negation.html#3484" class="Bound">A</a><a id="3485" class="Symbol">}</a> <a id="3487" class="Symbol">{</a><a id="3488" class="Argument">B</a> <a id="3490" class="Symbol">=</a> <a id="3492" href="Relation.Nullary.Negation.html#3492" class="Bound">B</a><a id="3493" class="Symbol">}</a> <a id="3495" class="Symbol">{</a><a id="3496" class="Argument">C</a> <a id="3498" class="Symbol">=</a> <a id="3500" href="Relation.Nullary.Negation.html#3500" class="Bound">C</a><a id="3501" class="Symbol">}</a> <a id="3503" href="Relation.Nullary.Negation.html#3503" class="Bound">f</a> <a id="3505" class="Symbol">=</a>
<a id="3511" href="Relation.Nullary.Negation.Core.html#1778" class="Function">¬¬-map</a> <a id="3518" href="Relation.Nullary.Negation.html#3602" class="Function">helper</a> <a id="3525" class="Symbol">(</a><a id="3526" href="Relation.Nullary.Negation.html#2569" class="Function">independence-of-premise</a> <a id="3550" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a> <a id="3555" class="Symbol">(</a><a id="3556" href="Data.Sum.Base.html#811" class="Function Operator">[</a> <a id="3558" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">_,_</a> <a id="3562" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a> <a id="3567" href="Data.Sum.Base.html#811" class="Function Operator">,</a> <a id="3569" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">_,_</a> <a id="3573" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a> <a id="3579" href="Data.Sum.Base.html#811" class="Function Operator">]</a> <a id="3581" href="Function.Base.html#3626" class="Function Operator">∘′</a> <a id="3584" href="Relation.Nullary.Negation.html#3503" class="Bound">f</a><a id="3585" class="Symbol">))</a>
<a id="3592" class="Keyword">where</a>
<a id="3602" href="Relation.Nullary.Negation.html#3602" class="Function">helper</a> <a id="3609" class="Symbol">:</a> <a id="3611" href="Data.Product.Base.html#852" class="Function"></a> <a id="3613" class="Symbol"></a> <a id="3616" href="Relation.Nullary.Negation.html#3616" class="Bound">b</a> <a id="3618" class="Symbol"></a> <a id="3620" href="Relation.Nullary.Negation.html#3484" class="Bound">A</a> <a id="3622" class="Symbol"></a> <a id="3624" href="Data.Bool.Base.html#1505" class="Function Operator">if</a> <a id="3627" href="Relation.Nullary.Negation.html#3616" class="Bound">b</a> <a id="3629" href="Data.Bool.Base.html#1505" class="Function Operator">then</a> <a id="3634" href="Relation.Nullary.Negation.html#3492" class="Bound">B</a> <a id="3636" href="Data.Bool.Base.html#1505" class="Function Operator">else</a> <a id="3641" href="Relation.Nullary.Negation.html#3500" class="Bound">C</a><a id="3642" class="Symbol">)</a> <a id="3644" class="Symbol"></a> <a id="3646" class="Symbol">(</a><a id="3647" href="Relation.Nullary.Negation.html#3484" class="Bound">A</a> <a id="3649" class="Symbol"></a> <a id="3651" href="Relation.Nullary.Negation.html#3492" class="Bound">B</a><a id="3652" class="Symbol">)</a> <a id="3654" href="Data.Sum.Base.html#625" class="Datatype Operator"></a> <a id="3656" class="Symbol">(</a><a id="3657" href="Relation.Nullary.Negation.html#3484" class="Bound">A</a> <a id="3659" class="Symbol"></a> <a id="3661" href="Relation.Nullary.Negation.html#3500" class="Bound">C</a><a id="3662" class="Symbol">)</a>
<a id="3668" href="Relation.Nullary.Negation.html#3602" class="Function">helper</a> <a id="3675" class="Symbol">(</a><a id="3676" href="Agda.Builtin.Bool.html#198" class="InductiveConstructor">true</a> <a id="3682" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">,</a> <a id="3684" href="Relation.Nullary.Negation.html#3684" class="Bound">f</a><a id="3685" class="Symbol">)</a> <a id="3687" class="Symbol">=</a> <a id="3689" href="Data.Sum.Base.html#675" class="InductiveConstructor">inj₁</a> <a id="3694" href="Relation.Nullary.Negation.html#3684" class="Bound">f</a>
<a id="3700" href="Relation.Nullary.Negation.html#3602" class="Function">helper</a> <a id="3707" class="Symbol">(</a><a id="3708" href="Agda.Builtin.Bool.html#192" class="InductiveConstructor">false</a> <a id="3714" href="Agda.Builtin.Sigma.html#235" class="InductiveConstructor Operator">,</a> <a id="3716" href="Relation.Nullary.Negation.html#3716" class="Bound">f</a><a id="3717" class="Symbol">)</a> <a id="3719" class="Symbol">=</a> <a id="3721" href="Data.Sum.Base.html#700" class="InductiveConstructor">inj₂</a> <a id="3726" href="Relation.Nullary.Negation.html#3716" class="Bound">f</a>
</pre></body></html>