coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Adam Chlipala <adamc AT csail.mit.edu>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] Recursion on second component of subset type
- Date: Fri, 14 Feb 2014 19:53:15 -0500
On 02/14/2014 07:22 PM, Anders Lundstedt wrote:
Inductive is_A_formula : Prop -> Type :=
| atom_formula P : is_A_atom P -> is_A_formula P
| and_formula P Q : is_A_formula P -> is_A_formula Q -> is_A_formula (P /\
Q).
Definition A_formulas := {P : Prop& is_A_formula P}.
[...]
(* this is the form I would prefer, this gives "cannot guess decreasing
argument of fix". I guess this is caused by the above error *)
Fixpoint realizes' (a : A) (P : A_formulas) : Prop :=
let (P, pf) := P in match pf with
| atom_formula _ _ => P
| and_formula P Q pf_P pf_Q => realizes' (p0 a) (existT _ P pf_P) /\
realizes' (p1 a) (existT _ Q pf_Q)
end.
Why not just write a helper function with a type like this?
A -> forall P, is_A_formula P -> Prop
Then you can pattern-match on the 3rd argument without any fuss.
- [Coq-Club] Recursion on second component of subset type, Anders Lundstedt, 02/15/2014
- Re: [Coq-Club] Recursion on second component of subset type, Adam Chlipala, 02/15/2014
- Re: [Coq-Club] Recursion on second component of subset type, Anders Lundstedt, 02/16/2014
- Re: [Coq-Club] Recursion on second component of subset type, Adam Chlipala, 02/15/2014
Archive powered by MHonArc 2.6.18.