Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Simplifying a function (exactly) once?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Simplifying a function (exactly) once?


Chronological Thread 
  • From: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Simplifying a function (exactly) once?
  • Date: Tue, 25 Feb 2020 18:48:33 -0600
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=agnishom AT cmi.ac.in; spf=Pass smtp.mailfrom=agnishom AT cmi.ac.in; spf=None smtp.helo=postmaster AT mail.cmi.ac.in
  • Ironport-phdr: 9a23:NnGMDRwkAwd1ZxvXCy+O+j09IxM/srCxBDY+r6Qd2+gWIJqq85mqBkHD//Il1AaPAdyHraMfwLCI+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCeybL9oKBi7owrdutcXjIB/Nqs/1xzFr2dHdOhR2W5mP0+YkQzm5se38p5j8iBQtOwk+sVdT6j0fLk2QKJBAjg+PG87+MPktR/YTQuS/XQcSXkZkgBJAwfe8h73WIr6vzbguep83CmaOtD2TawxVD+/4apnVAPkhSEaPDE+7W/Xl9dwjLpFrx29uxxxzYnUYISPO/p/eKPWYNcWSGVFU8pUUSFKH4GyYJYVD+cZMulYoYvyqVsAoxW9GAeiGv/gxyRSiXPqx6A3yfgtHR3E0QEmAtkAsG7UrNLwNKoKTe21w6/IzTTYb/NW3jf97ZXDfw4hof6WQbJwbc3RyVE1GAzYjlWRqZbqPjOI3ekKqWeb4OxgVeO0i24nrAFxpyOiydspionInI4a0EzL+T94wIYzPNC1TlNwb9CjEJtVrS6aNo12T9stQ2FppCY6yqAGtoWhcCgLz5QqwQPUZf+fc4WQ/x7vSuicLS15iX9rYr6zmQq+/Ea6xuHiS8W4zk5GojRZntTIrHwA1Bze5tKaRvZ8/0qtwzmC2x7V5+pZO047j7DbJIQkwrMolpocr0DDHijulUXzlqCWd0Ek9vK05OTiY7XqvIWTOJNuhgH/NKQigs2/AeImPQgSR2WX5Pqw2bP58UD4TrhGlOM6nrXXvZzAO8gXu7C1DxdQ0ok56ha/Czmm0M4fnXkCNF9KYh2Hj47oO1HVIPD4CvK/jk+wnzduxvDKJKfuDYnXInjClrftZax95FJEyAov0dBf4IpZBa0GIPLqQ0P+qNjYDgIiPAGv2ObmCNB91psEVm6VA6+ZNrnSsV6S6e41LemMftxdhDGoIP88ovXqkHURmFkHfKDv04FERmq/G6FPLEOYenrrh58qEW4Wog0mReDqmVSTGWpaaHCzRKI74xkwDYPgBIyFR4b70+/J5zuyApADPjMOMVuLC3q9K9TdB6U8LRmKK8okqQQqEKC7QtZ4hxqrtUnzwPxmKLiMo3xKhdfYzNFwotbru1Q3/D1wAd6a1jjUHWpxnyUBTHk32vIm+BEv+hK4yaF9xsdgO5lT6vdOC1loMJfdy6pxDtG0UwmHf9HbEFs=

Only the method with remember worked.

Sadly, the one with the simpl and the pattern did not make any difference. Neither did the one with the iota.

On Tue, Feb 25, 2020 at 3:48 PM Jason -Zhong Sheng- Hu <fdhzs2010 AT hotmail.com> wrote:
I didn't test everything but i think there are a few ways to proceed. I do think that it's a good idea for Coq to implement a tactic, say, `eval_step`, which takes a list of reduction steps and perform them in sequence. in this case, I think it would be `eval_step [delta, iota]`. notice that delta reduction is only specified once, so it only unfold the outer `eval2` and iota evals the pattern matching and leave the inner `eval2` as is.

that said, you can probably simulate this action:

unfold eval2 in H3; cbn [iota] in H3.

in particular, `delta` is excluded from `cbn` so I hope `eval2` is not unfolded.

another way is to remember `a0 :: l` by doing

remember (a0 :: l) as l0 eqn:?.

I expect this replaces all `a0 :: l` with `l0`, which allows you to do `simpl in H3`.

another potential way is to specify the list to have two cons:

simpl (eval2 _ (_ :: _ :: _)) in H3.

i would be interested in knowing which one works. please let me know.


From: coq-club-request AT inria.fr <coq-club-request AT inria.fr> on behalf of Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
Sent: February 25, 2020 4:18 PM
To: coq-club AT inria.fr <coq-club AT inria.fr>
Subject: [Coq-Club] Simplifying a function (exactly) once?
 
Is there a way to specify to simpl to stop simplifying after exactly one step?

Basically, I have something like f(f(x)) which simplifies to some _expression_ in f(x). I only wish to simply this once and NOT get rid of the inner f(x)

---

More details:

I have

Fixpoint eval2 {A: Type} (mon: Monitor A) (l : list A) : (bool * Monitor A) :=
  match l with
  | nil => (false, mon)
  | (x :: xs) => let (_, mon') := eval2 mon xs in
               (mNext mon' x)
  end.

In a certain proof, I have

E3 : eval2 (MonAnd mon1 mon2) (a0 :: l) = (bl, ml)
and
H3 : eval2 (MonAnd mon1 mon2) (a :: a0 :: l) = (true, x)

I wish to use E3 effectively after simplifying H3 by one step. However, when I try to use simpl in H3, I get

H3 : (let (_, mon') :=
          let (_, mon') := eval2 (MonAnd mon1 mon2) l in mNext mon' a0 in
        mNext mon' a) = (true, x)



Archive powered by MHonArc 2.6.18.

Top of Page