-
Notifications
You must be signed in to change notification settings - Fork 18
/
StrongStrictMonotinoeSchema.scala
138 lines (128 loc) · 3.87 KB
/
StrongStrictMonotinoeSchema.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package gapt.examples
import gapt.expr._
import gapt.proofs.Sequent
import gapt.proofs.context.update.InductiveType
import gapt.proofs.context.update.{ PrimitiveRecursiveFunction => PrimRecFun }
import gapt.proofs.context.update.ProofDefinitionDeclaration
import gapt.proofs.context.update.ProofNameDeclaration
import gapt.proofs.context.update.Sort
import gapt.proofs.gaptic._
object StrongStrictMonotoneSchema extends TacticsProof {
ctx += InductiveType( "nat", hoc"0 : nat", hoc"s : nat>nat" )
ctx += Sort( "i" )
ctx += hoc"f:i>nat"
ctx += hoc"suc:i>i"
ctx += hoc"z:i"
ctx += hoc"E: nat>nat>o"
ctx += hoc"Eq: i>i>o"
ctx += hoc"LE: nat>nat>o"
ctx += hoc"LEQ: nat>nat>o"
ctx += hoc"iLEQ: i>i>o"
ctx += hoc"omega: nat>nat"
ctx += hoc"phi: nat>nat"
ctx += PrimRecFun( hoc"POR:nat>i>o", "POR 0 x = E 0 (f x) ", "POR (s y) x = (E (s y) (f x) ∨ POR y x)" )
ctx += "LEDefinition" -> hos"POR(n,a) :- LE(f(a), s(n))"
ctx += "NumericTransitivity" -> hos"E(n,f(a)),E(n,f(suc(a))) :- E(f(a), f(suc(a)))"
ctx += "minimalElement" -> hos"LE(n,0) :- "
ctx += "reflexivity" -> hos" :- iLEQ(a,a)"
ctx += "SucDef" -> hos":- iLEQ(a,suc(a))"
ctx += "ordcon" -> hos"LE(f(a),s(n)),iLEQ(a,b) :- E(n,f(b)), LE(f(b),n)"
val esOmega = Sequent(
Seq( hof"!x POR(n,x)" ),
Seq( hof"?x ( E(f(x), f(suc(x))) )" ) )
ctx += ProofNameDeclaration( le"omega n", esOmega )
val esPhi = Sequent(
Seq( hof"?x !y ((iLEQ(x,y) -> E(n,f(y))) | LE(f(y),n))" ),
Seq( hof"?x ( E(f(x), f(suc(x))) )" ) )
ctx += ProofNameDeclaration( le"phi n", esPhi )
//The base case of omega
val esOmegaBc =
Sequent(
Seq( "Ant_0" -> hof"!x POR(0,x)" ),
Seq( "Suc_0" -> hof"?x (E(f(x), f(suc(x))))" ) )
val omegaBc = Lemma( esOmegaBc ) {
cut( "cut", hof"?x !y ((iLEQ(x,y) -> E(0,f(y))) | LE(f(y),0))" )
exR( "cut", hoc"z" )
allR( "cut_0", fov"a" )
orR
impR
allL( "Ant_0", fov"a" )
unfold( "POR" ) atMost 1 in "Ant_0_0"
trivial
ref( "phi" )
}
ctx += ProofDefinitionDeclaration( le"omega 0", omegaBc )
val esOmegaSc =
Sequent(
Seq( "Ant_0" -> hof"!x POR(s(n),x)" ),
Seq( "Suc_0" -> hof"?x (E(f(x), f(suc(x))))" ) )
val omegaSc = Lemma( esOmegaSc ) {
cut( "cut", hof"?x !y ((iLEQ(x,y) -> E(s(n),f(y))) | LE(f(y),s(n)))" )
exR( "cut", hoc"z" )
allR( "cut_0", fov"a" )
orR
impR
allL( "Ant_0", fov"a" )
unfold( "POR" ) atMost 1 in "Ant_0_0"
orL
trivial
ref( "LEDefinition" )
ref( "phi" )
}
ctx += ProofDefinitionDeclaration( le"omega (s n)", omegaSc )
val esPhiBc =
Sequent(
Seq( "Ant_0" -> hof"?x !y ((iLEQ(x,y) -> E(0,f(y))) | LE(f(y),0))" ),
Seq( "Suc_0" -> hof"?x (E(f(x), f(suc(x))) )" ) )
val phiBc = Lemma( esPhiBc ) {
exL( fov"a" )
allL( fov"a" )
allL( le"(suc a)" )
exR( fov"a" )
orL( "Ant_0_0" )
orL( "Ant_0_1" )
impL( "Ant_0_0" )
impL( "Ant_0_1" )
ref( "SucDef" )
ref( "reflexivity" )
impL( "Ant_0_1" )
ref( "SucDef" )
ref( "NumericTransitivity" )
ref( "minimalElement" )
ref( "minimalElement" )
}
ctx += ProofDefinitionDeclaration( le"phi 0", phiBc )
val esPhiSc =
Sequent(
Seq( "Ant_0" -> hof"?x !y ((iLEQ(x,y) -> E(s(n),f(y))) | LE(f(y),s(n)))" ),
Seq( "Suc_0" -> hof"?x (E(f(x), f(suc(x))) )" ) )
val phiSc = Lemma( esPhiSc ) {
cut( "cut", hof"?x !y ((iLEQ(x,y) -> E(n,f(y))) | LE(f(y),n))" )
exL( fov"a" )
exR( "cut", fov"a" )
exR( "cut", le"(suc a)" )
allL( fov"a" )
allR( "cut_0", fov"b" )
orR
impR
orL
focus( 1 )
ref( "ordcon" )
impL
ref( "reflexivity" )
allR( "cut_1", fov"c" )
orR
impR
allL( le"suc(a)" )
orL
focus( 1 )
ref( "ordcon" )
impL
ref( "SucDef" )
focus( 1 )
ref( "phi" )
exR( "Suc_0", fov"a" )
ref( "NumericTransitivity" )
}
ctx += ProofDefinitionDeclaration( le"phi (s n)", phiSc )
}