2014-08-01 00:48:51 +00:00
|
|
|
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
-- Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
-- Authors: Leonardo de Moura, Jeremy Avigad
|
|
|
|
|
2014-10-05 17:50:13 +00:00
|
|
|
import logic.connectives
|
2014-08-01 00:48:51 +00:00
|
|
|
|
2014-10-08 01:02:15 +00:00
|
|
|
inductive inhabited [class] (A : Type) : Type :=
|
2014-09-04 23:36:06 +00:00
|
|
|
mk : A → inhabited A
|
2014-08-01 00:48:51 +00:00
|
|
|
|
2014-08-20 02:32:44 +00:00
|
|
|
namespace inhabited
|
|
|
|
|
2014-09-19 22:04:52 +00:00
|
|
|
protected definition destruct {A : Type} {B : Type} (H1 : inhabited A) (H2 : A → B) : B :=
|
2014-09-04 22:03:59 +00:00
|
|
|
inhabited.rec H2 H1
|
2014-08-01 00:48:51 +00:00
|
|
|
|
2014-08-20 22:49:44 +00:00
|
|
|
definition Prop_inhabited [instance] : inhabited Prop :=
|
2014-09-04 23:36:06 +00:00
|
|
|
mk true
|
2014-08-01 00:48:51 +00:00
|
|
|
|
2014-08-20 22:49:44 +00:00
|
|
|
definition fun_inhabited [instance] (A : Type) {B : Type} (H : inhabited B) : inhabited (A → B) :=
|
2014-09-08 02:06:42 +00:00
|
|
|
destruct H (λb, mk (λa, b))
|
|
|
|
|
2014-09-16 18:44:50 +00:00
|
|
|
definition dfun_inhabited [instance] (A : Type) {B : A → Type} (H : Πx, inhabited (B x)) :
|
|
|
|
inhabited (Πx, B x) :=
|
2014-09-08 02:06:42 +00:00
|
|
|
mk (λa, destruct (H a) (λb, b))
|
2014-08-20 02:32:44 +00:00
|
|
|
|
2014-09-04 23:36:06 +00:00
|
|
|
definition default (A : Type) {H : inhabited A} : A := destruct H (take a, a)
|
2014-08-15 03:12:54 +00:00
|
|
|
|
2014-08-20 02:32:44 +00:00
|
|
|
end inhabited
|