Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5089212
copied lisa-set
Fabr-ce Nov 12, 2024
8b44b70
MWE
jarctan Nov 14, 2024
8bd7991
tried definition of topology
Fabr-ce Nov 16, 2024
1a1903e
Make it compile
jarctan Nov 16, 2024
11ba357
Even better
jarctan Nov 16, 2024
9041e04
started with proof of discrete Topology
Fabr-ce Nov 21, 2024
19782e5
TheConditional fix
jarctan Nov 22, 2024
fe141c4
Merge branch 'main' into jo
jarctan Nov 22, 2024
960d020
improved definitions
Fabr-ce Nov 22, 2024
c5261e6
finished definitions + progress with proving
Fabr-ce Dec 2, 2024
e8d8f0c
proved (in)discrete Topology
Fabr-ce Dec 3, 2024
b23384c
Merge remote-tracking branch 'origin/main' into fabrice
Fabr-ce Dec 3, 2024
9106978
started with singleton
Fabr-ce Dec 5, 2024
74f5964
Direct image + proof of direct image
jarctan Dec 6, 2024
fd9ed26
Merge branch 'jo' into fabrice
jarctan Dec 6, 2024
8b3833d
Fix
jarctan Dec 6, 2024
30456d5
Add implicationProof
dobito6 Dec 6, 2024
0886df8
Proof of inverse image union
jarctan Dec 6, 2024
bd92f77
Mapping + Continuity
jarctan Dec 6, 2024
36da1a4
Main steps towards IVT
jarctan Dec 8, 2024
f1c9938
Framework for Heine-Borel thm
jarctan Dec 8, 2024
c60719f
added intersection lemma
Fabr-ce Dec 12, 2024
fe48a86
Work on Heine's thm
jarctan Dec 12, 2024
3af5856
added memberships
Fabr-ce Dec 12, 2024
a1d99c2
preimageUnion to preimages
jarctan Dec 12, 2024
be47296
intermediate Value Theorem finished
Fabr-ce Dec 12, 2024
428b78e
huge progress on singleton proof
Fabr-ce Dec 12, 2024
f956727
Almost finish Heine's theorem
jarctan Dec 13, 2024
f714041
Add proof of union(singletonSets(S)) === S
dobito6 Dec 13, 2024
00653d3
finished intermediate Value Thm
Fabr-ce Dec 15, 2024
4d5c150
topology cleanup
Fabr-ce Dec 15, 2024
91e3ee5
cleanup and merge
Fabr-ce Dec 15, 2024
239839e
Fix
jarctan Dec 18, 2024
193175f
Finish content of Heine's theorem
jarctan Dec 18, 2024
8ea523a
Split Instances into several files
jarctan Dec 18, 2024
d032f97
Document DirectPreimages
jarctan Dec 18, 2024
a4ac69d
Documentation
jarctan Dec 18, 2024
80ea0dc
Delete Main.scala
jarctan Dec 18, 2024
191a35d
added documentation for set theory
Fabr-ce Dec 18, 2024
d532601
Merge branch 'fabrice' of github.com:Fabr-ce/lisaTopology into fabrice
Fabr-ce Dec 18, 2024
c28f132
Complete the proof of `coverDirectImage`
jarctan Dec 18, 2024
04178a0
Finish proof of `preimageUnionThm`/`directImageUnionThm`
jarctan Dec 19, 2024
7bd31ce
Merge branch 'fabrice'
jarctan Dec 20, 2024
6bc4f1c
Acutally not Heine-Borel
jarctan Dec 22, 2024
4d29c57
Add documentation for SingletonSet file
dobito6 Jan 5, 2025
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
40 changes: 23 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / version := "0.7"
ThisBuild / version := "0.7"
ThisBuild / homepage := Some(url("https://github.com/epfl-lara/lisa"))
ThisBuild / startYear := Some(2021)
ThisBuild / organization := "ch.epfl.lara"
Expand All @@ -7,10 +7,10 @@ ThisBuild / organizationHomepage := Some(url("https://lara.epfl.ch"))
ThisBuild / licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html"))
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-unchecked",
)
"-feature",
"-deprecation",
"-unchecked"
)
ThisBuild / javacOptions ++= Seq("-encoding", "UTF-8")
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
Expand All @@ -19,7 +19,6 @@ val scala2 = "2.13.8"
val scala3 = "3.5.1"
val commonSettings = Seq(
crossScalaVersions := Seq(scala3),

run / fork := true
)

