Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
javawlp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
impresshs
javawlp
Commits
dab7628a
Commit
dab7628a
authored
7 years ago
by
Joris ten Tusscher
Browse files
Options
Downloads
Patches
Plain Diff
Removed Rewrite module since it is unnecessary.
parent
903de261
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
javawlp.cabal
+0
-1
0 additions, 1 deletion
javawlp.cabal
src/LogicIR/Backend/Rewrite.hs
+0
-65
0 additions, 65 deletions
src/LogicIR/Backend/Rewrite.hs
src/LogicIR/Backend/Test.hs
+0
-2
0 additions, 2 deletions
src/LogicIR/Backend/Test.hs
with
0 additions
and
68 deletions
javawlp.cabal
+
0
−
1
View file @
dab7628a
...
@@ -18,7 +18,6 @@ library
...
@@ -18,7 +18,6 @@ library
, LogicIR.Backend.Test
, LogicIR.Backend.Test
, LogicIR.Backend.Pretty
, LogicIR.Backend.Pretty
, LogicIR.Backend.Null
, LogicIR.Backend.Null
, LogicIR.Backend.Rewrite
, LogicIR.Fold
, LogicIR.Fold
, LogicIR.Eval
, LogicIR.Eval
, ModelParser.Lexer
, ModelParser.Lexer
...
...
This diff is collapsed.
Click to expand it.
src/LogicIR/Backend/Rewrite.hs
deleted
100644 → 0
+
0
−
65
View file @
903de261
module
LogicIR.Backend.Rewrite
(
replaceQuantifiers
)
where
import
LogicIR.Expr
import
LogicIR.Fold
import
LogicIR.Backend.Pretty
-- Expands quantifiers in given LExpr and returns a quantifier free LExpr.
replaceQuantifiers
::
LExpr
->
LExpr
replaceQuantifiers
=
foldLExpr
replaceQuantifiersAlgebra
type
Env
=
Int
replaceQuantifiersEnvAlgebra
::
LExprAlgebra
(
Env
->
LExpr
)
replaceQuantifiersEnvAlgebra
=
(
cnst
,
var
,
uni
,
bin
,
iff
,
quant
,
arr
,
snull
,
len
)
where
cnst
c
=
\
env
->
LConst
c
uni
op
e
=
\
env
->
LUnop
op
(
e
env
)
bin
e1
op
e2
=
\
env
->
LBinop
(
e1
env
)
op
(
e2
env
)
iff
ge
e1
e2
=
\
env
->
LIf
(
ge
env
)
(
e1
env
)
(
e2
env
)
var
v
=
\
env
->
LVar
v
quant
t
v
d
e
=
\
env
->
replaceQuantifier
t
v
(
d
(
env
*
2
))
(
e
(
env
*
2
+
1
))
arr
v
e
=
\
env
->
LArray
v
(
e
env
)
snull
v
=
\
env
->
LIsnull
v
len
v
=
\
env
->
LLen
v
replaceQuantifiersAlgebra
::
LExprAlgebra
LExpr
replaceQuantifiersAlgebra
=
(
cnst
,
var
,
uni
,
bin
,
iff
,
quant
,
arr
,
snull
,
len
)
where
cnst
=
LConst
uni
=
LUnop
bin
=
LBinop
iff
=
LIf
var
=
LVar
quant
t
v
d
e
=
replaceQuantifier
t
v
d
e
arr
=
LArray
snull
=
LIsnull
len
=
LLen
-- replaces an LQuant with a conjunction (if universal) or disjunction (if
-- existential). In the second argument of the con/disjunct, the quantifier Var
-- is replaced by Var'. This makes it possible to just substitute both of them
-- with a value in the end. Since Java identifiers can't contain the ' char,
-- we can safely assume that Varname ++ ' is always a fresh identifier.
replaceQuantifier
::
QOp
->
Var
->
LExpr
->
LExpr
->
LExpr
replaceQuantifier
op
var
domain
e
=
LBinop
e1
combiner
e2
where
prime
(
Var
t
name
)
=
Var
t
(
name
++
"'"
)
e1
=
LBinop
domain
LImpl
e
e2
=
replace
var
(
prime
var
)
(
LBinop
domain
LImpl
e
)
combiner
=
if
op
==
QAll
then
LAnd
else
LOr
-- Returns an LExpr where all occurences of vOld in the given LExpr are
-- replaced by vNew.
replace
::
Var
->
Var
->
LExpr
->
LExpr
replace
vOld
vNew
=
foldLExpr
algebra
where
algebra
::
LExprAlgebra
LExpr
algebra
=
(
cnst
,
var
,
uni
,
bin
,
iff
,
quant
,
arr
,
snull
,
len
)
subst
v
=
if
v
==
vOld
then
vNew
else
v
cnst
c
=
LConst
c
uni
o
c
=
LUnop
o
c
bin
le
o
re
=
LBinop
le
o
re
iff
ge
e1
e2
=
LIf
ge
e1
e2
var
v
=
LVar
(
subst
v
)
quant
t
v
d
e
=
replaceQuantifier
t
v
d
e
arr
v
e
=
LArray
(
subst
v
)
e
snull
v
=
LIsnull
(
subst
v
)
len
v
=
LLen
(
subst
v
)
This diff is collapsed.
Click to expand it.
src/LogicIR/Backend/Test.hs
+
0
−
2
View file @
dab7628a
...
@@ -5,12 +5,10 @@ module LogicIR.Backend.Test (testEquality) where
...
@@ -5,12 +5,10 @@ module LogicIR.Backend.Test (testEquality) where
import
LogicIR.Expr
import
LogicIR.Expr
import
LogicIR.Fold
import
LogicIR.Fold
import
LogicIR.Eval
import
LogicIR.Eval
import
LogicIR.Backend.Rewrite
import
LogicIR.Backend.Pretty
import
LogicIR.Backend.Pretty
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Data.List
(
find
,
nub
,
(
\\
))
import
Data.List
(
find
,
nub
,
(
\\
))
import
System.Random
import
System.Random
import
Control.Exception
import
Data.Maybe
(
isNothing
,
fromJust
)
import
Data.Maybe
(
isNothing
,
fromJust
)
import
Data.Map
(
Map
)
import
Data.Map
(
Map
)
import
qualified
Data.Map.Lazy
as
M
import
qualified
Data.Map.Lazy
as
M
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment