Skip to Content.
Sympa Menu

ssreflect - Re: [ssreflect] Rewriting with inequalities?

Subject: Ssreflect Users Discussion List

List archive

Re: [ssreflect] Rewriting with inequalities?


Chronological Thread 
  • From: Christian Doczkal <>
  • To:
  • Subject: Re: [ssreflect] Rewriting with inequalities?
  • Date: Thu, 18 Feb 2016 14:02:26 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:SE2ncBabbhjph9+E7qbyjFX/LSx+4OfEezUN459isYplN5qZpcmybnLW6fgltlLVR4KTs6sC0LqJ9fywEjdQqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7/0p82YOFUArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Kr8jV7FWCDktL0gw/9eutB/ZTALJ530GU2xQnAAbLRLC6UTRXo3wqTf7v+w19C6RL87/SfhgVTOp/aRiTDfwk2EaMT9862jekMh5iq4drB/39E83+JLdfIzAbKk2RajaZ95PHWc=


> Could you expand on what you have in mind? Do you mean that one should
> introduce a synonym for "m <= n"? Would this approach be essentially
> equivalent to 1- replacing "m <= n" with "le m n" everywhere; 2- using
> setoid rewrite on the relation le; 3- performing step 1- in reverse?

This is one way to do it. I was just toying around with your example and
here is what I ended up with:

Require Import Coq.Program.Basics. (* [flip] *)
Require Export Coq.Setoids.Setoid. (* required for [rewrite] *)
Require Export Coq.Classes.Morphisms.
Require Import Omega.

From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat.

Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.

Definition le n m := is_true (n <= m).

Instance le_preOrder : PreOrder le.
Proof. split. exact: leqnn. move => ? ? ?. exact: leq_trans. Qed.

Instance proper_addn: Proper (le ++> le ++> le) addn.
Proof. move => x y ? n m ?. exact: leq_add. Qed.

Instance: Coq.Classes.RelationClasses.RewriteRelation le.

Goal
forall x y,
x <= y ->
x + 1 <= y + 1.
Proof.
move => x y h. rewrite -!/(le _ _) in h *.
rewrite h.
reflexivity.
Qed.





Archive powered by MHonArc 2.6.18.

Top of Page