Skip to content

Commit 2398a25

Browse files
committed
try an unlifted Y to see if i prefer the core.
1 parent a84f446 commit 2398a25

File tree

5 files changed

+462
-7
lines changed

5 files changed

+462
-7
lines changed

LICENSE.md

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
# License
2+
3+
Licensed under either of
4+
* Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
5+
* BSD 2-Clause license (https://opensource.org/licenses/BSD-2-Clause)
6+
at your option.
7+
8+
## BSD 2-Clause License
9+
10+
- Copyright 2021 Edward Kmett
11+
12+
All rights reserved.
13+
14+
Redistribution and use in source and binary forms, with or without
15+
modification, are permitted provided that the following conditions
16+
are met:
17+
18+
1. Redistributions of source code must retain the above copyright
19+
notice, this list of conditions and the following disclaimer.
20+
21+
2. Redistributions in binary form must reproduce the above copyright
22+
notice, this list of conditions and the following disclaimer in the
23+
documentation and/or other materials provided with the distribution.
24+
25+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
26+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28+
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
29+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34+
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35+
POSSIBILITY OF SUCH DAMAGE.
36+
37+
## Apache License
38+
39+
_Version 2.0, January 2004_
40+
_&lt;<http://www.apache.org/licenses/>&gt;_
41+
42+
### Terms and Conditions for use, reproduction, and distribution
43+
44+
#### 1. Definitions
45+
46+
“License” shall mean the terms and conditions for use, reproduction, and
47+
distribution as defined by Sections 1 through 9 of this document.
48+
49+
“Licensor” shall mean the copyright owner or entity authorized by the copyright
50+
owner that is granting the License.
51+
52+
“Legal Entity” shall mean the union of the acting entity and all other entities
53+
that control, are controlled by, or are under common control with that entity.
54+
For the purposes of this definition, “control” means **(i)** the power, direct or
55+
indirect, to cause the direction or management of such entity, whether by
56+
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
57+
outstanding shares, or **(iii)** beneficial ownership of such entity.
58+
59+
“You” (or “Your”) shall mean an individual or Legal Entity exercising
60+
permissions granted by this License.
61+
62+
“Source” form shall mean the preferred form for making modifications, including
63+
but not limited to software source code, documentation source, and configuration
64+
files.
65+
66+
“Object” form shall mean any form resulting from mechanical transformation or
67+
translation of a Source form, including but not limited to compiled object code,
68+
generated documentation, and conversions to other media types.
69+
70+
“Work” shall mean the work of authorship, whether in Source or Object form, made
71+
available under the License, as indicated by a copyright notice that is included
72+
in or attached to the work (an example is provided in the Appendix below).
73+
74+
“Derivative Works” shall mean any work, whether in Source or Object form, that
75+
is based on (or derived from) the Work and for which the editorial revisions,
76+
annotations, elaborations, or other modifications represent, as a whole, an
77+
original work of authorship. For the purposes of this License, Derivative Works
78+
shall not include works that remain separable from, or merely link (or bind by
79+
name) to the interfaces of, the Work and Derivative Works thereof.
80+
81+
“Contribution” shall mean any work of authorship, including the original version
82+
of the Work and any modifications or additions to that Work or Derivative Works
83+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
84+
by the copyright owner or by an individual or Legal Entity authorized to submit
85+
on behalf of the copyright owner. For the purposes of this definition,
86+
“submitted” means any form of electronic, verbal, or written communication sent
87+
to the Licensor or its representatives, including but not limited to
88+
communication on electronic mailing lists, source code control systems, and
89+
issue tracking systems that are managed by, or on behalf of, the Licensor for
90+
the purpose of discussing and improving the Work, but excluding communication
91+
that is conspicuously marked or otherwise designated in writing by the copyright
92+
owner as “Not a Contribution.”
93+
94+
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
95+
of whom a Contribution has been received by Licensor and subsequently
96+
incorporated within the Work.
97+
98+
#### 2. Grant of Copyright License
99+
100+
Subject to the terms and conditions of this License, each Contributor hereby
101+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
102+
irrevocable copyright license to reproduce, prepare Derivative Works of,
103+
publicly display, publicly perform, sublicense, and distribute the Work and such
104+
Derivative Works in Source or Object form.
105+
106+
#### 3. Grant of Patent License
107+
108+
Subject to the terms and conditions of this License, each Contributor hereby
109+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
110+
irrevocable (except as stated in this section) patent license to make, have
111+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
112+
such license applies only to those patent claims licensable by such Contributor
113+
that are necessarily infringed by their Contribution(s) alone or by combination
114+
of their Contribution(s) with the Work to which such Contribution(s) was
115+
submitted. If You institute patent litigation against any entity (including a
116+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
117+
Contribution incorporated within the Work constitutes direct or contributory
118+
patent infringement, then any patent licenses granted to You under this License
119+
for that Work shall terminate as of the date such litigation is filed.
120+
121+
#### 4. Redistribution
122+
123+
You may reproduce and distribute copies of the Work or Derivative Works thereof
124+
in any medium, with or without modifications, and in Source or Object form,
125+
provided that You meet the following conditions:
126+
127+
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
128+
this License; and
129+
* **(b)** You must cause any modified files to carry prominent notices stating that You
130+
changed the files; and
131+
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
132+
all copyright, patent, trademark, and attribution notices from the Source form
133+
of the Work, excluding those notices that do not pertain to any part of the
134+
Derivative Works; and
135+
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
136+
Derivative Works that You distribute must include a readable copy of the
137+
attribution notices contained within such NOTICE file, excluding those notices
138+
that do not pertain to any part of the Derivative Works, in at least one of the
139+
following places: within a NOTICE text file distributed as part of the
140+
Derivative Works; within the Source form or documentation, if provided along
141+
with the Derivative Works; or, within a display generated by the Derivative
142+
Works, if and wherever such third-party notices normally appear. The contents of
143+
the NOTICE file are for informational purposes only and do not modify the
144+
License. You may add Your own attribution notices within Derivative Works that
145+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
146+
provided that such additional attribution notices cannot be construed as
147+
modifying the License.
148+
149+
You may add Your own copyright statement to Your modifications and may provide
150+
additional or different license terms and conditions for use, reproduction, or
151+
distribution of Your modifications, or for any such Derivative Works as a whole,
152+
provided Your use, reproduction, and distribution of the Work otherwise complies
153+
with the conditions stated in this License.
154+
155+
#### 5. Submission of Contributions
156+
157+
Unless You explicitly state otherwise, any Contribution intentionally submitted
158+
for inclusion in the Work by You to the Licensor shall be under the terms and
159+
conditions of this License, without any additional terms or conditions.
160+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
161+
any separate license agreement you may have executed with Licensor regarding
162+
such Contributions.
163+
164+
#### 6. Trademarks
165+
166+
This License does not grant permission to use the trade names, trademarks,
167+
service marks, or product names of the Licensor, except as required for
168+
reasonable and customary use in describing the origin of the Work and
169+
reproducing the content of the NOTICE file.
170+
171+
#### 7. Disclaimer of Warranty
172+
173+
Unless required by applicable law or agreed to in writing, Licensor provides the
174+
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
175+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
176+
including, without limitation, any warranties or conditions of TITLE,
177+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
178+
solely responsible for determining the appropriateness of using or
179+
redistributing the Work and assume any risks associated with Your exercise of
180+
permissions under this License.
181+
182+
#### 8. Limitation of Liability
183+
184+
In no event and under no legal theory, whether in tort (including negligence),
185+
contract, or otherwise, unless required by applicable law (such as deliberate
186+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
187+
liable to You for damages, including any direct, indirect, special, incidental,
188+
or consequential damages of any character arising as a result of this License or
189+
out of the use or inability to use the Work (including but not limited to
190+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
191+
any and all other commercial damages or losses), even if such Contributor has
192+
been advised of the possibility of such damages.
193+
194+
#### 9. Accepting Warranty or Additional Liability
195+
196+
While redistributing the Work or Derivative Works thereof, You may choose to
197+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
198+
other liability obligations and/or rights consistent with this License. However,
199+
in accepting such obligations, You may act only on Your own behalf and on Your
200+
sole responsibility, not on behalf of any other Contributor, and only if You
201+
agree to indemnify, defend, and hold each Contributor harmless for any liability
202+
incurred by, or claims asserted against, such Contributor by reason of your
203+
accepting any such warranty or additional liability.
204+
205+
_END OF TERMS AND CONDITIONS_
206+
207+
### APPENDIX: How to apply the Apache License to your work
208+
209+
To apply the Apache License to your work, attach the following boilerplate
210+
notice, with the fields enclosed by brackets `[]` replaced with your own
211+
identifying information. (Don't include the brackets!) The text should be
212+
enclosed in the appropriate comment syntax for the file format. We also
213+
recommend that a file or class name and description of purpose be included on
214+
the same “printed page” as the copyright notice for easier identification within
215+
third-party archives.
216+
217+
Copyright [yyyy] [name of copyright owner]
218+
219+
Licensed under the Apache License, Version 2.0 (the "License");
220+
you may not use this file except in compliance with the License.
221+
You may obtain a copy of the License at
222+
223+
http://www.apache.org/licenses/LICENSE-2.0
224+
225+
Unless required by applicable law or agreed to in writing, software
226+
distributed under the License is distributed on an "AS IS" BASIS,
227+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228+
See the License for the specific language governing permissions and
229+
limitations under the License.
230+

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
linear-logic
2+
============
3+
4+
[![Hackage](https://img.shields.io/hackage/v/linear-logic.svg)](https://hackage.haskell.org/package/linear-logic) [![Build Status](https://github.com/ekmett/linear-logic/workflows/Haskell-CI/badge.svg)](https://github.com/ekmett/linear-logic/actions?query=workflow%3AHaskell-CI)
5+
6+
This package encodes a version of intuitionistic linear logic on top of linear Haskell, using a variation of the
7+
technique described by Michael Shulman in <https://arxiv.org/abs/1805.07518 Linear Logic for Constructive Mathematics>. Embedding a larger linear logic into the simple linear logic available to us in Linear Haskell means we are able to
8+
recover the full suite of linear unitors, not just two of them, meaning we model linear logic, rather than affine logic.
9+
10+
The central idea is to track for each type not just its type of proofs, but also its type of refutations.
11+
12+
Contact Information
13+
-------------------
14+
15+
Contributions and bug reports are welcome!
16+
17+
Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.
18+
19+
-Edward Kmett

linear-logic.cabal

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,56 @@
1-
cabal-version: 2.2
1+
cabal-version: 2.4
22
name: linear-logic
3+
category: Logic
4+
license: BSD-2-Clause OR Apache-2.0
5+
license-file: LICENSE.md
6+
author: Edward A. Kmett
7+
maintainer: Edward A. Kmett <[email protected]>
8+
stability: experimental
9+
homepage: https://github.com/ekmett/linear-logic/
10+
bug-reports: https://github.com/ekmett/linear-logic/issues
11+
copyright: Copyright 2021 Edward A. Kmett
312
version: 0
413
build-type: Simple
14+
synopsis: linear logic
15+
description:
16+
This package provides a library for reasoning
17+
with linear logic on top of linear haskell.
18+
.
19+
<https://arxiv.org/pdf/1805.07518.pdf Linear Logic for Constructive Mathematics>
20+
by Michael Shulman provides a principled take on this topic. There he constructs
21+
an embedding of an affine logic into an intuitionistic logic via a Chu construction.
22+
.
23+
However, that version of things was only able to express an 'affine logic' where
24+
the pairs \(\top\) and @()@, \(\bot\) and @Void@ are made to coincide.
25+
.
26+
Reconstructing this technique on top of <https://arxiv.org/abs/1710.09756 Linear Haskell>
27+
allows us to construct a full intuitionistic linear logic, while retaining Shulman's
28+
style of refutation.
29+
.
30+
+------------------------+--------------------------+-----------------------+
31+
| | Additive | Multiplicative |
32+
+========================+==========================+=======================+
33+
| Conjunction | @('&')@ w/ unit 'Top' | @(,)@ w/ unit @()@ |
34+
+------------------------+--------------------------+-----------------------+
35+
| Disjunction | 'Either' w/ unit 'Void' | @('⅋')@ w/ unit 'Bot' |
36+
+------------------------+--------------------------+-----------------------+
37+
.
38+
'Either' (or @('+')@) takes the place of the traditional \(\oplus\)
39+
.
40+
'(,)' (or @('*')@) takes the place of the traditional \(\otimes\)
41+
.
42+
To use the alias for @('*')@, make sure to enable @{-# LANGUAGE NoStarIsType #-}@
43+
.
44+
Negative polarity connectives are 'GHC.Types.RuntimeRep' polymorphic,
45+
but only currently have 'Prop' instances defined for ''LiftedRep'
46+
47+
extra-source-files:
48+
CHANGELOG.md
49+
README.md
50+
51+
source-repository head
52+
type: git
53+
location: https://github.com/ekmett/linear-logic.git
554

655
library
756
default-language: Haskell2010
@@ -12,9 +61,13 @@ library
1261
linear-base
1362
other-modules:
1463
Linear.Logic.Ur
64+
Linear.Logic.Y
1565
exposed-modules:
1666
Linear.Logic
1767
Linear.Logic.Functor
1868
Linear.Logic.Unsafe
19-
ghc-options: -Wall -fno-show-valid-hole-fits
69+
ghc-options:
70+
-Wall -fexpose-all-unfoldings -fspecialize-aggressively
71+
-fno-show-valid-hole-fits
72+
-Winferred-safe-imports -Wmissing-safe-haskell-mode
2073
hs-source-dirs: src

0 commit comments

Comments
 (0)