在作者B. Pierce的「類型和編程語言」一書中,作者引入了一種小語言來介紹本書中使用的不同概念。coq中的標準形式的定義
語言是:
t::=
true
false
if t then t else t
v::=
true
false
有三個減速規則:
if true then t2 else t3 \rightarrow t2
if false then t2 else t3 \rightarrow t3
t1 \rightarrow t1'
------------------
if t1 then t2 else t3 \rightarrow if t1' then t2 else t3
我想證明,每個範式是一種價值。
我用下面的定義爲範式:
Definition normal_form (t:term) :=
~(exists t', step t t').
我堅持,因爲在一個點上,我有東西,看起來像:
~ ~(exists t : term, ...)
和我不噸看我怎麼能推斷
exists t : term, ...
因爲我們在一個在tuitionistic邏輯。
這裏是整個證明:
Inductive term : Set :=
| true : term
| false : term
| ifthenelse : term -> term -> term -> term.
Definition normal_form (t:term) :=
~(exists t', step t t').
Inductive is_value : term -> Prop :=
| vtrue : is_value true
| vfalse : is_value false.
Lemma normal_form_implies_value : forall t, normal_form t -> is_value t.
Proof.
intro.
induction t.
intros.
apply vtrue.
intros.
apply vfalse.
intros.
unfold normal_form in H.
destruct t1.
unfold not in H.
assert (exists t' : term, step(ifthenelse true t2 t3) t').
exists t2.
apply eiftrue.
apply H in H0.
contradiction.
assert (exists t' : term, step(ifthenelse false t2 t3) t').
exists t3.
apply eiffalse.
apply H in H0.
contradiction.
assert(~(is_value (ifthenelse t1_1 t1_2 t1_3))).
intro.
inversion H0.
assert(~(normal_form(ifthenelse t1_1 t1_2 t1_3))).
intro.
apply IHt1 in H1.
contradiction.
unfold normal_form in H1.
unfold not in H1.
我應該使用其他定義的正常形態?沒有任何經典公理就可以完成證明嗎?
您沒有包含步驟的定義。 – gallais