Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encapsulate effects in QuickCheck function arguments #216

Merged
merged 151 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
f607aa5
Implement first part of Normalform instance generator #150
Aug 26, 2020
b7350aa
Generate full Normalform instances #150
Aug 26, 2020
c998122
Always export Identity #150
Aug 26, 2020
95d7a97
Clean up code a little #150
Aug 26, 2020
329f491
Merge with branch issue-148#150
Aug 26, 2020
65d4222
Format code #150
Aug 26, 2020
01fec1a
Merge main into issue-150 #150
Aug 26, 2020
7672eee
Refactor code #150
Aug 27, 2020
5410691
Refactor code and expand type synonyms #150
Aug 27, 2020
29300fc
Generalize instance generation #150
Aug 27, 2020
99d8309
Use fresh variables for unification and adjust local environments #150
Aug 30, 2020
32a911f
Add helper functions to FreeC.IR.Syntax.Type #150
Aug 30, 2020
8dafd90
Add smart constructor for qualified Coq names to Coq.Syntax #150
Aug 30, 2020
41a3e66
Add some constants to Coq.Base #150
Aug 30, 2020
c9fce32
Use helper function from IR.Syntax.Type in CompletePatternPass #150
Aug 30, 2020
35051fa
Refactor code a little #150
Aug 30, 2020
32198d6
Refactor code some more #150
Aug 30, 2020
039b07d
Remove redundant brackets #150
Aug 30, 2020
dfc24ef
Add examples to test generated normalforms in Coq #175
MarvinLira Aug 30, 2020
26f73c3
Run floskell #175
MarvinLira Aug 30, 2020
7ae3141
Merge branch issue-187 into issue-119 #119
Sep 5, 2020
49298a1
Implement generalized smart constructors for Error effect #119
Sep 5, 2020
34c72b2
Implement generalized Partial instance for Error effect #119
Sep 5, 2020
f89a449
Implement handler for Error effect #119
Sep 5, 2020
cd6d824
Use string messages in Error handler #119
Sep 5, 2020
ac737c8
Add Handler instances for Error #119
Sep 5, 2020
2b1aa90
Add documentation and refactor code #150
Sep 10, 2020
1853b9d
Merge branch 'main' of https://github.com/FreeProving/free-compiler i…
Sep 10, 2020
65e8311
Merge partially with issue-183 #150
Sep 10, 2020
044e1ad
Merge fully with issue-183 #150
Sep 10, 2020
2a7edd5
Refactor code and remove Shape and Pos arguments from local functions…
Sep 10, 2020
216d8cd
Refactor code, add documentation and fix a bug #150
Sep 10, 2020
5efac3a
Merge branch 'issue-150' of https://github.com/FreeProving/free-compi…
Sep 10, 2020
274127c
Use Map for type map #150
Sep 10, 2020
bccdf4c
Fix refactoring-induced bug #150
Sep 10, 2020
f7633b0
Merge with issue-177 and use handling functions instead of instances …
Sep 11, 2020
7dd0b0d
Adjust proofs in example folder #119
Sep 11, 2020
8bc591d
Merge branch 'issue-176' of https://github.com/FreeProving/free-compi…
Sep 11, 2020
7946d48
Merge branch 'issue-176' of https://github.com/FreeProving/free-compi…
Sep 11, 2020
7a57f7c
Add support for case expressions with single variable pattern #74
just95 Sep 11, 2020
9b71706
Add first tests for Haskell to IR translation #74
just95 Sep 11, 2020
7597058
Add pass for processing pragmas #70
just95 Sep 11, 2020
0c04cb4
Add type class for nodes with declaration name #158
just95 Sep 11, 2020
29d623c
Generalize dependency graph creation #158
just95 Sep 11, 2020
42268b1
Add utility function to map subterms #158
just95 Sep 11, 2020
8593eab
Add pass to sort `let`-bindings #158
just95 Sep 11, 2020
dae7d6c
Add tests for sorting of `let`-bindings #158
just95 Sep 11, 2020
a2568a3
Add `Call` to LIR #196
Daniel-Teut Sep 14, 2020
6d0da01
Use Coq.Base functions added to the main branch #150
Sep 14, 2020
3f55afd
Merge branch 'main' of https://github.com/FreeProving/free-compiler i…
Sep 14, 2020
d56b21d
Make helper functions local #150
Sep 14, 2020
6f50398
Merge branch 'main' into issue-158
just95 Sep 14, 2020
41a48b4
Merge branch 'main' into issue-70
just95 Sep 14, 2020
4f683f6
Fix Haddock documentation #158
just95 Sep 14, 2020
8b02b89
Expand documentation #150
Sep 14, 2020
4ad8bd2
Format code #74
just95 Sep 14, 2020
a17351b
Fix issues that resulted from merge #199
just95 Sep 14, 2020
cc75a40
Add Coq comment above class instances #150
Sep 14, 2020
d48a234
Add constant for underscore variable #150
Sep 14, 2020
7a2d4a5
Format code with Floskell #150
Sep 14, 2020
e8201b6
Format Coq.Base #150
Sep 14, 2020
4cf34e1
Merge main into issue-119 #119
Sep 14, 2020
6abb812
Add some examples using Error to the normalization tests #119
Sep 14, 2020
985535b
Remove unnecessary whitespace #119
Sep 14, 2020
e457b6e
Merge main into issue-150 #150
Sep 14, 2020
bc134ba
Adjust tests #150
Sep 15, 2020
258155e
Fix typo
nbun Sep 15, 2020
9760c86
Fix typo
nbun Sep 15, 2020
a5ed9cb
Merge main into issue-150 #150
Sep 15, 2020
02a3b00
Format code with Floskell #150
Sep 15, 2020
deb41b3
Generate ShareableArgs instances #150 #151
Sep 15, 2020
7cf7f1b
Adjust tests #150 #151
Sep 15, 2020
f07e6d3
Apply HLint hint #150 #151
Sep 15, 2020
df40a5f
Add tests for generated ShareableArgs instances #150 #151
Sep 15, 2020
c0f3304
Rename Normalform and NormalformProofs #150 #151
Sep 15, 2020
627002b
Format code with Floskell #150 #151
Sep 15, 2020
72f1150
Fix indentation of Haddock comment #150 #151
Sep 15, 2020
8f7080f
Format code with Floskell #150 #151
Sep 15, 2020
bb296e3
Add a few more example type to test generated instances #150 #151
Sep 15, 2020
4f59925
Add periods to comments #150 #151
MajaRet Sep 16, 2020
55edb95
Fix typo
MarvinLira Sep 16, 2020
7908285
Merge pull request #194 from FreeProving/issue-119
MajaRet Sep 16, 2020
fd22313
Remove redundant application of `testEffectAnalysisPass` #199
just95 Sep 17, 2020
e8cc26f
Apply suggestions from code review #198
just95 Sep 17, 2020
76f018e
Rephrase test module comments #198
just95 Sep 17, 2020
839c109
Format code #198
just95 Sep 17, 2020
eade5ce
Merge pull request #199 from FreeProving/issue-70
stu204146-kiel Sep 17, 2020
4ea85ec
Merge pull request #198 from FreeProving/issue-74
just95 Sep 17, 2020
74815d6
Add `call` to let lifting #196
Daniel-Teut Sep 18, 2020
400a44b
Add test cases for `call` operator #196
Daniel-Teut Sep 18, 2020
706583e
Format code
Daniel-Teut Sep 18, 2020
3ce7751
Fix unit tests #196
Daniel-Teut Sep 18, 2020
453fb4c
Fix typos #158
Daniel-Teut Sep 18, 2020
a983129
Apply suggestions #150
Sep 20, 2020
030a255
Fix HLint and Haddock errors #150
Sep 20, 2020
9103c13
Move instance and induction scheme generation into separate modules #150
Sep 20, 2020
c068f50
Format code #150
Sep 20, 2020
8b73979
Test unformatted as-pattern #150
Sep 20, 2020
2aba14b
Try workaround without as-pattern #150
Sep 20, 2020
b3f257a
Rename source span variables #150
Sep 20, 2020
4a25f3b
Also rename occurrences of the source span variables #150
Sep 20, 2020
b4f9edb
Change Floskell configuration so as-patterns are not split #150
Sep 20, 2020
733079b
Capitalize words in header comments #150
Sep 20, 2020
d46fa56
Update Floskell configuration
just95 Sep 20, 2020
1a21bd1
Merge branch 'main' of https://github.com/FreeProving/free-compiler i…
Sep 20, 2020
91328df
Format TypeDecl tests #150
Sep 20, 2020
f1f0e6c
Apply suggestions from code review
Daniel-Teut Sep 20, 2020
ac135fd
Merge branch 'main' into issue-196
Daniel-Teut Sep 20, 2020
28e224e
Apply review suggestions #196
Daniel-Teut Sep 20, 2020
417a554
Expose depth map creation functions from termination checker #209
just95 Sep 21, 2020
6206d96
Generate helper functions for `case` of aliases #209
just95 Sep 21, 2020
3958146
Add shadowing to let in variable counting #196
Daniel-Teut Sep 21, 2020
241d966
Add test case for let shadowing #196
Daniel-Teut Sep 21, 2020
b85dca3
Add prefixes for normalized and shared variables to Fresh #150
Sep 25, 2020
a6c5ea0
Use new data type for stripped type #150
Sep 25, 2020
341a401
Remove Ord instance from SrcSpan and Type #150
Sep 25, 2020
0ceac1a
Merge pull request #207 from FreeProving/issue-196
just95 Sep 26, 2020
59500b4
Merge branch 'main' into issue-158
just95 Sep 26, 2020
982ae7c
Format code #158
just95 Sep 26, 2020
0d7f489
Merge pull request #197 from FreeProving/issue-158
just95 Sep 26, 2020
c8137c8
Incorporate changes from issue-202 pertaining to Normalform generatio…
Sep 28, 2020
29d2a94
Adjust TypeDeclTests #150
Sep 28, 2020
5fd71b0
Merge main into branch #150
Sep 28, 2020
90de42e
Remove second type variable from Handlers #150
Sep 28, 2020
1304908
Use generateBind #150
Sep 28, 2020
c619199
Remove redundant brackets and fix var names in tests #150
Sep 28, 2020
d6da4fe
Replace aliases of decreasing argument in helper functions #209
just95 Sep 28, 2020
ea887c6
Remove `let` for decreasing argument subterms #209
just95 Sep 28, 2020
98e0e86
Fix application of helper functions #209
just95 Sep 28, 2020
e978c83
Merge branch 'main' into issue-209
just95 Sep 28, 2020
b785754
Add test case for `let`-expressions in helper functions #209
just95 Sep 28, 2020
edf1bbe
Format code #213
just95 Sep 28, 2020
a055a66
Fix bound variables of `let`-expression #76
just95 Sep 8, 2020
e4f2685
Merge branch 'main' into issue-209
just95 Sep 28, 2020
2c2d0f5
Fix test case #209
just95 Sep 28, 2020
67bf20c
Add compiler flag for effect encapsulation #211
Sep 28, 2020
fcb72f0
Encapsulate sharing when necessary #211
Sep 28, 2020
53c1353
Use varPatQName and format code #211
Sep 28, 2020
83fc6e5
WIP
Sep 28, 2020
80d9175
Remove local env #211
Sep 28, 2020
7f530a6
Encapsulate effects when flattening expressions #211
Sep 28, 2020
a321281
Merge pull request #175 from FreeProving/issue-150
just95 Sep 29, 2020
3856fbc
Merge issue-76 into issue-211 #211
Sep 29, 2020
47dfdcb
Apply HLint hint and format code #211
Sep 29, 2020
e2c951b
Merge with main #211
Sep 30, 2020
2020e68
Add Normalform and ShareableArgs instances for Property #211
Sep 30, 2020
9f07a92
Fix error in getFuncName #211
Sep 30, 2020
91f4430
Format code #211
Sep 30, 2020
354e51f
Adjust SharingAnalysisPassTests #211
Sep 30, 2020
7256a50
Merge branch 'issue-209' of https://github.com/FreeProving/free-compi…
Sep 30, 2020
6b31dc0
Fix bug in analysis of case expression variable counting #211
Sep 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion base/Prelude.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Metadata #
##############################################################################

