Skip to content

Commit

Permalink
Merge pull request #3 from julianmendez/development
Browse files Browse the repository at this point in the history
Add 'example' module
  • Loading branch information
julianmendez authored Feb 25, 2024
2 parents 1e917ce + abf7735 commit 6546e8f
Show file tree
Hide file tree
Showing 87 changed files with 3,261 additions and 1,319 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ jobs:
- 17.0.9
- 21.0.1
scala:
- 2.11.12
- 2.12.18
- 2.13.12
- 3.3.1
- 3.4.0
steps:
- name: Check out
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Thumbs.db
.cache-main
.cache-tests
docs/sphinx/build
.lake/
4 changes: 4 additions & 0 deletions Soda.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- This module serves as the root of the `Soda` library.
-- Import modules here that should be built as part of the library.
import «Soda».tiles.fairness.main.Main

3 changes: 3 additions & 0 deletions Soda/tiles/fairness/main/Main.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

def main : IO Unit :=
IO.println s!"Under construction ..."
42 changes: 23 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import sbt.Keys.scalacOptions

lazy val scala2_11 = "2.11.12"

lazy val scala2_12 = "2.12.18"

lazy val scala2_13 = "2.13.12"

lazy val scala3_3 = "3.3.1"
lazy val scala3_4 = "3.4.0"

lazy val commonSettings =
Seq(
organization := "se.umu.cs.tiles",
version := "0.1.0",
description := "Object-oriented functional language to describe, analyze, and model human-centered problems",
homepage := Some(url("https://julianmendez.github.io/soda/")),
homepage := Some(url("https://julianmendez.github.io/tiles/")),
startYear := Some(2023),
licenses := Seq("Apache License Version 2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")),
organizationName := "Umea University",
Expand All @@ -25,18 +19,17 @@ lazy val commonSettings =
* Scala
* [[https://www.scala-lang.org]]
* [[https://github.com/scala/scala]]
* [[https://repo1.maven.org/maven2/org/scala-lang/scalap/]]
* [[https://repo1.maven.org/maven2/org/scala-lang/scala3-compiler_3/]]
*/
crossScalaVersions := Seq(scala2_11, scala2_12, scala2_13, scala3_3),
scalaVersion := scala3_3,
crossScalaVersions := Seq(scala3_4),
scalaVersion := scala3_4,
/**
* ScalaTest
* [[https://www.scalatest.org]]
* [[https://github.com/scalatest/scalatest]]
* [[https://repo1.maven.org/maven2/org/scalatest/]]
*/
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.17" % "test",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % "test",
resolvers += Resolver.mavenLocal,
publishTo := Some(Resolver.mavenLocal),
publishMavenStyle := true,
Expand All @@ -51,21 +44,32 @@ lazy val docs =
.in(file("docs"))
.settings(commonSettings)

lazy val tiles =
lazy val core =
project
.withId("tiles")
.in(file("tiles"))
.withId("core")
.in(file("core"))
.settings(
commonSettings,
assembly / assemblyJarName := "tiles-" + version.value + ".jar"
assembly / assemblyJarName := "core-" + version.value + ".jar"
)

lazy val examples =
project
.withId("examples")
.in(file("examples"))
.aggregate(core)
.dependsOn(core)
.settings(
commonSettings,
assembly / assemblyJarName := "examples-" + version.value + ".jar"
)

lazy val root =
project
.withId("soda")
.withId("tiles")
.in(file("."))
.aggregate(docs, tiles)
.dependsOn(docs, tiles)
.aggregate(docs, core, examples)
.dependsOn(docs, core, examples)
.settings(
commonSettings,
assembly / assemblyJarName := "tiles-" + version.value + ".jar"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

directive lean
import Soda.tiles.fairness.tool.TileMessage
import Soda.tiles.fairness.tile.AllActorTile
import Soda.tiles.fairness.tile.AllEqualTile
import Soda.tiles.fairness.tile.ReceivedSigmaPTile

/**
* This pipeline returns 'true' when all the actors in the input receive a resource of the
* value, and 'false' otherwise.
*/

class EqualityTile

abstract
sigma : Measure -> Measure -> Measure
p_utility : Resource -> Measure

all_equal_tile = AllEqualTile .mk

received_sigma_p_tile = ReceivedSigmaPTile .mk (sigma) (p_utility)

all_actor_tile = AllActorTile .mk

apply (message : TileMessage [Boolean] ) : TileMessage [Boolean] =
all_equal_tile .apply (
received_sigma_p_tile .apply (
all_actor_tile .apply (message)
)
)

end
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@

directive lean
import Soda.tiles.fairness.tool.TileMessage
import Soda.tiles.fairness.tile.AtLeastTile
import Soda.tiles.fairness.tile.NeededPTile
import Soda.tiles.fairness.tile.ReceivedSigmaPTile
import Soda.tiles.fairness.tile.UnzipPairFstTile
import Soda.tiles.fairness.tile.UnzipPairSndTile
import Soda.tiles.fairness.tile.ZipTile


/**
* This pipeline returns 'true' when all the actors in the input receive a resource that
* satisfies their needs, and 'false' otherwise.
*/

class EquityTile

abstract
sigma : Measure -> Measure -> Measure
p0_need : Actor -> Measure
p1_utility : Resource -> Measure

at_least_tile = AtLeastTile_ ()
at_least_tile = AllAtLeastTile .mk

received_sigma_p_tile = ReceivedSigmaPTile_ (sigma , p1_utility)
received_sigma_p_tile = ReceivedSigmaPTile .mk (sigma) (p1_utility)

needed_p_tile = NeededPTile_ (p0_need)
needed_p_tile = NeededPTile .mk (p0_need)

all_actor_pair_tile = AllActorPairTile_ ()
all_actor_pair_tile = AllActorPairTile .mk

unzip_fst_tile = UnzipPairFstTile_ ()
unzip_fst_tile = UnzipPairFstTile .mk

unzip_snd_tile = UnzipPairSndTile_ ()
unzip_snd_tile = UnzipPairSndTile .mk

zip_tile = ZipTile_ ()
zip_tile = ZipTile .mk

get_branch_0 (message : TileMessage [Seq [TilePair [Actor] [Actor] ] ] )
: TileMessage [Seq [Measure] ] =
Expand Down
Loading

0 comments on commit 6546e8f

Please sign in to comment.