Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] proof about applying a function on each element of a list using automaton

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] proof about applying a function on each element of a list using automaton


Chronological Thread 
  • From: Jason -Zhong Sheng- Hu <fdhzs2010 AT hotmail.com>
  • To: Fritjof Bornebusch <fritjof.bornebusch AT dfki.de>
  • Cc: Fritjof Bornebusch <fritjof AT uni-bremen.de>, "coq-club AT inria.fr" <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] proof about applying a function on each element of a list using automaton
  • Date: Mon, 1 Oct 2018 14:30:21 +0000
  • Accept-language: en-CA, en-US
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=fdhzs2010 AT hotmail.com; spf=Pass smtp.mailfrom=fdhzs2010 AT hotmail.com; spf=Pass smtp.helo=postmaster AT NAM02-CY1-obe.outbound.protection.outlook.com
  • Ironport-phdr: 9a23:JjQ4ERPnv0CPEiYozYwl6mtUPXoX/o7sNwtQ0KIMzox0IvT4rarrMEGX3/hxlliBBdydt6obzbKO+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxlKiTanfb9+MAi9oBnMuMURnYZsMLs6xAHTontPdeRWxGdoKkyWkh3h+Mq+/4Nt/jpJtf45+MFOTav1f6IjTbxFFzsmKHw65NfqtRbYUwSC4GYXX3gMnRpJBwjF6wz6Xov0vyDnuOdxxDWWMMvrRr0vRz+s87lkRwPpiCcfNj427mfXitBrjKlGpB6tvgFzz5LIbI2QMvd1Y6HTcs4ARWdZXshfSTFPAp+yYYUMAeoOP/pXoIbmqlQUsReyGROhCP/zxjNWgHL9wK000/4mEQHDxAEuG8gBsG/TrNXzKaweSOO6zKnPzTXFYPNdxCrz6IjWfRAnrvGARK97f8jMyUIyEA7FgEifqYzkPjOOyOgBr3WX4/Z7WOKvjG4ntwRxrSKuxscokIXGmoUVylXd+Ch/3Y07JsW4RVZ0bNK4Cpddsz+WO5F5T884QWxluj42yrMYtpO4YCQHzZEqyATbZvCZaIeF5w/vWeSKLjd2gX9oe6ywiA23/EWh0eL8WNK73VBXpSRfiNbMrGoC1xnL58iHVPR9+kCh1C6X2Q3P7e9IPV44mbPFJpEj37I8j50Tvl/dESPsn0X2kbOWeV4j+ui17eTof6/qpoeGN49zlgHxLLghmtC+AeQ/NAgCRW+b+fmg1L3n+k35R7ZKgucqnanetZDWPcUbpqinDA9Jyosu5AqzAy2i3dgGh3UKI0hJdRCFgoTxPlHBOvH4DfOxg1S2lzdrwujLPrP8DZXNL3nDi6ntcapg50JA0wczzddf545RCr4bIfLzXlX9u8DfDh88KwC02froCM1h1oMCXmKCGrOWMKTLsVOR+u0vJ/SMa5QOtTbmK/kl4ubugmUjlV8ce6mpx5oXZ2qiEvRoOUXKKUbr1/kbEHsIuQR2ZuvwjlCITCVYZz7mUbg9+jM8BsSsCp3FS4qwm7eB9Cu1HZwQam0QWX6WFnK9VYyfXPFELRCSJclu2gcEWL6uDscByFn6ugP62aE9drOM0i0fqZfq1dwz7OrWw0JhvQdoBtiQhjneB1p/mXkFEnpvhPgm8B5Nj2yb2K09uMR2UNla5vdHSAA/bMWOz+tmDtnzXkTKedLbEQ/6EOXjOik4S5cK+/FLe1x0Qo7wjhff2iOrB/kekLnZXMVpoJKZ5GD4IoNG81iD1KQliAV5EO1mEDX8w4VOrk3UDYOPlFiFnaG3c6haxDTK6GqI0WuJugdfTRJ0VqLGG3sYYxmPoA==

> if a predicate "p" holds for "f s i" than it also holds for every element in "mealy f s l".

This is not true in general though. Your function is effectively a scan operation over a state monad. What I suggested is a closer thing to what you probably want and is provable.

Other way is to define an inductive definition which captures relation between `s` `f` `l` and `mealy f s l`. But this sounds like an overshoot for this problem.

Sincerely Yours,

Jason Hu

From: Fritjof Bornebusch <fritjof.bornebusch AT dfki.de>
Sent: October 1, 2018 6:49 AM
To: Jason -Zhong Sheng- Hu
Cc: Fritjof Bornebusch; coq-club AT inria.fr
Subject: Re: [Coq-Club] proof about applying a function on each element of a list using automaton
 
On Thu, Sep 27, 2018 at 03:19:27PM +0000, Jason -Zhong Sheng- Hu wrote:
> Hi Fritjof,
>

hi,
 
> What about the following?
>
> Goal forall (S I O : Type) (f : S -> I -> S * O) s l,
>   Forall2 (fun i o => exists s' s'', f s' i = (s'', o)) l (mealy f s l).
>
> it says, virtually, for all pairs of `i` and `o`, they are connected by `f`. But it does not say `f` is actually used.
>

thank you for your reply. I though a little bit like this:
if a predicate "p" holds for "f s i" than it also holds for every element in "mealy f s l".
but I don't know how I can write this in coq.

> Sincerely Yours,
>
> Jason Hu

--f.

> ________________________________
> From: coq-club-request AT inria.fr <coq-club-request AT inria.fr> on behalf of Fritjof Bornebusch <fritjof AT uni-bremen.de>
> Sent: September 27, 2018 10:45 AM
> To: coq-club AT inria.fr
> Subject: [Coq-Club] proof about applying a function on each element of a list using automaton
>
> Hi,
>
> I'm struggeling a bit with the following proof:
> I have an automaton (mealy machine) and I want to show that a given function (f) to this
> machine is applied to all elements of a given list (l).
>
> The mealy machine is defined as:
> Fixpoint mealy {S I O:Type} (f: S -> I -> (S*O)) (s: S) (l: list(I)) : list(O) :=
>     match l with
>     | [] => nil
>     | i::is => match f s i with
>                | (s', o) => o :: (mealy f s' is)
>                end
>     end.
>
> How can I formulate this in Coq?
>
> Regards,
> --f.



Archive powered by MHonArc 2.6.18.

Top of Page