Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] [HELP] Tactics to reduce `fix` terms

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] [HELP] Tactics to reduce `fix` terms


Chronological Thread 
  • From: Gaëtan Gilbert <gaetan.gilbert AT skyskimmer.net>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] [HELP] Tactics to reduce `fix` terms
  • Date: Fri, 12 Jan 2018 22:23:51 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gaetan.gilbert AT skyskimmer.net; spf=Pass smtp.mailfrom=gaetan.gilbert AT skyskimmer.net; spf=None smtp.helo=postmaster AT relay2-d.mail.gandi.net
  • Ironport-phdr: 9a23:Bh7RixYB43m9CQdP3nNHJqn/LSx+4OfEezUN459isYplN5qZr8q+bnLW6fgltlLVR4KTs6sC17KP9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCagbb9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjAk7m/XhMx+gqFVrh2vqBNwwZLbbo6OOfpifa7QZ88WSXZPU8tTUSFKH4Oyb5EID+oEJetWrpPyoEcSrRSkAwmjHOLhyj5MhnDtw6I6yfghGhzB0QwvBd0BrmjUo8/zNKsIXuC1za3Iwi7dYPNMxTfw85PIchMhoPGXXrJwcM/RyUwxGAPflFmQr5LqPy+M2+kLrmOV4e1gVee1hG4mrQF8ujmvxsE2ionInI0Z0F7E9T9/zY0oJtO4UFZ2bcC5HJZSrS2XNZd6Ttk/T2xrtis20KAKtJq0cSQS1pgo3QLTZ+GCfoeW7B/uVOOcLDRji39kZb6yggi9/Vagx+HgU8S03llHoytHn9TJqHwBywLc58aCR/Zy8EquwiiA2gXT5+xLP0w7iKzWIIM7zLEqjJocq0HDEzf2mEroiK+WcV0p+vK25OTjeLrnpoGQO5ZphQ3kN6QhgM2/AeAiPggBRWeb//mz1Lz58U3/XrpKkuU6kqjfsJ/EOcQWvrC1DxJX34o56RuzEy2q3MkbkHQJNl5JZRaKgofxN1HLOv/4DPO/g1q2kDdswvDLJrLhDY/TIXjfirjhe6xx60FdyAo31t9Q+YhUCq0aLfLoWU/wtMfYDhw4MwyxxuboFs992pkYWW2RHq+VKLnSvkOQ5uIzP+mMY5cYtyr6K/g8/vLhkXs5mUIGcqSyxpsWaHW4Hux8LEmDYHrshM0BEWYQsQYkQuzqkg7KbTkGbHGrGqk4+zsTCYS8DI6FSJr+rqaG2XKUFx5Kb2ZxJVGIG3rya83QVP4BdCuUZMBgljYJT6SJUIwwzhKvsQr30fxhI/aCqX5Qjo7qyNUgv76brho17zEhV53MgVHIdHl9myYzfxFz2al+pUJnzVLaj/pjgO1DFt1W4v5TFAE3KcyFlrAoO5XJQgvEO+yxZhO+WNz/X2MqTcMqwN4LZktnXdOvkkKbhnf4M/ouj7WOQacM3Ofc0nz2fZsv0XvC3bh7ylVgR8JOMSupj6hz9k7VCpKby0g=

- the fix tactic is for defining fixpoints, see https://coq.inria.fr/distrib/current/refman/tactics.html#hevea_tactic127

- each fixpoint has a principal argument, indicated in the {struct} annotation. It will reduce only when applied such that the principal argument is a constructor (or something that reduces to a constructor). So if you do "destruct steps" or "induction steps" it should reduce once.

Gaëtan Gilbert

On 12/01/2018 22:05, Ramkumar Ramachandra wrote:
Hi folks,

This is my code:

(* stageHandler will take a given block and run it through a single stageStep *)
Definition stageHandler (s : stageStep) (blk : block) (t : serverState)
: (stageStep * serverState) :=
match s with
| propose => let blk' := blk ++ (issueVerdicts t) in
(preVote (augmentBlk blk' t), t)
| preVote blk => ((preCommit blk), t)
| preCommit blk => (propose, (commitBlock blk (updateRunningCounters blk t)))
end.

(* readEvalLoop will run for a given number of steps: in real-world, forever *)
Fixpoint readEvalLoop (steps : nat) (s : stageStep) (blk : block) (t : serverState)
: serverState :=
match steps with
| O => t
| (S n') => let (s', t') := stageHandler s blk t in readEvalLoop n' s' blk t'
end.

Theorem readEvalLoop_ind : forall steps blk t,
let blk' := augmentBlk (blk ++ issueVerdicts t) t in
readEvalLoop (steps + 3) propose blk t =
readEvalLoop steps propose blk' (commitBlock blk' (updateRunningCounters blk' t)).
Proof.
intros.
unfold readEvalLoop; unfold stageHandler.
fix readEvalLoop 1.
Abort.

If I have `steps` fixed at O, the proof completes pretty easily. However, in this case, I get:

Ltac call to "fix (ident) (natural)" failed. Ltac call to "fix (ident) (natural)" failed. Not enough products.

What does this mean, and how am I supposed to reduce `fix` terms? None of the other tactics seem to work.

Thanks.

Ram



Archive powered by MHonArc 2.6.18.

Top of Page