Expand All @@ -31,9 +30,8 @@ val commonSettings3 = commonSettings ++ Seq(
scalaVersion := scala3,
scalacOptions ++= Seq(
"-language:implicitConversions",
//"-rewrite", "-source", "3.4-migration",
// "-rewrite", "-source", "3.4-migration",
"-Wconf:msg=.*will never be selected.*:silent"

),
javaOptions += "-Xmx10G",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % "test",
Expand All @@ -50,9 +48,9 @@ def githubProject(repo: String, commitHash: String) = RootProject(uri(s"$repo#$c
lazy val customTstpParser = githubProject("https://github.com/SimonGuilloud/scala-tptp-parser.git", "eae9c1b7a9546f74779d77ff50fa6e8a1654cfa0")

lazy val root = Project(
id = "lisa",
base = file("."),
)
id = "lisa",
base = file(".")
)
.settings(commonSettings3)
.dependsOn(kernel, withTests(utils), withTests(sets)) // Everything but `examples`
.aggregate(utils) // To run tests on all modules
Expand All @@ -75,17 +73,26 @@ lazy val sets = Project(
.settings(commonSettings3)
.dependsOn(kernel, withTests(utils))

lazy val topologies = Project(
id = "lisa-topology",
base = file("lisa-topology")
)
.settings(commonSettings3)
.dependsOn(kernel, sets, withTests(utils))

lazy val utils = Project(
id = "lisa-utils",
base = file("lisa-utils")
)
.settings(commonSettings3 ++ Seq(
libraryDependencies += "ch.epfl.lara" %% "scallion" % "0.6" from "https://github.com/epfl-lara/scallion/releases/download/v0.6/scallion_3-0.6.jar",
libraryDependencies += "ch.epfl.lara" %% "silex" % "0.6" from "https://github.com/epfl-lara/silex/releases/download/v0.6/silex_3-0.6.jar",
))
.settings(
commonSettings3 ++ Seq(
libraryDependencies += "ch.epfl.lara" %% "scallion" % "0.6" from "https://github.com/epfl-lara/scallion/releases/download/v0.6/scallion_3-0.6.jar",
libraryDependencies += "ch.epfl.lara" %% "silex" % "0.6" from "https://github.com/epfl-lara/silex/releases/download/v0.6/silex_3-0.6.jar"
)
)
.dependsOn(kernel)
.dependsOn(customTstpParser)
//.settings(libraryDependencies += "io.github.leoprover" % "scala-tptp-parser_2.13" % "1.4")
//.settings(libraryDependencies += "io.github.leoprover" % "scala-tptp-parser_2.13" % "1.4")

ThisBuild / assemblyMergeStrategy := {
case PathList("module-info.class") => MergeStrategy.discard
Expand All @@ -97,7 +104,6 @@ ThisBuild / assemblyMergeStrategy := {
oldStrategy(x)
}


lazy val examples = Project(
id = "lisa-examples",
base = file("lisa-examples")
Expand Down
2 changes: 1 addition & 1 deletion lisa-sets/src/main/scala/lisa/automation/Congruence.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package lisa.automation
import leo.datastructures.TPTP.CNF.AtomicFormula
import lisa.fol.FOL.{*, given}
import lisa.prooflib.BasicStepTactic.*
import lisa.prooflib.ProofTacticLib.*
import lisa.prooflib.SimpleDeducedSteps.*
import lisa.prooflib.*
import lisa.utils.parsing.UnreachableException
import leo.datastructures.TPTP.CNF.AtomicFormula

/**
* This tactic tries to prove a sequent by congruence.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lisa.automation.settheory

import lisa.SetTheoryLibrary.{_, given}
import lisa.automation.Tautology
import lisa.automation.kernel.CommonTactics.ExistenceAndUniqueness
import lisa.fol.FOL.{_, given}
import lisa.kernel.proof.SequentCalculus as SCunique
import lisa.maths.Quantifiers
Expand All @@ -21,8 +22,10 @@ object SetTheoryTactics {
private val x = variable
private val y = variable
private val z = variable
private val v = variable
private val h = formulaVariable
private val P = predicate[1]
private val Q = predicate[1]
private val schemPred = predicate[1]

/**
Expand Down Expand Up @@ -197,4 +200,99 @@ object SetTheoryTactics {
unwrapTactic(sp)("Subproof for unique comprehension failed.")
}
}

/**
* Defines the element that is uniquely given by the uniqueness theorem, or falls back to the error element if the
* assumptions of the theorem are not satisfied.
*
* This is useful in defining specific elements in groups, where their uniqueness (and existence) strongly rely
* on the assumption of the group structure.
*/
object TheConditional {
def apply(using om: OutputManager)(u: Variable, f: Formula)(just: JUSTIFICATION, defaultValue: Term = ∅): The = {
val seq = just.statement

if (seq.left.isEmpty) {
The(u, f)(just)
} else {
val prem = if (seq.left.size == 1) seq.left.head else And(seq.left.toSeq)
val completeDef = (prem ==> f) /\ (!prem ==> (u === defaultValue))
val substF = completeDef.substitute(u := defaultValue)
val substDef = completeDef.substitute(u := v)

val completeUniquenessTheorem = Lemma(
∃!(u, completeDef)
) {
val case1 = have(prem |- ∃!(u, completeDef)) subproof {
// We prove the equivalence f <=> completeDef so that we can substitute it in the uniqueness quantifier
val equiv = have(prem |- ∀(u, f <=> completeDef)) subproof {
have(f |- f) by Hypothesis
thenHave((prem, f) |- f) by Weakening
val left = thenHave(f |- (prem ==> f)) by Restate

have(prem |- prem) by Hypothesis
thenHave((prem, !prem) |- ()) by LeftNot
thenHave((prem, !prem) |- (u === defaultValue)) by Weakening
val right = thenHave(prem |- (!prem ==> (u === defaultValue))) by Restate

have((prem, f) |- completeDef) by RightAnd(left, right)
val forward = thenHave(prem |- f ==> completeDef) by Restate

have(completeDef |- completeDef) by Hypothesis
thenHave((prem, completeDef) |- completeDef) by Weakening
thenHave((prem, completeDef) |- f) by Tautology
val backward = thenHave(prem |- completeDef ==> f) by Restate

have(prem |- f <=> completeDef) by RightIff(forward, backward)
thenHave(thesis) by RightForall
}

val substitution = have((∃!(u, f), ∀(u, f <=> completeDef)) |- ∃!(u, completeDef)) by Tautology.from(
Quantifiers.uniqueExistentialEquivalenceDistribution of (P := lambda(u, f), Q := lambda(u, completeDef))
)

val implication = have((prem, ∃!(u, f)) |- ∃!(u, completeDef)) by Cut(equiv, substitution)
val uniqueness = have(prem |- ∃!(u, f)) by Restate.from(just)
have(prem |- ∃!(u, completeDef)) by Cut(uniqueness, implication)
}

val case2 = have(!prem |- ∃!(u, completeDef)) subproof {
val existence = have(!prem |- ∃(u, completeDef)) subproof {
have(!prem |- !prem) by Hypothesis
thenHave((prem, !prem) |- ()) by LeftNot
thenHave((prem, !prem) |- substF) by Weakening
val left = thenHave(!prem |- (prem ==> substF)) by Restate

have(defaultValue === defaultValue) by RightRefl
thenHave(!prem |- defaultValue === defaultValue) by Weakening
val right = thenHave(!prem ==> (defaultValue === defaultValue)) by Restate

have(!prem |- (prem ==> substF) /\ (!prem ==> (defaultValue === defaultValue))) by RightAnd(left, right)
thenHave(thesis) by RightExists.withParameters(defaultValue)
}

val uniqueness = have((!prem, completeDef, substDef) |- (u === v)) subproof {
assume(!prem)
assume(completeDef)
assume(substDef)

val eq1 = have(u === defaultValue) by Tautology
val eq2 = have(defaultValue === v) by Tautology
val p = have((u === defaultValue) /\ (defaultValue === v)) by RightAnd(eq1, eq2)

val transitivity = Quantifiers.equalityTransitivity of (x -> u, y -> defaultValue, z -> v)
have(thesis) by Cut(p, transitivity)
}

have(thesis) by ExistenceAndUniqueness(completeDef)(existence, uniqueness)
}

have(thesis) by Tautology.from(case1, case2)
}

The(u, completeDef)(completeUniquenessTheorem)
}
}
}

}
22 changes: 16 additions & 6 deletions lisa-sets/src/main/scala/lisa/maths/settheory/SetTheory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -917,16 +917,21 @@ object SetTheory extends lisa.Main {
*/
val setIntersection = DEF(x, y) --> The(z, ∀(t, in(t, z) <=> (in(t, x) /\ in(t, y))))(setIntersectionUniqueness)

val setIntersectionCommutativity = Theorem(
setIntersection(x, y) === setIntersection(y, x)
val setIntersectionMembership = Theorem(
in(t, setIntersection(x, y)) <=> (in(t, x) /\ in(t, y))
) {
sorry
have(forall(t, in(t, setIntersection(x, y)) <=> (in(t, x) /\ in(t, y)))) by InstantiateForall(setIntersection(x, y))(setIntersection.definition)
thenHave(thesis) by InstantiateForall(t)
}

val setIntersectionMembership = Theorem(
in(t, setIntersection(x, y)) <=> (in(t, x) /\ in(t, y))
val setIntersectionCommutativity = Theorem(
setIntersection(x, y) === setIntersection(y, x)
) {
sorry
val left = have(in(t, setIntersection(x, y)) <=> (in(t, y) /\ in(t, x))) by Tautology.from(setIntersectionMembership)
val right = have(in(t, setIntersection(y, x)) <=> (in(t, y) /\ in(t, x))) by Tautology.from(setIntersectionMembership of (x := y, y := x))
have(in(t, setIntersection(x, y)) <=> in(t, setIntersection(y, x))) by Tautology.from(left, right)
val equalityPrepare = thenHave(forall(t, (in(t, setIntersection(x, y)) <=> in(t, setIntersection(y, x))))) by RightForall
have(thesis) by Tautology.from(equalityPrepare, extensionalityAxiom of (x := setIntersection(x, y), y := setIntersection(y, x)))
}

extension (x: Term) {
Expand Down Expand Up @@ -1030,6 +1035,11 @@ object SetTheory extends lisa.Main {
*/
val setDifference = DEF(x, y) --> The(z, ∀(t, in(t, z) <=> (in(t, x) /\ !in(t, y))))(setDifferenceUniqueness)

val setDifferenceMembership = Theorem(in(t, setDifference(x, y)) <=> (in(t, x) /\ !in(t, y))) {
have(∀(t, in(t, setDifference(x, y)) <=> (in(t, x) /\ !in(t, y)))) by InstantiateForall(setDifference(x, y))(setDifference.definition)
thenHave(thesis) by InstantiateForall(t)
}

/**
* Theorem --- Intersection of a non-empty Class is a Set
*
Expand Down
Loading