Skip to Content.
Sympa Menu

ssreflect - [ssreflect] Why does this rewrite fail?

Subject: Ssreflect Users Discussion List

List archive

[ssreflect] Why does this rewrite fail?


Chronological Thread 
  • From: Ian Zimmerman <>
  • To: Ssreflect Mailinglist <>
  • Subject: [ssreflect] Why does this rewrite fail?
  • Date: Wed, 23 Oct 2019 21:01:43 -0700
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
  • Ironport-phdr: 9a23:lck9+hWT8ka0AwhRf97A/m60ZBLV8LGtZVwlr6E/grcLSJyIuqrYbBOPt8tkgFKBZ4jH8fUM07OQ7/m7Hz1Yqsnc+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi4oAnLssQanYRuJ6QxxxDUvnZGZuNayH9yK1mOhRj8/MCw/JBi8yRUpf0s8tNLXLv5caolU7FWFSwqPG8p6sLlsxnDVhaP6WAHUmoKiBpIAhPK4w/8U5zsryb1rOt92C2dPc3rUbA5XCmp4ql3RBP0jioMKiU0+3/LhMNukK1boQqhpx1hzI7SfIGVL+d1cqfEcd8HWWZNQsNdWipGDY2hcosPFPIBMvhEoInhqVUOqh6+ChOtBOPp1zREgnD70Kk/3+knDArI3hEvH8gWvXrarNv7KrocX+O6w6bU0DrNYP1Z1Czh6IXLaB0tve2AUKhyfMfX1EIhFxnFjlKVqYH9PD2azOINuHWY4OphUOKvjnAoqxt0oje1wMcnl47EhoMJylHF7ih53pg6Jce4SUJhZd6kF5xQtzqEOItyQsIuWWZouDw1yrAfv5OwYSYEyJMixxHFavyHdZCF4hfkVOaWJjd0nm5qeLW6hxu07EOuyfX8W9Gp3FtIoCdJiMfAu3AN2hDJ9MSLV/tw8l2g1DuLzwze6+NJLVopmafZJJMt2KA8m5QdvEjZACP6hUf7gamLfUs+4Oeo8f7oYrD+q5+cKYB0jgb+P7wwmsOhG+Q5MhICX2yc+eS7z73s40n5QbVQgv0xiKnZv4jWJcUdpqGnHw9Yypsv5hSxAju8ztgVnXkKIEhbdB6aj4XlIVDDLfTgAfe6mVuskTNrx/7cPr3mB5XANnnDkKvgfLtm9U5T1hAzzNBF65JQDbEBJ+nzVVH1tN3YFBM5NBa0w+n/BNVnyoweQX6PArOeMK7Kql+I/fgvLPeCZI8RpjnyN+Ql6uX1jX45nF8dZbOm0YEWaHC+BPRmIl+WbWDigtcbQi82uV8FV/bnhlmPWiIbQn+zW6M66TU6E57uWZzYXI2jhLGKwA++BYcTZ2ZcC1nKEHHydozCVe1aOwyIJco0szUCHYqgTooszxSnskeuyqZ1BvTZ4DxesZXkz9Vx9qvUjx5kpm88NNiUz2zYFzI8pWgPXTJjmf0m+BEv+hK4yaF9xsdgO5lT6vdOC1doK5PG3qp+DNfpVwbQONCTRwT/G4T0MXQKVts0huQ2TQN4EtSmgArE2nP6UaEYja3NAJsz6a/Yzj72Pckvki+ahplktEEvR450DUPjnrR2rliBGYPTggOdkKGxeKANminX+zXbwA==

Hello kind Coq+ssreflect experts,

The last rewrite step in the last proof below fails, with the error
message

Ltac call to "rewrite (ssrrwargs) (ssrclauses)" failed.
The LHS of assoc
(_ _ (_ _ _))
does not match any subterm of the goal

Why is that? Superficially and to a newbie's eye, it doesn't look so
different from the other (earlier) "rewrite assoc" steps, and those work.


From mathcomp Require Import ssreflect ssrfun ssrbool.
Require Import FunctionalExtensionality.
Require Import ClassicalEpsilon.
Require Import PropExtensionality.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Require Import Utf8.


Delimit Scope G_scope with G.

Class group_binop (A:Type) := group_op: A → A → A.

Infix "*" := group_op: G_scope.

Class group_invop (A: Type) := group_inv: A → A.

Notation "x ⁻" := (group_inv x) (at level 5): G_scope.

Open Scope G_scope.

