我找到了一个我想要解决的有趣逻辑定理的source code。但是当我在CoqIDE中运行它时,它会在最开始时卡住。
Inductive Term: Set :=
K: Term |
S: Term |
app: Term -> Term -> Term.
Inductive one_step: Term -> Term -> Prop :=
redk: (m, n: Term) (one_step (app (app K m) n) m) |
reds: (m, n, p: Term) (one_step (app (app (app S m) n) p) (app (app m p) (app n p))) |
redl: (m, m', n: Term) (one_step m m') -> (one_step (app m n) (app m' n)) |
redr: (m, n, n': Term) (one_step n n') -> (one_step (app m n) (app m n')).
one_step
的定义失败,因为The reference m was not found in the current environment.
我理解缺少的术语是forall
,但原始代码是如何在没有它的情况下运行的?是否需要加载一些模块以使其隐含?
编译代码所需的其他模块列表也非常有用,如果有的话。
答案 0 :(得分:4)
自版本7.4以来,语法发生了一些变化,这是使用此开发进行测试的版本。这是一个适用于8.4的版本:
Inductive Term: Set :=
K: Term |
S: Term |
app: Term -> Term -> Term.
Inductive one_step: Term -> Term -> Prop :=
| redk (m n: Term) : one_step (app (app K m) n) m
| reds (m n p: Term) : one_step (app (app (app S m) n) p) (app (app m p) (app n p))
| redl (m m' n: Term) : one_step m m' -> one_step (app m n) (app m' n)
| redr (m n n': Term) : one_step n n' -> one_step (app m n) (app m n').