File: unification_delta.v

package info (click to toggle)
coq 8.20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 44,116 kB
  • sloc: ml: 234,160; sh: 4,301; python: 3,270; ansic: 2,644; makefile: 882; lisp: 172; javascript: 63; xml: 24; sed: 2
file content (47 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Require Import Coq.Classes.Equivalence.
Require Import Coq.Program.Program.
Import Relation_Definitions.
Import Morphisms.
Require Setoid.

Obligation Tactic := program_simpl ; simpl_relation.
Generalizable Variables A eqA.

Lemma bla : forall `{ ! @Equivalence A (eqA : relation A) } x y, eqA x y -> eqA y x.
Proof.
  intros.
  rewrite H0.
  reflexivity.
Defined.

Lemma bla' : forall `{ ! @Equivalence A (eqA : relation A) } x y, eqA x y -> eqA y x.
Proof.
  intros.
  (* Need delta on [relation] to unify with the right lemmas. *)
  rewrite <- H0.
  reflexivity.
Qed.

Axiom euclid : nat -> { x : nat | x > 0 } -> nat.

Definition eq_proj {A} {s : A -> Prop} : relation (sig s) :=
  fun x y => `x = `y.

#[export] Program Instance foo {A : Type} {s : A -> Prop} : @Equivalence (sig s) eq_proj.

Next Obligation.
Proof.
  cbv in *;congruence.
Qed.

#[export] Instance bar : Proper (eq ==> eq_proj ==> eq) euclid.
Proof.
Admitted.

Goal forall (x : nat) (y : nat | y > 0) (z : nat | z > 0), eq_proj y z -> euclid x y = euclid x z.
Proof.
  intros.
  (* Breaks if too much delta in unification *)
  rewrite H.
  reflexivity.
Qed.