Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lisa
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
lisa
Commits
96085809
Commit
96085809
authored
2 years ago
by
Katja Goltsova
Committed by
Viktor Kunčak
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Prove in Peano arithmetics that x + 0 = 0 + x
parent
453f3674
No related branches found
No related tags found
3 merge requests
!54
Front integration
,
!53
Front integration
,
!52
Front integration
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/lisa/proven/mathematics/Peano.scala
+115
-1
115 additions, 1 deletion
src/main/scala/lisa/proven/mathematics/Peano.scala
with
115 additions
and
1 deletion
src/main/scala/lisa/proven/mathematics/Peano.scala
+
115
−
1
View file @
96085809
package
lisa.proven.mathematics
package
lisa.proven.mathematics
import
lisa.utils.Helpers.
{
given
,
*}
import
lisa.kernel.fol.FOL.
*
import
lisa.kernel.fol.FOL.
*
import
lisa.kernel.proof.RunningTheory
import
lisa.kernel.proof.RunningTheory
import
lisa.kernel.proof.SCProof
import
lisa.kernel.proof.SCProof
...
@@ -12,5 +11,120 @@ import lisa.utils.Library
...
@@ -12,5 +11,120 @@ import lisa.utils.Library
object
Peano
{
object
Peano
{
export
lisa
.
proven
.
PeanoArithmeticsLibrary
.{*,
given
}
export
lisa
.
proven
.
PeanoArithmeticsLibrary
.{*,
given
}
/////////////////////////// OUTPUT CONTROL //////////////////////////
given
output
:
(
String
=>
Unit
)
=
println
given
output
:
(
String
=>
Unit
)
=
println
given
finishOutput
:
(
Throwable
=>
Nothing
)
=
e
=>
throw
e
def
main
(
args
:
Array
[
String
])
:
Unit
=
{}
/////////////////////////////////////////////////////////////////////
THEOREM
(
"x + 0 = 0 + x"
)
of
"∀x. plus(x, zero) === plus(zero, x)"
PROOF
{
val
refl0
:
SCProofStep
=
RightRefl
(()
|-
s
(
x
)
===
s
(
x
),
s
(
x
)
===
s
(
x
))
val
subst1
=
RightSubstEq
((
x
===
plus
(
zero
,
x
))
|-
s
(
x
)
===
s
(
plus
(
zero
,
x
)),
0
,
(
x
,
plus
(
zero
,
x
))
::
Nil
,
LambdaTermFormula
(
Seq
(
y
),
s
(
x
)
===
s
(
y
)))
val
implies2
=
RightImplies
(()
|-
(
x
===
plus
(
zero
,
x
))
==>
(
s
(
x
)
===
s
(
plus
(
zero
,
x
))),
1
,
x
===
plus
(
zero
,
x
),
s
(
x
)
===
s
(
plus
(
zero
,
x
)))
val
transform3
=
RightSubstEq
(
(
plus
(
zero
,
s
(
x
))
===
s
(
plus
(
zero
,
x
)))
|-
(
x
===
plus
(
zero
,
x
))
==>
(
s
(
x
)
===
plus
(
zero
,
s
(
x
))),
2
,
(
plus
(
zero
,
s
(
x
)),
s
(
plus
(
zero
,
x
)))
::
Nil
,
LambdaTermFormula
(
Seq
(
y
),
(
x
===
plus
(
zero
,
x
))
==>
(
s
(
x
)
===
y
))
)
// result: ax4plusSuccessor |- 0+Sx = S(0 + x)
val
instanceAx4_4
=
SCSubproof
(
instantiateForall
(
SCProof
(
IndexedSeq
[
SCProofStep
](
Hypothesis
(
ax4plusSuccessor
|-
ax4plusSuccessor
,
ax4plusSuccessor
)),
IndexedSeq
(()
|-
ax4plusSuccessor
)),
zero
,
x
),
Seq
(-
1
)
)
val
cut5
=
Cut
(
ax4plusSuccessor
|-
(
x
===
plus
(
zero
,
x
))
==>
(
s
(
x
)
===
plus
(
zero
,
s
(
x
))),
4
,
3
,
plus
(
zero
,
s
(
x
))
===
s
(
plus
(
zero
,
x
)))
val
transform6
=
RightSubstEq
(
Set
(
ax4plusSuccessor
,
plus
(
x
,
zero
)
===
x
,
plus
(
s
(
x
),
zero
)
===
s
(
x
))
|-
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
))),
5
,
(
plus
(
x
,
zero
),
x
)
::
(
plus
(
s
(
x
),
zero
),
s
(
x
))
::
Nil
,
LambdaTermFormula
(
Seq
(
y
,
z
),
(
y
===
plus
(
zero
,
x
))
==>
(
z
===
plus
(
zero
,
s
(
x
))))
)
val
leftAnd7
=
LeftAnd
(
Set
(
ax4plusSuccessor
,
(
plus
(
x
,
zero
)
===
x
)
/\
(
plus
(
s
(
x
),
zero
)
===
s
(
x
)))
|-
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
))),
6
,
plus
(
x
,
zero
)
===
x
,
plus
(
s
(
x
),
zero
)
===
s
(
x
)
)
val
instancePlusZero8
=
SCSubproof
(
instantiateForall
(
SCProof
(
IndexedSeq
[
SCProofStep
](
Hypothesis
(
ax3neutral
|-
ax3neutral
,
ax3neutral
)),
IndexedSeq
(()
|-
ax3neutral
)),
x
),
Seq
(-
2
)
)
val
instancePlusZero9
=
SCSubproof
(
instantiateForall
(
SCProof
(
IndexedSeq
[
SCProofStep
](
Hypothesis
(
ax3neutral
|-
ax3neutral
,
ax3neutral
)),
IndexedSeq
(()
|-
ax3neutral
)),
s
(
x
)),
Seq
(-
2
)
)
val
rightAnd10
=
RightAnd
(
ax3neutral
|-
(
plus
(
x
,
zero
)
===
x
)
/\
(
plus
(
s
(
x
),
zero
)
===
s
(
x
)),
Seq
(
8
,
9
),
Seq
(
plus
(
x
,
zero
)
===
x
,
plus
(
s
(
x
),
zero
)
===
s
(
x
)))
val
cut11
=
Cut
(
Set
(
ax4plusSuccessor
,
ax3neutral
)
|-
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
))),
10
,
7
,
(
plus
(
x
,
zero
)
===
x
)
/\
(
plus
(
s
(
x
),
zero
)
===
s
(
x
))
)
val
forall12
=
RightForall
(
cut11
.
bot
.
left
|-
forall
(
x
,
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
)))),
11
,
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
))),
x
)
val
hypConclusion13
=
hypothesis
(
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)))
val
inductionLhs14
=
LeftImplies
(
Set
(
ax4plusSuccessor
,
ax3neutral
,
forall
(
x
,
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
))))
==>
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)))
|-
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)
),
12
,
13
,
forall
(
x
,
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
)))),
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
)
val
inductionInstance15
:
SCProofStep
=
InstPredSchema
(
()
|-
((
plus
(
zero
,
zero
)
===
plus
(
zero
,
zero
))
/\
forall
(
x
,
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
)))))
==>
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)
),
-
3
,
Map
(
sPhi
->
LambdaTermFormula
(
Seq
(
x
),
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)))
)
val
commutesWithZero16
=
Cut
(
Set
(
ax4plusSuccessor
,
ax3neutral
)
|-
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)),
15
,
14
,
((
plus
(
zero
,
zero
)
===
plus
(
zero
,
zero
))
/\
forall
(
x
,
(
plus
(
x
,
zero
)
===
plus
(
zero
,
x
))
==>
(
plus
(
s
(
x
),
zero
)
===
plus
(
zero
,
s
(
x
)))))
==>
forall
(
x
,
plus
(
x
,
zero
)
===
plus
(
zero
,
x
)
)
)
SCProof
(
IndexedSeq
(
refl0
,
subst1
,
implies2
,
transform3
,
instanceAx4_4
,
cut5
,
transform6
,
leftAnd7
,
instancePlusZero8
,
instancePlusZero9
,
rightAnd10
,
cut11
,
forall12
,
hypConclusion13
,
inductionLhs14
,
inductionInstance15
,
commutesWithZero16
),
IndexedSeq
(
ax
"ax4plusSuccessor"
,
ax
"ax3neutral"
,
ax
"ax7induction"
)
)
}
using
(
ax
"ax4plusSuccessor"
,
ax
"ax3neutral"
,
ax
"ax7induction"
)
show
}
}
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