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