Software Foundations
Working Software Foundations
Useful functions:
Things which aren't in the book and learned from seeing other's code.
rewrite
like this:rewrite <- plus_comm with (n := n' * m) (m := m + m) at 1.
See different styles here.
Theorem f_equal : forall (A B : Type) (f: A -> B) (x y: A),
x = y -> f x = f y.
Current goals:
H : ....
============================
S n = S m'
apply f_equal.
Current goals:
H : ....
============================
n = m'
n' : nat
IHn' : forall m : nat, n' + n' = m + m -> n' = m
m' : nat
H1 : n' + n' = m' + m'
============================
S n' = S m'
apply IHn' with (m := m') in H1.
n' : nat
IHn' : forall m : nat, n' + n' = m + m -> n' = m
m' : nat
H1 : n' = m
============================
S n' = S m'
H : P \/ Q
=============
S n' = S m'
destruct H as [H1 | H2].
H1 : P
========
S n' = S m'
H2 : exists x : A, f x = y /\ In x l'
============================
exists x : A, f x = y /\ (x' = x \/ In x l')
destruct H2
x : A
H : f x = y /\ In x l'
============================
exists x0 : A, f x0 = y /\ (x' = x0 \/ In x0 l')
H : f x = y /\ In x l
============================
In y (map f l)
destruct H as [H1 H2].
H1 : f x = y
H2 : In x l
============================
In y (map f l)
References: