Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Definition half (x : {x : nat | even x }) : nat := let n := (proj1_sig x) in
  2. Nat.div n 2.
  3.  
  4. Definition Nonempty {A} (l : list A) := match l with cons _ _ => True | nil => False end.
  5.  
  6.  
  7. Definition notempty A (l: list A) : Prop := forall (P : list A -> Prop),
  8. (forall (y : list A), forall (c: A) ,P(cons y c)) -> P l.
  9.  
  10. Definition mylist := (cons (cons (cons nil 3) 2) 1).
  11.  
  12. Theorem mylistnotempty : notempty nat (mylist).
  13. Proof.
  14. unfold notempty.
  15. intro.
  16. intro.
  17. apply H.
  18. Qed.
  19.  
  20. Definition back (A : Set) (nel : {x: (list A) | (notempty A x) }) : list A := let l := proj1_sig nel in
  21. match l with
  22. | cons tail head => tail
  23. | nil => match (proj2_sig nel) Nonempty (fun _ _ => I) with end
  24. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement