Frage

Before, I was able to prove forall nat1: Nat, Trim nat1 -> Trim (pred nat1) for the following definition of 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.

But with the following new definition of pred I don't know how to prove 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.

Could someone give me a hint? I don't know anything about proving stuff with sig. Or maybe I'm doing something wrong. I don't know. The full code is here. The previous code here.

War es hilfreich?

Lösung

I've decided to cheat.

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.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top