无法证明使用Program Fixpoint定义的函数的简单事实

时间:2012-11-29 01:12:34

标签: coq dependent-type

之前,我能够证明forall nat1: Nat, Trim nat1 -> Trim (pred nat1)以下pred的定义。

Fixpoint pred (nat1: Nat): Nat :=
  match nat1 with
  | Empt => Empt
  | Fill Zer nat3 => Fill One (pred nat3)
  | Fill One nat3 => trim (Fill Zer nat3)
  end.

但是根据pred的以下新定义,我不知道如何证明forall nat1: {nat2: Nat | Trim nat2 /\ Pos nat2}, Trim (pred nat1)

Program Fixpoint pred (nat1: Nat | Trim nat1 /\ Pos nat1) {measure (meas nat1)}: Nat :=
  match nat1 with
  | Empt => _
  | Fill Zer nat3 => Fill One (pred nat3)
  | Fill One nat3 => trim (Fill Zer nat3)
  end.

有人能给我一个暗示吗?我对sig证明东西一无所知。或者也许我做错了什么。我不知道。完整代码为here。上一个代码here

1 个答案:

答案 0 :(得分:4)

我决定作弊。

Fixpoint pred' (n1: Nat): Nat :=
  match n1 with
  | Empt => Empt
  | Fill Zer n1 => Fill One (pred' n1)
  | Fill One n1 => trim (Fill Zer n1)
  end.

Definition pred (n1: Nat) (H1: Trim n1) (H2: comp n1 zer = Great): Nat :=
  pred' n1.