Class group (car: Type) (op: group_binop car) (I: car) (inv: group_invop car)
:= {
assoc: associative op;
unity_left_id: left_id I op;
unity_right_id: right_id I op;
inv_left_inverse: left_inverse I inv op;
inv_right_inverse: right_inverse I inv op;
}.

Section Group_def.

Variables (A: Type) (op: group_binop A) (I: A) (inv: group_invop A) (G: group
op I inv).

Lemma group_right_anni a b: a * (a ⁻ * b) = b.
Proof.
by rewrite assoc inv_right_inverse unity_left_id.
Qed.

Lemma group_left_anni a b: (a * b ⁻) * b = a.
Proof.
by rewrite -assoc inv_left_inverse unity_right_id.
Qed.

Lemma group_right_anni2 a b: a ⁻ * (a * b) = b.
Proof.
by rewrite assoc inv_left_inverse unity_left_id.
Qed.

Lemma group_left_anni2 a b: (a * b) * b ⁻ = a.
Proof.
by rewrite -assoc inv_right_inverse unity_right_id.
Qed.

Lemma group_inverse_unique_left a b: a * b = I → a ⁻ = b.
Proof.
have: a ⁻ * (a * b) = b by [apply: group_right_anni2] => A'AB ABI.
by rewrite -[in RHS] A'AB ABI -[in LHS] /a⁻ unity_right_id.
Qed.

Lemma group_inverse_unique_right a b: a * b = I → b ⁻ = a.
Proof.
have: (a * b) * b ⁻ = a by [apply: group_left_anni2] => ABB' ABI.
by rewrite -[in RHS] ABB' ABI unity_left_id.
Qed.

Lemma group_inverse_involutive a: (a ⁻)⁻ = a.
Proof.
have: a * a ⁻ = I by apply: inv_right_inverse a.
by apply: group_inverse_unique_right.
Qed.

Lemma group_inverse_unique_left2 a b: a ⁻ * b = I → a = b.
Proof.
move => A'BI; have: (a⁻)⁻ = b by [apply: group_inverse_unique_left] =>
{A'BI}.
by rewrite group_inverse_involutive.
Qed.

Lemma group_inverse_unique_right2 a b: a * b ⁻ = I → a = b.
Proof.
move => AB'I. have: (b⁻)⁻ = a by [apply: group_inverse_unique_right] =>
{AB'I}.
by rewrite group_inverse_involutive.
Qed.

Proposition group_left_cancel a x y: a * x = a * y → x = y.
Proof.
move => AxAy; have: a ⁻ * (a * x) = a ⁻ * (a * y) by [rewrite AxAy] =>
{AxAy}.
by rewrite 2! assoc inv_left_inverse 2! unity_left_id.
Qed.

Proposition group_right_cancel a x y: x * a = y * a → x = y.
Proof.
move => xAyA; have: (x * a) * a ⁻ = (y * a) * a ⁻ by [rewrite xAyA] =>
{xAyA}.
by rewrite -2! assoc inv_right_inverse 2! unity_right_id.
Qed.

Proposition group_unity_unique_right a b: a * b = a → b = I.
Proof.
move => ABA; have: a ⁻ * (a * b) = a ⁻ * a by [rewrite ABA] => {ABA}.
by rewrite assoc inv_left_inverse unity_left_id.
Qed.

Proposition group_unity_unique_left a b: a * b = b → a = I.
Proof.
move => ABB; have: (a * b) * b ⁻ = b * b ⁻ by [rewrite ABB] => {ABB}.
by rewrite -assoc inv_right_inverse unity_right_id.
Qed.

Lemma group_unity_if_idem a: a * a = a → a = I.
Proof.
by apply: group_unity_unique_right.
Qed.

Proposition group_connected a b: ∃ x y, a * x = b ∧ y * b = a.
Proof.
exists (a ⁻ * b); exists (a * b ⁻).
by split; [apply: group_right_anni | apply: group_left_anni].
Qed.

Proposition group_translate_bijective_left a: bijective (λ x, a * x).
Proof.
set f := λ x, a * x; set g := λ x, a ⁻ * x.
have: ∀ x, g x = a ⁻ * x by [] => Gx.
have: ∀ x, f x = a * x by [] => Fx.
have: ∀ x, g (f x) = a ⁻ * (a * x) by [move => x; rewrite -Fx -Gx] => GFx.
rewrite assoc in GFx. (* This doesn't work! *)
Abort.

End Group_def.

Close Scope G_scope.

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.



Archive powered by MHonArc 2.6.18.

Top of Page