-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharith_nat.ivy
78 lines (67 loc) · 1.82 KB
/
arith_nat.ivy
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
#lang ivy1.7
include deduction
axiom [admit] {
relation p
property p
}
module arith_nat = {
type this
interpret this -> nat
# theorem [lep] {
# function p(X:this) : bool
# property [prem1] exists Z. p(Z)
# property exists L. p(L) & forall B. (p(B) -> L <= B)
# }
# proof {
# instantiate [p] lep[this] with n=0:this,p(X) = p(X)
# tactic skolemize
# instantiate with L = _L
# instantiate p with B = _B(_L)
# }
axiom [gen_ind] {
relation p(X:this)
theorem [prem] {
individual x:this
property [ind_hyp] forall Y. Y < x -> p(Y)
property p(x)
}
#--------------------------
property p(X)
}
theorem [gep] {
individual n : this
function p(X:this) : bool
property [prem1] exists Z. p(Z)
property [prem2] forall Y. ~(Y > n & p(Y))
property exists L. p(L) & forall B. (p(B) -> L >= B)
}
proof {
apply elimImp with prem1 = prem2
forget prem2
apply ind[this] with X=n
proof [base] {
apply introImp<p1/prem>
apply introImp<p2/prem>
tactic skolemize
instantiate [p3] p2 with Y = _Z
instantiate with L = 0:this
instantiate p2 with Y = _B(0)
}
proof [step] {
apply introImp<p1/prem>
apply introImp<p2/prem>
apply exmid with q = p(x+1)
proof [pos] {
instantiate with L=x+1
tactic skolemize
instantiate p2 with Y = _B
forget p1
}
proof [neg] {
tactic skolemize
instantiate p2 with Y = _Y
instantiate with L = _L
}
}
}
}