2014-08-25 02:58:48 +00:00
|
|
|
import logic
|
2014-09-03 23:00:38 +00:00
|
|
|
open tactic
|
2014-07-05 22:52:40 +00:00
|
|
|
|
|
|
|
inductive list (A : Type) : Type :=
|
2015-02-26 01:00:10 +00:00
|
|
|
| nil {} : list A
|
|
|
|
| cons : A → list A → list A
|
2014-09-04 23:36:06 +00:00
|
|
|
namespace list end list open list
|
|
|
|
open eq
|
2014-07-05 22:52:40 +00:00
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
definition is_nil {A : Type} (l : list A) : Prop
|
2014-09-04 22:03:59 +00:00
|
|
|
:= list.rec true (fun h t r, false) l
|
2014-07-05 22:52:40 +00:00
|
|
|
|
|
|
|
theorem is_nil_nil (A : Type) : is_nil (@nil A)
|
2014-12-12 21:50:53 +00:00
|
|
|
:= of_eq_true (refl true)
|
2014-07-05 22:52:40 +00:00
|
|
|
|
|
|
|
theorem cons_ne_nil {A : Type} (a : A) (l : list A) : ¬ cons a l = nil
|
2014-12-15 20:05:44 +00:00
|
|
|
:= not.intro (assume H : cons a l = nil,
|
2014-07-05 22:52:40 +00:00
|
|
|
absurd
|
|
|
|
(calc true = is_nil (@nil A) : refl _
|
|
|
|
... = is_nil (cons a l) : { symm H }
|
|
|
|
... = false : refl _)
|
|
|
|
true_ne_false)
|
|
|
|
|
2014-07-22 16:43:18 +00:00
|
|
|
theorem T : is_nil (@nil Prop)
|
2014-07-05 22:52:40 +00:00
|
|
|
:= by apply is_nil_nil
|