-
Notifications
You must be signed in to change notification settings - Fork 18
/
pi2pigeonhole.scala
62 lines (52 loc) · 1.62 KB
/
pi2pigeonhole.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
package gapt.examples
import gapt.expr._
import gapt.formats.babel.Notation
import gapt.formats.babel.Precedence
import gapt.proofs.context.update.Sort
import gapt.proofs.gaptic._
object Pi2Pigeonhole extends TacticsProof {
ctx += Sort( "i" )
ctx += hoc"0: i"
ctx += hoc"s: i>i"
ctx += hoc"M: i>i>i"
ctx += hoc"f: i>i"
ctx += hoc"'<=': i>i>o"
ctx += Notation.Infix( "<=", Precedence.infixRel )
val proof = Lemma( hols"""
maxlt: ∀x∀y (x <= M x y ∧ y <= M x y),
bound: ∀x (f x = 0 ∨ f x = s 0)
:- t: ∃x ∃y (s x <= y ∧ f x = f y)
""" ) {
cut( "I0", hof"∀x ∃y (x <= y ∧ f y = 0)" )
cut( "I1", hof"∀x ∃y (x <= y ∧ f y = s 0)" )
forget( "t" ); escargot.withDeskolemization
allL( "I1", le"0" ); decompose
allL( "I1", le"s y" ); decompose
forget( "I0", "I1" ); escargot
allL( "I0", le"0" ); decompose
allL( "I0", le"s y" ); decompose
forget( "I0" ); escargot
}
}
object Pi3Pigeonhole extends TacticsProof {
ctx += Sort( "i" )
ctx += hoc"0: i"
ctx += hoc"s: i>i"
ctx += hoc"M: i>i>i"
ctx += hoc"f: i>i"
ctx += hoc"'<=': i>i>o"
ctx += Notation.Infix( "<=", Precedence.infixRel )
val proof = Lemma( hols"""
maxlt: ∀x∀y (x <= M x y ∧ y <= M x y),
bound: ∀x (f x = 0 ∨ f x = s 0)
:- t: ∃x ∃y (s x <= y ∧ f x = f y)
""" ) {
cut( "I", hof"∃z ∀x ∃y (x <= y ∧ f y = z)" )
exR( "I", le"0" ); exR( "I", le"s 0" )
forget( "t", "I" ); escargot.withDeskolemization
decompose
allL( "I", le"0" ); decompose
allL( "I", le"s y" ); decompose
forget( "I" ); escargot
}
}