How to proof a theorem in Coq?

· 12 天前 · 59 人浏览

Task

Use these 2 theorems to prove a theorem:

Keywords: pattern matching, goal, tactic, rewrite

What is goal?

goal is the theorem we want to prove in current context, like in this example

forall p : nat, p × 1 = p

intros

first, introduce a parameter p

Coq automatically match the p with variable in goal

rewrite

rewrite has 2 types: -> and <-

for first case you can consider it as expand from LHS(Left Hand Side) to RHS according to the rewrited theorem.

p * S O = p * O + p (rewrite theorem mult_n_Sm with n = p and m = O <-)
        = O + p (rewrite theorem mult_n_O with n = p <-)
        = p
formal verification Coq
Theme Jasmine by Kent Liao