我正在研究库里-霍华德函授。
给定命题逻辑陈述:¬(p ∨ q) -> (¬p ∧ ¬q)
.
我需要在 OCaml 中定义一个类型(作为命题)和一个函数(作为证明)。
我已经定义了类型但不知道如何实现功能:
type empty = |
type ('a , 'b) coprod = Left of 'a | Right of 'b
let ex513: (('p, 'q) coprod -> empty) -> ('p -> empty) * ('q -> empty) = fun ?
在发布问题之前我做了什么:
- 我已经验证了这个陈述在直觉逻辑中是可以证明的。
- 试图建设性地理解:如果存在
function1
将 p 的证明或 q 的证明转换为⊥,那么我们可以构造元组(function2
将 p 的证明转换为⊥,function3
将 q 的证明转换为⊥)。执行(function1(p), function1(q))
- 实施了类似的任务以更好地理解问题:
p ∨ q -> ¬(¬p ∧ ¬q)
.
代码:
let func1: ('p, 'q) coprod -> ('p-> empty) * ('q-> empty) -> empty = fun x (f, g)->
match x with
| Left x -> f(x)
| Right x -> g(x)