From 45d473d44eea2236ed3f2df14d2db86fe5b5f348 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 21 May 2014 11:31:34 -0700 Subject: [PATCH] feat(kernel): add mk_hott_environment function for creating HoTT compatible environments Signed-off-by: Leonardo de Moura --- src/CMakeLists.txt | 2 ++ src/kernel/hott/CMakeLists.txt | 2 ++ src/kernel/hott/hott.cpp | 22 ++++++++++++++++++++++ src/kernel/hott/hott.h | 11 +++++++++++ 4 files changed, 37 insertions(+) create mode 100644 src/kernel/hott/CMakeLists.txt create mode 100644 src/kernel/hott/hott.cpp create mode 100644 src/kernel/hott/hott.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 576ca512c4..46c6c34319 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -217,6 +217,8 @@ add_subdirectory(kernel/inductive) set(LEAN_LIBS ${LEAN_LIBS} inductive) add_subdirectory(kernel/standard) set(LEAN_LIBS ${LEAN_LIBS} standard_kernel) +add_subdirectory(kernel/hott) +set(LEAN_LIBS ${LEAN_LIBS} hott_kernel) add_subdirectory(library) set(LEAN_LIBS ${LEAN_LIBS} library) # add_subdirectory(library/rewriter) diff --git a/src/kernel/hott/CMakeLists.txt b/src/kernel/hott/CMakeLists.txt new file mode 100644 index 0000000000..2e236d7ffa --- /dev/null +++ b/src/kernel/hott/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(hott_kernel hott.cpp) +target_link_libraries(hott_kernel ${LEAN_LIBS}) diff --git a/src/kernel/hott/hott.cpp b/src/kernel/hott/hott.cpp new file mode 100644 index 0000000000..32922aa976 --- /dev/null +++ b/src/kernel/hott/hott.cpp @@ -0,0 +1,22 @@ +/* +Copyright (c) 2014 Microsoft Corporation. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. + +Author: Leonardo de Moura +*/ +#include "kernel/inductive/inductive.h" + +namespace lean { +using inductive::inductive_normalizer_extension; + +/** \brief Create a HoTT (Homotopy Type Theory) compatible environment */ +environment mk_hott_environment(unsigned trust_lvl) { + return environment(trust_lvl, + false /* Type.{0} is proof relevant */, + true /* Eta */, + false /* Type.{0} is predicative */, + list(name("Id")) /* Exact equality types are proof irrelevant */, + /* builtin support for inductive datatypes */ + std::unique_ptr(new inductive_normalizer_extension())); +} +} diff --git a/src/kernel/hott/hott.h b/src/kernel/hott/hott.h new file mode 100644 index 0000000000..18c98be268 --- /dev/null +++ b/src/kernel/hott/hott.h @@ -0,0 +1,11 @@ +/* +Copyright (c) 2014 Microsoft Corporation. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. + +Author: Leonardo de Moura +*/ +#pragma once +#include "kernel/environment.h" +namespace lean { +environment mk_hott_environment(unsigned trust_lvl = 0); +}