version = 4
version = 5
module-name = 'Prelude'
library-name = 'Base'
exported-types = [
Expand Down Expand Up @@ -83,6 +83,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Bool -> Prelude.Bool -> Prelude.Bool'
Expand All @@ -92,6 +93,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

##############################################################################
# Integer #
Expand All @@ -112,6 +114,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Integer'
Expand All @@ -121,6 +124,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Integer'
Expand All @@ -130,6 +134,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Integer'
Expand All @@ -139,6 +144,7 @@ exported-values = [
arity = 2
effects = ['Partiality']
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Bool'
Expand All @@ -148,6 +154,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Bool'
Expand All @@ -157,6 +164,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Bool'
Expand All @@ -166,6 +174,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Bool'
Expand All @@ -175,6 +184,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Bool'
Expand All @@ -184,6 +194,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer -> Prelude.Bool'
Expand All @@ -193,6 +204,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = false

[[functions]]
haskell-type = 'Prelude.Integer -> Prelude.Integer'
Expand All @@ -202,6 +214,7 @@ exported-values = [
arity = 1
effects = []
needs-free-args = true
encapsulates-effects = false

##############################################################################
# Lists #
Expand Down
8 changes: 7 additions & 1 deletion base/Test/QuickCheck.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Metadata #
##############################################################################

version = 4
version = 5
module-name = 'Test.QuickCheck'
library-name = 'Base'
exported-types = [
Expand Down Expand Up @@ -45,6 +45,7 @@ exported-values = [
arity = 1
effects = []
needs-free-args = true
encapsulates-effects = true

##############################################################################
# Operators #
Expand All @@ -58,6 +59,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = true

[[functions]]
haskell-type = 'a -> a -> Test.QuickCheck.Property'
Expand All @@ -67,6 +69,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = true

[[functions]]
haskell-type = 'a -> a -> Test.QuickCheck.Property'
Expand All @@ -76,6 +79,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = true

[[functions]]
haskell-type = 'Test.QuickCheck.Property -> Test.QuickCheck.Property -> Test.QuickCheck.Property'
Expand All @@ -85,6 +89,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = true

[[functions]]
haskell-type = 'Test.QuickCheck.Property -> Test.QuickCheck.Property -> Test.QuickCheck.Property'
Expand All @@ -94,6 +99,7 @@ exported-values = [
arity = 2
effects = []
needs-free-args = true
encapsulates-effects = true

##############################################################################
# Imported from `Prelude` #
Expand Down
1 change: 1 addition & 0 deletions base/coq/Free.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
From Base Require Export Free.Class.
From Base Require Export Free.ForFree.
From Base Require Export Free.Induction.
From Base Require Export Free.Instance.Identity.
From Base Require Export Free.Malias.
From Base Require Export Free.Monad.
From Base Require Export Free.Tactic.ProveInd.
Expand Down
25 changes: 15 additions & 10 deletions base/coq/Free/Class/Normalform.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,37 @@

From Base Require Import Free.Monad.

From Base Require Import Free.Instance.Identity.

Class Normalform (Shape : Type) (Pos : Shape -> Type)
(A B : Type) :=
(A : Type) :=
{
(** The normalized return type. *)
nType : Type;
(** The function is split into two parts due to termination check errors
for recursive data types. *)
nf' : A -> Free Shape Pos B
nf' : A -> Free Shape Pos nType
}.

Definition nf {Shape : Type} {Pos : Shape -> Type} {A B : Type}
`{Normalform Shape Pos A B} (n : Free Shape Pos A)
: Free Shape Pos B
(* Normalizes a Free value. *)
Definition nf {Shape : Type} {Pos : Shape -> Type} {A : Type}
`{Normalform Shape Pos A} (n : Free Shape Pos A)
: Free Shape Pos nType
:= n >>= nf'.

Lemma nfImpure {Shape : Type} {Pos : Shape -> Type} {A B : Type}
`{Normalform Shape Pos A B}
Lemma nfImpure {Shape : Type} {Pos : Shape -> Type} {A : Type}
`{Normalform Shape Pos A}
: forall s (pf : _ -> Free Shape Pos A),
nf (impure s pf) = impure s (fun p => nf (pf p)).
Proof. trivial. Qed.

Lemma nfPure {Shape : Type} {Pos : Shape -> Type} {A B : Type}
`{Normalform Shape Pos A B} : forall (x : A),
Lemma nfPure {Shape : Type} {Pos : Shape -> Type} {A : Type}
`{Normalform Shape Pos A} : forall (x : A),
nf (pure x) = nf' x.
Proof. trivial. Qed.

(* Normalform instance for functions.
Effects inside of functions are not pulled to the root. *)
Instance NormalformFunc (Shape : Type) (Pos : Shape -> Type) (A B : Type)
: Normalform Shape Pos (A -> B) (A -> B) :=
: Normalform Shape Pos (A -> B) :=
{ nf' := pure }.
Loading