Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Difference between dot and semicolon in a proof

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Difference between dot and semicolon in a proof


Chronological Thread 
  • From: Benjamin Werner <benjamin.werner AT inria.fr>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Difference between dot and semicolon in a proof
  • Date: Mon, 18 Jul 2016 09:45:26 +0200

There is a difference between dot and semicolon when the application of a tactic produces more than one subgoal.

Then, the tactic(s) appearing after the semicolon is applied to all the subgoals. When the tactic
is after a dot, it is only applied to the first goal.

You can make your proof a « oneliner » (ie. get rid of all dots) by using semicolon and the
bracket notation: 
    tac; [tac1 | tacB | tacC] 
applies tac, and then tacA to the first produced subgoal (produced by tac), tacB to the second, etc


Benjamin



Le 18 juil. 2016 à 03:45, mukesh tiwari <mukeshtiwari.iiitm AT gmail.com> a écrit :

Hi Everyone,
Pardon me if this is stupid question, but I am trying to understand the difference between dot (.) and semicolon (;) in Coq. My understanding is that we can interchange the dot and semicolon in Coq file. If you add dot after each tactic then you see the intermediate steps/calculation after applying the tactic to goal, and if you don't want to see the intermediate steps then use semicolon to combine multiple tactics.

Currently I am trying to go though the coq-graph [1] code.

 
  
Lemma Union_dec :
     forall (e1 e2 : U_set) (x : U),
       {e1 x} + {~ e1 x} -> {e2 x} + {~ e2 x} -> Union e1 e2 x -> {e1 x} + {e2 x}.
   Proof.
     intros; case H.
     left; trivial.

     intros; case H0; intros.
     right; trivial.

     absurd (Union e1 e2 x). apply Not_union; trivial.
     trivial.

   Qed.

If I replace all the semicolons by dots then It is not provable by following the same tactics.

Lemma Union_dec :
     forall (e1 e2 : U_set) (x : U),
       {e1 x} + {~ e1 x} -> {e2 x} + {~ e2 x} -> Union e1 e2 x -> {e1 x} + {e2 x}.
   Proof.
     intros. case H.
     left. trivial.

     intros. case H0. intros.
     right. trivial.

     absurd (Union e1 e2 x). apply Not_union. trivial.
     trivial.

and goal is
  
  U : Set
  e1, e2 : U_set
  x : U
  H : {e1 x} + {~ e1 x}
  H0 : {e2 x} + {~ e2 x}
  H1 : Union e1 e2 x
  n : ~ e1 x
  ============================
   ~ e2 x

subgoal 2 (ID 51) is:
 Union e1 e2 x


Regards,
Mukesh Tiwari

[1] https://github.com/coq-contribs/graph-basics/blob/master/Sets.v




Archive powered by MHonArc 2.6.18.

Top of Page