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
befd7976
Commit
befd7976
authored
2 years ago
by
Katja Goltsova
Committed by
Viktor Kunčak
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Generalize instantiateForallAxiom to instantiateForallImport
parent
73a298ee
Branches
Branches containing commit
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
+14
-13
14 additions, 13 deletions
src/main/scala/lisa/proven/mathematics/Peano.scala
with
14 additions
and
13 deletions
src/main/scala/lisa/proven/mathematics/Peano.scala
+
14
−
13
View file @
befd7976
...
@@ -20,17 +20,18 @@ object Peano {
...
@@ -20,17 +20,18 @@ object Peano {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{}
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
def
instantiateForallAxiom
(
ax
:
Axiom
,
t
:
Term
)
:
SCProof
=
{
def
instantiateForallImport
(
proofImport
:
Sequent
,
t
:
Peano.Term
)
:
SCProof
=
{
val
formula
=
ax
.
ax
require
(
proofImport
.
right
.
size
==
1
)
val
formula
=
proofImport
.
right
.
head
require
(
formula
.
isInstanceOf
[
BinderFormula
]
&&
formula
.
asInstanceOf
[
BinderFormula
].
label
==
Forall
)
require
(
formula
.
isInstanceOf
[
BinderFormula
]
&&
formula
.
asInstanceOf
[
BinderFormula
].
label
==
Forall
)
val
forall
=
ax
.
ax
.
asInstanceOf
[
BinderFormula
]
val
forall
=
formula
.
asInstanceOf
[
BinderFormula
]
instantiateForall
(
SCProof
(
IndexedSeq
(),
IndexedSeq
(
ax
)))
instantiateForall
(
SCProof
(
IndexedSeq
(),
IndexedSeq
(
proofImport
)))
val
tempVar
=
VariableLabel
(
freshId
(
formula
.
freeVariables
.
map
(
_
.
id
),
"x"
))
val
tempVar
=
VariableLabel
(
freshId
(
formula
.
freeVariables
.
map
(
_
.
id
),
"x"
))
val
instantiated
=
instantiateBinder
(
forall
,
t
)
val
instantiated
=
instantiateBinder
(
forall
,
t
)
val
p1
=
Hypothesis
(
instantiated
|-
instantiated
,
instantiated
)
val
p1
=
Hypothesis
(
instantiated
|-
instantiated
,
instantiated
)
val
p2
=
LeftForall
(
formula
|-
instantiated
,
0
,
instantiateBinder
(
forall
,
tempVar
),
tempVar
,
t
)
val
p2
=
LeftForall
(
formula
|-
instantiated
,
0
,
instantiateBinder
(
forall
,
tempVar
),
tempVar
,
t
)
val
p3
=
Cut
(()
|-
instantiated
,
-
1
,
1
,
formula
)
val
p3
=
Cut
(()
|-
instantiated
,
-
1
,
1
,
formula
)
Proof
(
IndexedSeq
(
p1
,
p2
,
p3
),
IndexedSeq
(
ax
))
Proof
(
IndexedSeq
(
p1
,
p2
,
p3
),
IndexedSeq
(
proofImport
))
}
}
def
applyInduction
(
baseProof
:
SCSubproof
,
inductionStepProof
:
SCSubproof
,
inductionInstance
:
SCProofStep
)
:
IndexedSeq
[
SCProofStep
]
=
{
def
applyInduction
(
baseProof
:
SCSubproof
,
inductionStepProof
:
SCSubproof
,
inductionInstance
:
SCProofStep
)
:
IndexedSeq
[
SCProofStep
]
=
{
...
@@ -76,7 +77,7 @@ object Peano {
...
@@ -76,7 +77,7 @@ object Peano {
// result: ax4plusSuccessor |- 0+Sx = S(0 + x)
// result: ax4plusSuccessor |- 0+Sx = S(0 + x)
val
instanceAx4_4
=
SCSubproof
(
val
instanceAx4_4
=
SCSubproof
(
instantiateForall
(
instantiateForall
Axiom
(
ax
"ax4plusSuccessor"
,
zero
),
x
),
instantiateForall
(
instantiateForall
Import
(
ax
"ax4plusSuccessor"
,
zero
),
x
),
Seq
(-
1
)
Seq
(-
1
)
)
)
val
cut5
=
Cut
(()
|-
(
x
===
plus
(
zero
,
x
))
==>
(
s
(
x
)
===
plus
(
zero
,
s
(
x
))),
4
,
3
,
plus
(
zero
,
s
(
x
))
===
s
(
plus
(
zero
,
x
)))
val
cut5
=
Cut
(()
|-
(
x
===
plus
(
zero
,
x
))
==>
(
s
(
x
)
===
plus
(
zero
,
s
(
x
))),
4
,
3
,
plus
(
zero
,
s
(
x
))
===
s
(
plus
(
zero
,
x
)))
...
@@ -95,11 +96,11 @@ object Peano {
...
@@ -95,11 +96,11 @@ object Peano {
)
)
val
instancePlusZero8
=
SCSubproof
(
val
instancePlusZero8
=
SCSubproof
(
instantiateForall
Axiom
(
ax
"ax3neutral"
,
x
),
instantiateForall
Import
(
ax
"ax3neutral"
,
x
),
Seq
(-
2
)
Seq
(-
2
)
)
)
val
instancePlusZero9
=
SCSubproof
(
val
instancePlusZero9
=
SCSubproof
(
instantiateForall
Axiom
(
ax
"ax3neutral"
,
s
(
x
)),
instantiateForall
Import
(
ax
"ax3neutral"
,
s
(
x
)),
Seq
(-
2
)
Seq
(-
2
)
)
)
val
rightAnd10
=
RightAnd
(()
|-
(
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
rightAnd10
=
RightAnd
(()
|-
(
plus
(
x
,
zero
)
===
x
)
/\
(
plus
(
s
(
x
),
zero
)
===
s
(
x
)),
Seq
(
8
,
9
),
Seq
(
plus
(
x
,
zero
)
===
x
,
plus
(
s
(
x
),
zero
)
===
s
(
x
)))
...
@@ -148,11 +149,11 @@ object Peano {
...
@@ -148,11 +149,11 @@ object Peano {
//////////////////////////////////// Base: x + S0 = Sx + 0 ///////////////////////////////////////////////
//////////////////////////////////// Base: x + S0 = Sx + 0 ///////////////////////////////////////////////
val
base0
=
{
val
base0
=
{
// x + 0 = x
// x + 0 = x
val
xEqXPlusZero0
=
SCSubproof
(
instantiateForall
Axiom
(
ax
"ax3neutral"
,
x
),
IndexedSeq
(-
1
))
val
xEqXPlusZero0
=
SCSubproof
(
instantiateForall
Import
(
ax
"ax3neutral"
,
x
),
IndexedSeq
(-
1
))
// Sx + 0 = Sx
// Sx + 0 = Sx
val
succXEqSuccXPlusZero1
=
SCSubproof
(
instantiateForall
Axiom
(
ax
"ax3neutral"
,
s
(
x
)),
IndexedSeq
(-
1
))
val
succXEqSuccXPlusZero1
=
SCSubproof
(
instantiateForall
Import
(
ax
"ax3neutral"
,
s
(
x
)),
IndexedSeq
(-
1
))
// x + S0 = S(x + 0)
// x + S0 = S(x + 0)
val
xPlusSuccZero2
=
SCSubproof
(
instantiateForall
(
instantiateForall
Axiom
(
ax
"ax4plusSuccessor"
,
x
),
zero
),
IndexedSeq
(-
2
))
val
xPlusSuccZero2
=
SCSubproof
(
instantiateForall
(
instantiateForall
Import
(
ax
"ax4plusSuccessor"
,
x
),
zero
),
IndexedSeq
(-
2
))
// ------------------- x + 0 = x, Sx + 0 = Sx, x + S0 = S(x + 0) |- Sx + 0 = x + S0 ---------------------
// ------------------- x + 0 = x, Sx + 0 = Sx, x + S0 = S(x + 0) |- Sx + 0 = x + S0 ---------------------
val
succX3
=
RightRefl
(()
|-
s
(
x
)
===
s
(
x
),
s
(
x
)
===
s
(
x
))
val
succX3
=
RightRefl
(()
|-
s
(
x
)
===
s
(
x
),
s
(
x
)
===
s
(
x
))
...
@@ -187,10 +188,10 @@ object Peano {
...
@@ -187,10 +188,10 @@ object Peano {
/////////////// Induction step: ∀y. (x + Sy === Sx + y) ==> (x + SSy === Sx + Sy) ////////////////////
/////////////// Induction step: ∀y. (x + Sy === Sx + y) ==> (x + SSy === Sx + Sy) ////////////////////
val
inductionStep1
=
{
val
inductionStep1
=
{
// x + SSy = S(x + Sy)
// x + SSy = S(x + Sy)
val
moveSuccessor0
=
SCSubproof
(
instantiateForall
(
instantiateForall
Axiom
(
ax
"ax4plusSuccessor"
,
x
),
s
(
y
)),
IndexedSeq
(-
2
))
val
moveSuccessor0
=
SCSubproof
(
instantiateForall
(
instantiateForall
Import
(
ax
"ax4plusSuccessor"
,
x
),
s
(
y
)),
IndexedSeq
(-
2
))
// Sx + Sy = S(Sx + y)
// Sx + Sy = S(Sx + y)
val
moveSuccessor1
=
SCSubproof
(
instantiateForall
(
instantiateForall
Axiom
(
ax
"ax4plusSuccessor"
,
s
(
x
)),
y
),
IndexedSeq
(-
2
))
val
moveSuccessor1
=
SCSubproof
(
instantiateForall
(
instantiateForall
Import
(
ax
"ax4plusSuccessor"
,
s
(
x
)),
y
),
IndexedSeq
(-
2
))
// ----------- x + SSy = S(x + Sy), x + Sy = Sx + y, S(Sx + y) = Sx + Sy |- x + SSy = Sx + Sy ------------
// ----------- x + SSy = S(x + Sy), x + Sy = Sx + y, S(Sx + y) = Sx + Sy |- x + SSy = Sx + Sy ------------
val
middleEq2
=
RightRefl
(()
|-
s
(
plus
(
x
,
s
(
y
)))
===
s
(
plus
(
x
,
s
(
y
))),
s
(
plus
(
x
,
s
(
y
)))
===
s
(
plus
(
x
,
s
(
y
))))
val
middleEq2
=
RightRefl
(()
|-
s
(
plus
(
x
,
s
(
y
)))
===
s
(
plus
(
x
,
s
(
y
))),
s
(
plus
(
x
,
s
(
y
)))
===
s
(
plus
(
x
,
s
(
y
))))
...
...
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