Debian Codegraph @

test-suite/success/change_pattern.v

raw
1 Set Implicit Arguments.
2 Unset Strict Implicit.
3
4 Axiom vector : Type -> nat -> Type.
5
6 Record KleeneStore i j a := kleeneStore
7 { dim : nat
8 ; peek : vector j dim -> a
9 ; pos : vector i dim
10 }.
11
12 Definition KSmap i j a b (f : a -> b) (s : KleeneStore i j a) : KleeneStore i j b :=
13 kleeneStore (fun v => f (peek v)) (pos s).
14
15 Record KleeneCoalg (i o : Type -> Type) := kleeneCoalg
16 { coalg :> forall a b, (o a) -> KleeneStore (i a) (i b) (o b) }.
17
18 Axiom free_b_dim : forall i o (k : KleeneCoalg i o) a b b' (x : o a), dim (coalg k b x) = dim (coalg k b' x).
19 Axiom t : Type -> Type.
20 Axiom traverse : KleeneCoalg (fun x => x) t.
21
22 Definition size a (x:t a) : nat := dim (traverse a a x).
23
24 Lemma iso1_iso2_2 a (y : {x : t unit & vector a (size x)}) : False.
25 Proof.
26 destruct y.
27 pose (X := KSmap (traverse a unit) (traverse unit a x)).
28 set (e :=(eq_sym (free_b_dim traverse (a:=unit) a unit x))).
29 clearbody e.
30 (** The pattern generated by change must have holes where there were implicit
31 arguments in the original user-provided term. This particular example fails
32 if this is not the case because the inferred argument does not coincide with
33 the one in the considered term. *)
34 progress (change (dim (traverse unit a x)) with (dim X) in e).
35 Abort.