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
84c3de9e
Commit
84c3de9e
authored
13 years ago
by
Philippe Suter
Browse files
Options
Downloads
Patches
Plain Diff
changse
parent
085927b2
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
cp-demo/PaperExamples.scala
+19
-18
19 additions, 18 deletions
cp-demo/PaperExamples.scala
with
19 additions
and
18 deletions
cp-demo/PaperExamples.scala
+
19
−
18
View file @
84c3de9e
...
...
@@ -82,32 +82,33 @@ object PaperExamples extends App {
assuming
(
m
(
l
)
>=
0
&&
m
(
l
)
<=
9
)
{
println
(
"OK for "
+
l
)
}
// we need this too because S and M occur as most significant digits
if
(
l
==
S
()
||
l
==
M
())
assuming
(
m
(
l
)
>=
1
)
{
println
(
l
+
" greater than 0 OK"
)
}
assuming
(
1000
*
m
(
S
())
+
100
*
m
(
E
())
+
10
*
m
(
N
())
+
m
(
D
())
+
1000
*
m
(
M
())
+
100
*
m
(
O
())
+
10
*
m
(
R
())
+
m
(
E
())
==
10000
*
m
(
M
())
+
1000
*
m
(
O
())
+
100
*
m
(
N
())
+
10
*
m
(
E
())
+
m
(
Y
()))
{
println
(
"OK for sum"
)
}
assuming
(
distinct
(
m
(
S
()),
m
(
E
()),
m
(
N
()),
m
(
D
()),
m
(
M
()),
m
(
O
()),
m
(
R
()),
m
(
Y
())))
{
println
(
"OK for distinct"
)
// we need this too because S and M occur as most significant digits
if
(
l
==
S
()
||
l
==
M
())
assuming
(
m
(
l
)
>=
1
)
{
println
(
l
+
" greater than 0 OK"
)
}
}
assuming
(
1000
*
m
(
S
())
+
100
*
m
(
E
())
+
10
*
m
(
N
())
+
m
(
D
())
+
1000
*
m
(
M
())
+
100
*
m
(
O
())
+
10
*
m
(
R
())
+
m
(
E
())
==
10000
*
m
(
M
())
+
1000
*
m
(
O
())
+
100
*
m
(
N
())
+
10
*
m
(
E
())
+
m
(
Y
()))
{
println
(
"OK for sum"
)
}
assuming
(
distinct
(
m
(
S
()),
m
(
E
()),
m
(
N
()),
m
(
D
()),
m
(
M
()),
m
(
O
()),
m
(
R
()),
m
(
Y
())))
{
println
(
"OK for distinct"
)
}
println
(
"A solution : "
+
m
.
value
)
// functional-style, crashed because of if
val
c
:
Constraint1
[
Map
[
Letter
,
Int
]]
=
((
m
:
Map
[
Letter
,
Int
])
=>
1000
*
m
(
S
())
+
100
*
m
(
E
())
+
10
*
m
(
N
())
+
m
(
D
())
+
1000
*
m
(
M
())
+
100
*
m
(
O
())
+
10
*
m
(
R
())
+
m
(
E
())
==
10000
*
m
(
M
())
+
1000
*
m
(
O
())
+
100
*
m
(
N
())
+
10
*
m
(
E
())
+
m
(
Y
()))
//
val c : Constraint1[Map[Letter,Int]] = ((m: Map[Letter,Int]) =>
//
1000 * m(S()) + 100 * m(E()) + 10 * m(N()) + m(D()) +
//
1000 * m(M()) + 100 * m(O()) + 10 * m(R()) + m(E()) ==
//
10000 * m(M()) + 1000 * m(O()) + 100 * m(N()) + 10 * m(E()) + m(Y()))
// this works too but I guess we should avoid enumerating maps
// for(m <- c.lazyFindAll if(
...
...
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