4

之前,我能够证明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. 或者,也许我做错了什么。我不知道。完整的代码在这里。之前的代码在这里

4

1 回答 1

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.
于 2012-12-01T00:06:58.103 回答