如何通过精益归纳简化证明?

时间:2019-04-28 23:03:54

标签: theorem-proving lean

我想通过精益归纳简化证明。

我在Lean中定义了一个具有3个构造函数的归纳类型,并在此类型上建立了二进制关系。我之所以包含了这些公理,是因为精益不允许我将它们作为rel的构造函数。


inductive Fintype : Type
| a : Fintype
| b : Fintype
| c : Fintype

inductive rel : Fintype → Fintype →  Prop 
| r1 : rel Fintype.a Fintype.b
| r2 : ∀ p : Prop, (p → rel Fintype.a Fintype.c )
| r3 : ∀ p : Prop, (¬ p → rel Fintype.c Fintype.b) 


axiom asymmetry_for_Fintype : ∀ x y : Fintype, rel x y → ¬ rel y x
axiom trivial1 : ¬ rel Fintype.c Fintype.a
axiom trivial2 : ¬ rel Fintype.b Fintype.c
axiom trivial3 : ∀ p : Prop, rel Fintype.a Fintype.c → p 
axiom trivial4 : ∀ p : Prop, rel Fintype.c Fintype.b → ¬ p

一个目标是证明以下定理:

def nw_o_2 (X : Type) (binrel : X → X → Prop) (x y : X) : Prop := ¬ binrel y x
def pw_o_2 (X : Type) (binrel : X → X → Prop )(x y : X) : Prop := ∀ z : X, (binrel z x → binrel z y) ∧ (binrel y z → binrel x z)

theorem simple17: ∀ x y : Fintype, nw_o_2 Fintype rel x y → pw_o_2 Fintype rel x y :=

我通过对x,y和z的归纳证明了这一点; “ z”来自上面pw_o_2的定义。但是证明很长(〜136行)。还有另一种方式可以缩短证明时间吗?

1 个答案:

答案 0 :(得分:1)

请注意,您的前两个公理实际上是定理,可以通过空模式匹配来证明。 (假定归纳类型的构造函数是排斥性的。)这些行末尾的句点表示声明已结束,没有任何主体。在内部,精益是基于rel Fintype.c Fintype.a的证明,并表明每种情况在结构上都是不可能的。

lemma trivial1 : ¬ rel Fintype.c Fintype.a.
lemma trivial2 : ¬ rel Fintype.b Fintype.c. 

您的后两个公理不一致,这使您的定理证明简单而有趣。

theorem simple17: ∀ x y : Fintype, nw_o_2 Fintype rel x y → pw_o_2 Fintype rel x y :=
false.elim (trivial3 _ (rel.r2 _ trivial))

我不确定您是否按照您的意图定义了rel。第二个和第三个构造函数分别等效于rel Fintype.a Fintype.crel Fintype.c Fintype.b

lemma rel_a_c : rel Fintype.a Fintype.c :=
rel.r2 true trivial

lemma rel_c_b : rel Fintype.c Fintype.b :=
rel.r3 false not_false