Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
LARA
inox
Commits
62319679
Commit
62319679
authored
14 years ago
by
Ali Sinan Köksal
Browse files
Options
Downloads
Patches
Plain Diff
A previous benchmark that seemingly leads to funcheck bug.
parent
82e0aa2a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pldi2011-testcases/SemanticsPreservation.scala
+44
-0
44 additions, 0 deletions
pldi2011-testcases/SemanticsPreservation.scala
with
44 additions
and
0 deletions
pldi2011-testcases/SemanticsPreservation.scala
0 → 100644
+
44
−
0
View file @
62319679
import
scala.collection.immutable.Set
import
funcheck.Utils._
import
funcheck.Annotations._
object
SemanticsPreservation
{
sealed
abstract
class
Formula
case
class
And
(
lhs
:
Formula
,
rhs
:
Formula
)
extends
Formula
case
class
Or
(
lhs
:
Formula
,
rhs
:
Formula
)
extends
Formula
case
class
Not
(
f
:
Formula
)
extends
Formula
case
class
Variable
(
id
:
Int
)
extends
Formula
@induct
def
nnf
(
formula
:
Formula
)
:
Formula
=
(
formula
match
{
case
And
(
lhs
,
rhs
)
=>
And
(
nnf
(
lhs
),
nnf
(
rhs
))
case
Or
(
lhs
,
rhs
)
=>
Or
(
nnf
(
lhs
),
nnf
(
rhs
))
case
Not
(
And
(
lhs
,
rhs
))
=>
Or
(
nnf
(
Not
(
lhs
)),
nnf
(
Not
(
rhs
)))
case
Not
(
Or
(
lhs
,
rhs
))
=>
And
(
nnf
(
Not
(
lhs
)),
nnf
(
Not
(
rhs
)))
case
Not
(
Not
(
f
))
=>
nnf
(
f
)
case
n
@
Not
(
_
)
=>
n
case
v
@
Variable
(
_
)
=>
v
})
ensuring
(
isNNF
(
_
))
def
isNNF
(
f
:
Formula
)
:
Boolean
=
f
match
{
case
And
(
lhs
,
rhs
)
=>
isNNF
(
lhs
)
&&
isNNF
(
rhs
)
case
Or
(
lhs
,
rhs
)
=>
isNNF
(
lhs
)
&&
isNNF
(
rhs
)
case
Not
(
_
)
=>
false
case
Variable
(
_
)
=>
true
}
@induct
def
eval
(
formula
:
Formula
)
:
Boolean
=
(
formula
match
{
case
And
(
lhs
,
rhs
)
=>
eval
(
lhs
)
&&
eval
(
rhs
)
case
Or
(
lhs
,
rhs
)
=>
eval
(
lhs
)
||
eval
(
rhs
)
case
Not
(
f
)
=>
!
eval
(
f
)
case
Variable
(
id
)
=>
id
>
42
})
ensuring
(
res
=>
res
==
eval
(
nnf
(
formula
)))
@induct
def
nnfPreservesSemantics
(
f
:
Formula
)
:
Boolean
=
{
eval
(
f
)
==
eval
(
nnf
(
f
))
}
holds
}
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