Built with Alectryon, running Coq+SerAPI v8.19.0+0.19.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
induction1; econstructor; eauto.Qed.Fixpointsum (l : list nat) : nat :=
match l with
| [] => 0
| x :: l' => x + sum l'
end.
l1, l2: list nat
perm l1 l2 -> sum l1 = sum l2
l1, l2: list nat
perm l1 l2 -> sum l1 = sum l2
induction1; simpl; lia.Qed.Fixpointreverse {A} (l : list A) : list A :=
match l with
| [] => []
| x :: l' => reverse l' ++ [x]
end.
A: Type x: A l1, l2: list A
perm l1 l2 -> perm (x :: l1) (x :: l2)
A: Type x: A l1, l2: list A
perm l1 l2 -> perm (x :: l1) (x :: l2)
induction1; eauto using perm_skip, perm_swap, perm_nil, perm_trans.Qed.
A: Type x: A l: list A
perm (x :: l) (l ++ [x])
A: Type x: A l: list A
perm (x :: l) (l ++ [x])
induction l; simpl; eauto using perm_skip, perm_swap, perm_nil, perm_trans.Qed.
A: Type l: list A
perm l (reverse l)
A: Type l: list A
perm l (reverse l)
A: Type
perm [] []
A: Type a: A l: list A IHl: perm l (reverse l)
perm (a :: l) (reverse l ++ [a])
A: Type
perm [] []
constructor.
A: Type a: A l: list A IHl: perm l (reverse l)
perm (a :: l) (reverse l ++ [a])
A: Type a: A l: list A IHl: perm l (reverse l)
perm (a :: l) ?l2
A: Type a: A l: list A IHl: perm l (reverse l)
perm ?l2 (reverse l ++ [a])
A: Type a: A l: list A IHl: perm l (reverse l)
perm (a :: l) ?l2
A: Type a: A l: list A IHl: perm l (reverse l)
perm l ?l2
eauto.
A: Type a: A l: list A IHl: perm l (reverse l)
perm (a :: reverse l) (reverse l ++ [a])
eapply perm_swaplast.Qed.
l: list nat
sum (reverse l) = sum l
l: list nat
sum (reverse l) = sum l
l: list nat
perm (reverse l) l
l: list nat
perm l (reverse l)
apply reverse_perm.Qed.(* Now we do the same using setoids *)Import Coq.Setoids.Setoid Morphisms.
A: Type
Equivalence perm
A: Type
Equivalence perm
A: Type
Reflexive perm
A: Type
Symmetric perm
A: Type
Transitive perm
A: Type
Reflexive perm
A: Type x: list A
perm x x
apply perm_refl.
A: Type
Symmetric perm
A: Type x, y: list A
perm x y -> perm y x
apply perm_sym.
A: Type
Transitive perm
A: Type x, y, z: list A
perm x y -> perm y z -> perm x z
apply perm_trans.Qed.
Proper (perm ==> eq) sum
Proper (perm ==> eq) sum
l1, l2: list nat H: perm l1 l2
sum l1 = sum l2
l1, l2: list nat H: perm l1 l2
perm l1 l2
eauto.Qed.
l: list nat
sum (reverse l) = sum l
l: list nat
sum (reverse l) = sum l
l: list nat
sum l = sum l
reflexivity.Qed.
A: Type
Proper (perm ==> perm) reverse
A: Type
Proper (perm ==> perm) reverse
A: Type l1, l2: list A H: perm l1 l2
perm (reverse l1) (reverse l2)
A: Type l1, l2: list A H: perm l1 l2
perm l1 l2
auto.Qed.
respectful =
letU := Typeinfun (AB : U) (R : relation A) (R' : relation B)
(fg : A -> B) =>
forallxy : A, R x y -> R' (f x) (g y)
: forallAB : Type,
relation A -> relation B -> relation (A -> B)
Arguments respectful {A B}%type_scope
(R R')%signature_scope _ _
Proper =
letU := Typeinfun (A : U) (R : relation A) (m : A) => R m m
: forallA : Type, relation A -> A -> PropArguments Proper {A}%type_scope R%signature_scope m