Debian Codegraph @

test-suite/output/Error_msg_diffs.v

raw
1 (* coq-prog-args: ("-color" "on" "-diffs" "on" "-async-proofs" "off") *)
2 (* Re: -async-proofs off, see https://github.com/rocq-prover/rocq/issues/9671 *)
3 (* Shows diffs in an error message for an "Unable to unify" error *)
4 Require Import ListDef.
5
6 Inductive btree (T : Type) : Type :=
7 Leaf | Node (val : T) (t1 t2 : btree T).
8
9 Arguments Leaf {T}.
10 Arguments Node {T}.
11
12 Fixpoint rev_tree {T : Type} (t : btree T) : btree T :=
13 match t with
14 | Leaf => Leaf
15 | Node x t1 t2 => Node x (rev_tree t2) (rev_tree t1)
16 end.
17
18 Fixpoint count {T : Type} (p : T -> bool) (t : btree T) : nat :=
19 match t with
20 | Leaf => 0
21 | Node x t1 t2 =>
22 (if p x then 1 else 0) + (count p t1 + count p t2)
23 end.
24
25 Axiom add_comm : forall x y, x + y = y + x.
26
27 Lemma count_rev_tree {T} (p : T -> bool) t : count p (rev_tree t) = count p t.
28 Proof.
29 induction t as [ | a t1 IH1 t2 IH2].
30 easy.
31 simpl.
32 rewrite IH1.
33 rewrite IH2.
34 Fail reflexivity.
35 rewrite (add_comm (count p t2)).
36 easy.
37 Qed.