PG icon indicating copy to clipboard operation
PG copied to clipboard

Incorrect indentation for Coq code

Open RalfJung opened this issue 4 years ago • 1 comments

In the following code, PG for some reason insists on indenting the Lemma by two spaces:

Definition dyn_reservation_map_valid_eq :
  valid = λ x, match dyn_reservation_map_token_proj x with
               | CoPset E =>
                 ✓ (dyn_reservation_map_data_proj x) ∧ set_infinite (⊤ ∖ E) ∧
                 (* dom (dyn_reservation_map_data_proj x) ⊥ E *)
                 ∀ i, dyn_reservation_map_data_proj x !! i = None ∨ i ∉ E
               | CoPsetBot => False
               end := eq_refl _.
Definition dyn_reservation_map_validN_eq :
  validN = λ n x, match dyn_reservation_map_token_proj x with
                  | CoPset E =>
                    ✓{n} (dyn_reservation_map_data_proj x) ∧ set_infinite (⊤ ∖ E) ∧
                    (* dom (dyn_reservation_map_data_proj x) ⊥ E *)
                    ∀ i, dyn_reservation_map_data_proj x !! i = None ∨ i ∉ E
                  | CoPsetBot => False
                  end := eq_refl _.

  Lemma dyn_reservation_map_included x y :
    x ≼ y ↔
      dyn_reservation_map_data_proj x ≼ dyn_reservation_map_data_proj y ∧
    dyn_reservation_map_token_proj x ≼ dyn_reservation_map_token_proj y.
  Proof.
    split; [intros [[z1 z2] Hz]; split; [exists z1|exists z2]; apply Hz|].
    intros [[z1 Hz1] [z2 Hz2]]; exists (DynReservationMap z1 z2); split; auto.
  Qed.

That does not seem right, this lemma is not nested in anything so it should not be indented.

RalfJung avatar Mar 08 '21 18:03 RalfJung

Hi, indeed this is a bug of the detection of "goal openers" of coq. I'll try to fix this scary pieace of code but meanwhile there is a workaround: put the (match... end) inside parenthesis.

Matafou avatar Mar 10 '21 21:03 Matafou