mirror of
https://git8.cs.fau.de/theses/bsc-leon-vatthauer.git
synced 2024-05-31 07:28:34 +02:00
77 lines
15 KiB
HTML
77 lines
15 KiB
HTML
|
<!DOCTYPE HTML>
|
|||
|
<html><head><meta charset="utf-8"><title>Function.Strict</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">-- Strict combinators (i.e. that use call-by-value)</a>
|
|||
|
<a id="158" class="Comment">------------------------------------------------------------------------</a>
|
|||
|
|
|||
|
<a id="232" class="Comment">-- The contents of this module is also accessible via the `Function`</a>
|
|||
|
<a id="301" class="Comment">-- module.</a>
|
|||
|
|
|||
|
<a id="313" class="Symbol">{-#</a> <a id="317" class="Keyword">OPTIONS</a> <a id="325" class="Pragma">--cubical-compatible</a> <a id="346" class="Pragma">--safe</a> <a id="353" class="Symbol">#-}</a>
|
|||
|
|
|||
|
<a id="358" class="Keyword">module</a> <a id="365" href="Function.Strict.html" class="Module">Function.Strict</a> <a id="381" class="Keyword">where</a>
|
|||
|
|
|||
|
<a id="388" class="Keyword">open</a> <a id="393" class="Keyword">import</a> <a id="400" href="Agda.Builtin.Equality.html" class="Module">Agda.Builtin.Equality</a> <a id="422" class="Keyword">using</a> <a id="428" class="Symbol">(</a><a id="429" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">_≡_</a><a id="432" class="Symbol">)</a>
|
|||
|
<a id="434" class="Keyword">open</a> <a id="439" class="Keyword">import</a> <a id="446" href="Function.Base.html" class="Module">Function.Base</a> <a id="460" class="Keyword">using</a> <a id="466" class="Symbol">(</a><a id="467" href="Function.Base.html#1638" class="Function">flip</a><a id="471" class="Symbol">)</a>
|
|||
|
<a id="473" class="Keyword">open</a> <a id="478" class="Keyword">import</a> <a id="485" href="Level.html" class="Module">Level</a> <a id="491" class="Keyword">using</a> <a id="497" class="Symbol">(</a><a id="498" href="Agda.Primitive.html#742" class="Postulate">Level</a><a id="503" class="Symbol">)</a>
|
|||
|
|
|||
|
<a id="506" class="Keyword">private</a>
|
|||
|
<a id="516" class="Keyword">variable</a>
|
|||
|
<a id="529" href="Function.Strict.html#529" class="Generalizable">a</a> <a id="531" href="Function.Strict.html#531" class="Generalizable">b</a> <a id="533" class="Symbol">:</a> <a id="535" href="Agda.Primitive.html#742" class="Postulate">Level</a>
|
|||
|
<a id="545" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="547" href="Function.Strict.html#547" class="Generalizable">B</a> <a id="549" class="Symbol">:</a> <a id="551" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="555" href="Function.Strict.html#529" class="Generalizable">a</a>
|
|||
|
|
|||
|
<a id="558" class="Keyword">infixl</a> <a id="565" class="Number">0</a> <a id="567" href="Function.Strict.html#1059" class="Function Operator">_!|>_</a> <a id="573" href="Function.Strict.html#1861" class="Function Operator">_!|>′_</a>
|
|||
|
<a id="580" class="Keyword">infixr</a> <a id="587" class="Number">-1</a> <a id="590" href="Function.Strict.html#936" class="Function Operator">_$!_</a> <a id="595" href="Function.Strict.html#1798" class="Function Operator">_$!′_</a>
|
|||
|
|
|||
|
<a id="602" class="Comment">------------------------------------------------------------------------</a>
|
|||
|
<a id="675" class="Comment">-- Dependent combinators</a>
|
|||
|
|
|||
|
<a id="701" class="Comment">-- These are functions whose output has a type that depends on the</a>
|
|||
|
<a id="768" class="Comment">-- value of the input to the function.</a>
|
|||
|
|
|||
|
<a id="808" class="Keyword">open</a> <a id="813" class="Keyword">import</a> <a id="820" href="Agda.Builtin.Strict.html" class="Module">Agda.Builtin.Strict</a> <a id="840" class="Keyword">public</a>
|
|||
|
<a id="849" class="Keyword">renaming</a>
|
|||
|
<a id="860" class="Symbol">(</a> <a id="862" href="Agda.Builtin.Strict.html#178" class="Primitive">primForce</a> <a id="877" class="Symbol">to</a> <a id="880" class="Primitive">force</a>
|
|||
|
<a id="888" class="Symbol">;</a> <a id="890" href="Agda.Builtin.Strict.html#261" class="Primitive">primForceLemma</a> <a id="905" class="Symbol">to</a> <a id="908" class="Primitive">force-≡</a>
|
|||
|
<a id="918" class="Symbol">)</a>
|
|||
|
|
|||
|
<a id="921" class="Comment">-- Application</a>
|
|||
|
<a id="_$!_"></a><a id="936" href="Function.Strict.html#936" class="Function Operator">_$!_</a> <a id="941" class="Symbol">:</a> <a id="943" class="Symbol">∀</a> <a id="945" class="Symbol">{</a><a id="946" href="Function.Strict.html#946" class="Bound">A</a> <a id="948" class="Symbol">:</a> <a id="950" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="954" href="Function.Strict.html#529" class="Generalizable">a</a><a id="955" class="Symbol">}</a> <a id="957" class="Symbol">{</a><a id="958" href="Function.Strict.html#958" class="Bound">B</a> <a id="960" class="Symbol">:</a> <a id="962" href="Function.Strict.html#946" class="Bound">A</a> <a id="964" class="Symbol">→</a> <a id="966" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="970" href="Function.Strict.html#531" class="Generalizable">b</a><a id="971" class="Symbol">}</a> <a id="973" class="Symbol">→</a>
|
|||
|
<a id="982" class="Symbol">((</a><a id="984" href="Function.Strict.html#984" class="Bound">x</a> <a id="986" class="Symbol">:</a> <a id="988" href="Function.Strict.html#946" class="Bound">A</a><a id="989" class="Symbol">)</a> <a id="991" class="Symbol">→</a> <a id="993" href="Function.Strict.html#958" class="Bound">B</a> <a id="995" href="Function.Strict.html#984" class="Bound">x</a><a id="996" class="Symbol">)</a> <a id="998" class="Symbol">→</a> <a id="1000" class="Symbol">((</a><a id="1002" href="Function.Strict.html#1002" class="Bound">x</a> <a id="1004" class="Symbol">:</a> <a id="1006" href="Function.Strict.html#946" class="Bound">A</a><a id="1007" class="Symbol">)</a> <a id="1009" class="Symbol">→</a> <a id="1011" href="Function.Strict.html#958" class="Bound">B</a> <a id="1013" href="Function.Strict.html#1002" class="Bound">x</a><a id="1014" class="Symbol">)</a>
|
|||
|
<a id="1016" href="Function.Strict.html#1016" class="Bound">f</a> <a id="1018" href="Function.Strict.html#936" class="Function Operator">$!</a> <a id="1021" href="Function.Strict.html#1021" class="Bound">x</a> <a id="1023" class="Symbol">=</a> <a id="1025" href="Function.Strict.html#880" class="Primitive">force</a> <a id="1031" href="Function.Strict.html#1021" class="Bound">x</a> <a id="1033" href="Function.Strict.html#1016" class="Bound">f</a>
|
|||
|
|
|||
|
<a id="1036" class="Comment">-- Flipped application</a>
|
|||
|
<a id="_!|>_"></a><a id="1059" href="Function.Strict.html#1059" class="Function Operator">_!|>_</a> <a id="1065" class="Symbol">:</a> <a id="1067" class="Symbol">∀</a> <a id="1069" class="Symbol">{</a><a id="1070" href="Function.Strict.html#1070" class="Bound">A</a> <a id="1072" class="Symbol">:</a> <a id="1074" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="1078" href="Function.Strict.html#529" class="Generalizable">a</a><a id="1079" class="Symbol">}</a> <a id="1081" class="Symbol">{</a><a id="1082" href="Function.Strict.html#1082" class="Bound">B</a> <a id="1084" class="Symbol">:</a> <a id="1086" href="Function.Strict.html#1070" class="Bound">A</a> <a id="1088" class="Symbol">→</a> <a id="1090" href="Agda.Primitive.html#388" class="Primitive">Set</a> <a id="1094" href="Function.Strict.html#531" class="Generalizable">b</a><a id="1095" class="Symbol">}</a> <a id="1097" class="Symbol">→</a>
|
|||
|
<a id="1106" class="Symbol">(</a><a id="1107" href="Function.Strict.html#1107" class="Bound">a</a> <a id="1109" class="Symbol">:</a> <a id="1111" href="Function.Strict.html#1070" class="Bound">A</a><a id="1112" class="Symbol">)</a> <a id="1114" class="Symbol">→</a> <a id="1116" class="Symbol">(∀</a> <a id="1119" href="Function.Strict.html#1119" class="Bound">a</a> <a id="1121" class="Symbol">→</a> <a id="1123" href="Function.Strict.html#1082" class="Bound">B</a> <a id="1125" href="Function.Strict.html#1119" class="Bound">a</a><a id="1126" class="Symbol">)</a> <a id="1128" class="Symbol">→</a> <a id="1130" href="Function.Strict.html#1082" class="Bound">B</a> <a id="1132" href="Function.Strict.html#1107" class="Bound">a</a>
|
|||
|
<a id="1134" href="Function.Strict.html#1059" class="Function Operator">_!|>_</a> <a id="1140" class="Symbol">=</a> <a id="1142" href="Function.Base.html#1638" class="Function">flip</a> <a id="1147" href="Function.Strict.html#936" class="Function Operator">_$!_</a>
|
|||
|
|
|||
|
<a id="1153" class="Comment">------------------------------------------------------------------------</a>
|
|||
|
<a id="1226" class="Comment">-- Non-dependent combinators</a>
|
|||
|
|
|||
|
<a id="1256" class="Comment">-- Any of the above operations for dependent functions will also work</a>
|
|||
|
<a id="1326" class="Comment">-- for non-dependent functions but sometimes Agda has difficulty</a>
|
|||
|
<a id="1391" class="Comment">-- inferring the non-dependency. Primed (′ = \prime) versions of the</a>
|
|||
|
<a id="1460" class="Comment">-- operations are therefore provided below that sometimes have better</a>
|
|||
|
<a id="1530" class="Comment">-- inference properties.</a>
|
|||
|
|
|||
|
<a id="seq"></a><a id="1556" href="Function.Strict.html#1556" class="Function">seq</a> <a id="1560" class="Symbol">:</a> <a id="1562" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1564" class="Symbol">→</a> <a id="1566" href="Function.Strict.html#547" class="Generalizable">B</a> <a id="1568" class="Symbol">→</a> <a id="1570" href="Function.Strict.html#547" class="Generalizable">B</a>
|
|||
|
<a id="1572" href="Function.Strict.html#1556" class="Function">seq</a> <a id="1576" href="Function.Strict.html#1576" class="Bound">a</a> <a id="1578" href="Function.Strict.html#1578" class="Bound">b</a> <a id="1580" class="Symbol">=</a> <a id="1582" href="Function.Strict.html#880" class="Primitive">force</a> <a id="1588" href="Function.Strict.html#1576" class="Bound">a</a> <a id="1590" class="Symbol">(λ</a> <a id="1593" href="Function.Strict.html#1593" class="Bound">_</a> <a id="1595" class="Symbol">→</a> <a id="1597" href="Function.Strict.html#1578" class="Bound">b</a><a id="1598" class="Symbol">)</a>
|
|||
|
|
|||
|
<a id="seq-≡"></a><a id="1601" href="Function.Strict.html#1601" class="Function">seq-≡</a> <a id="1607" class="Symbol">:</a> <a id="1609" class="Symbol">(</a><a id="1610" href="Function.Strict.html#1610" class="Bound">a</a> <a id="1612" class="Symbol">:</a> <a id="1614" href="Function.Strict.html#545" class="Generalizable">A</a><a id="1615" class="Symbol">)</a> <a id="1617" class="Symbol">(</a><a id="1618" href="Function.Strict.html#1618" class="Bound">b</a> <a id="1620" class="Symbol">:</a> <a id="1622" href="Function.Strict.html#547" class="Generalizable">B</a><a id="1623" class="Symbol">)</a> <a id="1625" class="Symbol">→</a> <a id="1627" href="Function.Strict.html#1556" class="Function">seq</a> <a id="1631" href="Function.Strict.html#1610" class="Bound">a</a> <a id="1633" href="Function.Strict.html#1618" class="Bound">b</a> <a id="1635" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">≡</a> <a id="1637" href="Function.Strict.html#1618" class="Bound">b</a>
|
|||
|
<a id="1639" href="Function.Strict.html#1601" class="Function">seq-≡</a> <a id="1645" href="Function.Strict.html#1645" class="Bound">a</a> <a id="1647" href="Function.Strict.html#1647" class="Bound">b</a> <a id="1649" class="Symbol">=</a> <a id="1651" href="Function.Strict.html#908" class="Primitive">force-≡</a> <a id="1659" href="Function.Strict.html#1645" class="Bound">a</a> <a id="1661" class="Symbol">(λ</a> <a id="1664" href="Function.Strict.html#1664" class="Bound">_</a> <a id="1666" class="Symbol">→</a> <a id="1668" href="Function.Strict.html#1647" class="Bound">b</a><a id="1669" class="Symbol">)</a>
|
|||
|
|
|||
|
<a id="force′"></a><a id="1672" href="Function.Strict.html#1672" class="Function">force′</a> <a id="1679" class="Symbol">:</a> <a id="1681" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1683" class="Symbol">→</a> <a id="1685" class="Symbol">(</a><a id="1686" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1688" class="Symbol">→</a> <a id="1690" href="Function.Strict.html#547" class="Generalizable">B</a><a id="1691" class="Symbol">)</a> <a id="1693" class="Symbol">→</a> <a id="1695" href="Function.Strict.html#547" class="Generalizable">B</a>
|
|||
|
<a id="1697" href="Function.Strict.html#1672" class="Function">force′</a> <a id="1704" class="Symbol">=</a> <a id="1706" href="Function.Strict.html#880" class="Primitive">force</a>
|
|||
|
|
|||
|
<a id="force′-≡"></a><a id="1713" href="Function.Strict.html#1713" class="Function">force′-≡</a> <a id="1722" class="Symbol">:</a> <a id="1724" class="Symbol">(</a><a id="1725" href="Function.Strict.html#1725" class="Bound">a</a> <a id="1727" class="Symbol">:</a> <a id="1729" href="Function.Strict.html#545" class="Generalizable">A</a><a id="1730" class="Symbol">)</a> <a id="1732" class="Symbol">(</a><a id="1733" href="Function.Strict.html#1733" class="Bound">f</a> <a id="1735" class="Symbol">:</a> <a id="1737" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1739" class="Symbol">→</a> <a id="1741" href="Function.Strict.html#547" class="Generalizable">B</a><a id="1742" class="Symbol">)</a> <a id="1744" class="Symbol">→</a> <a id="1746" href="Function.Strict.html#1672" class="Function">force′</a> <a id="1753" href="Function.Strict.html#1725" class="Bound">a</a> <a id="1755" href="Function.Strict.html#1733" class="Bound">f</a> <a id="1757" href="Agda.Builtin.Equality.html#150" class="Datatype Operator">≡</a> <a id="1759" href="Function.Strict.html#1733" class="Bound">f</a> <a id="1761" href="Function.Strict.html#1725" class="Bound">a</a>
|
|||
|
<a id="1763" href="Function.Strict.html#1713" class="Function">force′-≡</a> <a id="1772" class="Symbol">=</a> <a id="1774" href="Function.Strict.html#908" class="Primitive">force-≡</a>
|
|||
|
|
|||
|
<a id="1783" class="Comment">-- Application</a>
|
|||
|
<a id="_$!′_"></a><a id="1798" href="Function.Strict.html#1798" class="Function Operator">_$!′_</a> <a id="1804" class="Symbol">:</a> <a id="1806" class="Symbol">(</a><a id="1807" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1809" class="Symbol">→</a> <a id="1811" href="Function.Strict.html#547" class="Generalizable">B</a><a id="1812" class="Symbol">)</a> <a id="1814" class="Symbol">→</a> <a id="1816" class="Symbol">(</a><a id="1817" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1819" class="Symbol">→</a> <a id="1821" href="Function.Strict.html#547" class="Generalizable">B</a><a id="1822" class="Symbol">)</a>
|
|||
|
<a id="1824" href="Function.Strict.html#1798" class="Function Operator">_$!′_</a> <a id="1830" class="Symbol">=</a> <a id="1832" href="Function.Strict.html#936" class="Function Operator">_$!_</a>
|
|||
|
|
|||
|
<a id="1838" class="Comment">-- Flipped application</a>
|
|||
|
<a id="_!|>′_"></a><a id="1861" href="Function.Strict.html#1861" class="Function Operator">_!|>′_</a> <a id="1868" class="Symbol">:</a> <a id="1870" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1872" class="Symbol">→</a> <a id="1874" class="Symbol">(</a><a id="1875" href="Function.Strict.html#545" class="Generalizable">A</a> <a id="1877" class="Symbol">→</a> <a id="1879" href="Function.Strict.html#547" class="Generalizable">B</a><a id="1880" class="Symbol">)</a> <a id="1882" class="Symbol">→</a> <a id="1884" href="Function.Strict.html#547" class="Generalizable">B</a>
|
|||
|
<a id="1886" href="Function.Strict.html#1861" class="Function Operator">_!|>′_</a> <a id="1893" class="Symbol">=</a> <a id="1895" href="Function.Strict.html#1059" class="Function Operator">_!|>_</a>
|
|||
|
</pre></body></html>
|