Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Access return values in theorem

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Access return values in theorem


Chronological Thread 
  • From: fritjof AT uni-bremen.de
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Access return values in theorem
  • Date: Tue, 4 Aug 2020 17:53:18 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=fritjof AT uni-bremen.de; spf=Pass smtp.mailfrom=fritjof AT uni-bremen.de; spf=None smtp.helo=postmaster AT gabriel-vm-2.zfn.uni-bremen.de
  • Ironport-phdr: 9a23:Rzxu5BezDLOG3xzh9joNTxA8lGMj4u6mDksu8pMizoh2WeGdxcS6ZB7h7PlgxGXEQZ/co6odzbaP7ea/BydRvN6oizMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9vLRi6twfcu8gZjYZmKqs61wfErGZPd+lK321jOEidnwz75se+/Z5j9zpftvc8/MNeUqv0Yro1Q6VAADspL2466svrtQLeTQSU/XsTTn8WkhtTDAfb6hzxQ4r8vTH7tup53ymaINH2QLUpUjms86tnVBnlgzoBOjUk8m/Yl9ZwgbpVrhyhuRJx3o3aYI+aO/ViY6zTctEVSHFdXstSTSFNHp+wY5cNAucHIO1Wr5P9p1wLrRamCwmsHuLvyiNKhn/x0603yPkhEQfH3AA5BN0OqmrbrNDrO6cUS+y60bfHwDPeZPxZxTnz8pLHcgw9of6SR7Jwd9LcxEoxGw3KkFmdtY3oMjOL2+kNvGaX8+RuWfyzhmAnpAx8piaiy8MwhoTKmo4YyF7K+CF3zYorK9C1VU92bNygHZZWqiqUNJN2T9s/T2xmtys20KAKtYKlcCQQyJkr2wTTZ+GFfoSQ/x7uWumcLS1liH55Zr6znQi+/VWjx+HmSMW4zUpGoyxYmdfWrH8NzQbc6s2fR/t94Eih3TGP2hjc6u5eOk80j6vbJIAlwrIpiJoTtF3PEjHslET3gq+WcF8o+vWu6+Tme7npvYWcOJFxig7gNKQigNGwDvogPggPWWiU5/i82aX+8UD3T7hGlOA6nrXHvJzAJckXurS1DxJX34o77hawFTam0NAWnXkdK1JFfQqKj4bzO1HPPPD4D/C/g1q3nTd2wfDGP6TtDY7XLnfdlbfuY7B951RBxwUt1dxf/Y5bCqkdIPLvXU/8rMDXDhggMwCt3+nnDMh92ZgFVGKUAq6ZNbvSvkWS6uIuJemMfo4VtyznJ/gr/f69xUM+zFQaZOyi2YYdQHG+BPVvZUuDMlT2hdJUH30Logg5QsT3jlzHWyReYnu0Ga4xtWJzM56vEYqWHtPlu7eGxiruRsQKNFADMUiFFDLTT6vBQ+0FMX/AP8lg1zYeWL2sTckt2EP27VKo+/9cNuPRvxYgm9fj2dxyvLeBmhg47z15C4GD1iTXCXN6mCUVQT5z1rpypEF7jFuOg/Ah0q5oUOdL7vYMaT8UcJvVzuh0Edf3A1+TY9GIDVy8T9CrB3c9Q4Bozg==

On Tue, Aug 04, 2020 at 05:24:19PM +0200, Castéran Pierre wrote:
> Hi,
>

Hi,

> I’m not sure I understand well what you mean.
>
> First, It, would be better to include in your mail the declarations and
> definitions you want to use.
>

thank you for your answer. No problem:

Inductive trafficLightCar:=
| carRed
| carYellow
| carGreen
| carRedYellow.

Inductive trafficLightWalker:=
| walkerRed
| walkerGreen.

Inductive trafficLightTram:=
| tramRed
| tramGreen.


Inductive state :=
| State : trafficLightCar -> trafficLightWalker -> trafficLightTram ->
state.


Definition fsm (s : state) : state :=
match s with
| State carRed walkerRed tramRed => State carRed walkerRed tramGreen
| State carRed walkerRed tramGreen => State carRedYellow walkerRed
tramRed
| State carRedYellow walkerRed tramRed => State carGreen walkerRed
tramRed
| State carGreen walkerRed tramRed => State carYellow walkerRed tramRed
| State carYellow walkerRed tramRed => State carRed walkerGreen tramRed
| State _ _ _ => State carRed walkerRed tramRed
end.

> Do you agree with the following ones ?
>
> Variables a b: Type.
> Variable green: a.
> Inductive state :=
> | State : a -> b -> state.
>
> Variable fsm : state -> state.
>
> Now, if s is any state, you can decompose it with a match.
> Since fsm is a function, (fsm s) is a single value, the first component of
> which is (or not) green.
> So I don’t understand the need for an existential quantifier.
>
> What do you think about the following statement ? Is it what you meant ?
>
> Theorem foo:
> forall (s : state),
> match fsm s with (State a' b') => a' = green end.
>

Hmm, this would indicate that for all a' the result is green right?
But, I didn't know that "match" could be used in a theorem.

I'm thinking more about formulating a liveness property.

> Now, if fsm is a binary relation, instead of a function, then my answer
> would have been different.
>
> Best regards,
>
> Pierre
>
>

Best regards,
--f.

> > Le 4 août 2020 à 16:51, fritjof AT uni-bremen.de a écrit :
> >
> > Hi,
> >
> > I have the following definition fsm : state -> state.
> >
> > The state is defined as
> > Inductive state :=
> > | State : a -> b -> state
> >
> > I want to show something like:
> > Theorem foo:
> > forall s : state,
> > State a' b' = fsm s -> (exists a', a' = green).
> >
> >
> > In a more informal way:
> > I want to show that there is a state. returned by *fsm s* where
> > a' is green.
> >
> > The answer from Coq is: The reference a' was not found in the current
> > environment.
> >
> > Does someone has a solution for that?
> >
> > Regards,
> > --f.
>



Archive powered by MHonArc 2.6.19+.

Top of Page