GithubHelp home page GithubHelp logo

interaction-type-theory's Introduction

NOTE: this repository is a WIP. The claims here aren't verified.

NOTE: this work has been moved to Interaction Calculus of Constructions.

Interaction Type Theory

What is the simplest system capable of logical reasoning? By extending Interaction Combinators with a single new rule, "Decay", coupled with a global coherence condition that enforces equalities of paired nodes, we're able to construct a system capable of expressing propositions and checking proofs, similar to the Calculus of Constructions. This system presents itself as an extremely minimal "reasoning engine", with possible applications to program synthesis and symbolic AI.

EDIT: since initially posting this repo, I gained many insights that are NOT included here yet. Decay isn't relevant, coherence is just about enforcing t :: A :: B ⊢ A = B, superpositions can be used for optimal shared unification, ANN-binders allow encoding most types with a single unified primitive, among others that will be updated. See the itt-coc for an ITT flavoured implementation of the Calculus of (Inductive) Constructions.

Specification

Interaction Type Theory (InTT) is obtained by extending Symmetric Interaction Combinators (SIC) with a single new interaction rule, named Decay, which allows a combinator to collapse to a wire and an eraser, when it respects the coherence condition, which demands that both sides of its main wire are demonstrably equivalent. We also allow for arbitrary combinator symbols, rather than only two. And that's all. Below is a complete picture:

Notice the reduction rules are the usual ones on SIC, except for Decay, which can only be triggered when its main wire respects the equivalence relation drawn above. The red/green colors represent port locations, and 1,x, 2,x, x,1 and x,2 represent appending to a local stack. Essentially, this equivalence relation dictates that all paths outgoing from a port produce the same "execution", as defined by Yves Lafont [citation], which also coincides with Damiano Mazza's observational equivalence [citation].

My hypothesis is that this minimal system is capable of encoding arbitrary types, propositions and proofs, in a way that is closely connected to the Calculus of Constructions. This is done by reserving a symbol for annotations (ANN), and then treating graphs connected to the main port of an ANN nodes as types. Then, any net whose all ANN nodes can decay (i.e., when the coherence condition is met) correspond to a valid proof in a logic emerging from Interaction Combinators. Furthermore, the process of decaying all ANN nodes corresponds to compiling, and the resulting process will recover the original, untyped net - i.e., the program that encodes the proof.

For example, below is a net corresponding to (λP. λx. x) :: ∀P. P -> P, a simple "proof" on CoC (identity):

And below is a net corresponding to (λA. λB. λx. λy. x) :: ∀A. λB. A -> B -> B, which, this time, is an invalid (ill-typed) proof:

An attentive reader may have noticed that the picture above is lacking type inference rules, which are part of all existing type theories. This isn't an oversight: typing relations can be encoded on top of InTT, by providing introduction and elimination rules to the type being encoded, and proving these respect coherence. For example, below is an encoding for simple pairs:

Since these rules respect coherence, one can "extend" InTT with pairs without changing the core system. In the same way, by encoding the usual constructors of type theory, we can use InTT as a logical framework capable of dependent type checking. This system could be used as the core compilation target of a traditional type-checker, or as a more natural structure for program synthesis and symbolic reasoning.

Below are some encodings of important λ-calculus terms:

This "encoding-based" approach is flexible and powerful, as it gives InTT users the ability to use features that weren't present on the original formulation of the theory. For example, self-types, an important primitive discovered by Aaron Stump, which allows for inductive reasoning on λ-encodings, and even quotient types - both of which aren't expressive on CoC - can be encoded.

interaction-type-theory's People

Contributors

victortaelin avatar derenash avatar kings177 avatar

Stargazers

Luckas avatar  avatar  avatar r3rer3 avatar Kelvin Steiner avatar tyoc213 avatar  avatar Rusty avatar  avatar Tobias Sandmann avatar Vinicius Souza avatar Sam/Samuel avatar Michael Nedokushev avatar Connor Baker avatar Henry Blanchette avatar  avatar Helder S Ribeiro avatar Grue Bleen avatar Sehz avatar Johan Alm avatar Lucca Huguet avatar RJ Larson avatar Lane Biocini avatar Bowuigi avatar Zane Starr avatar Tomasz Waszczyk avatar  avatar Jeff Carpenter avatar Honza avatar Исаак Алексеевич avatar  avatar Rutvik Patel avatar iho avatar Daniel Salvadori avatar u avatar Jiho Song avatar Gabriel Lacroix avatar Nikita avatar  avatar Guilherme Silva avatar David Dinucu-Jianu avatar Travis Reid Hopkins avatar Elias Carvalho avatar anand jain avatar Lîm Tsú-thuàn avatar Eduardo Gomes avatar xywei avatar  avatar Barton Rhodes avatar  avatar Murat Dumlu avatar ts0yu avatar cybai (Haku) avatar  avatar  avatar TheMhv avatar Scott J Maddox avatar Abraão Carvalho avatar Christina Rust avatar Kiana Sheibani avatar Ella Hoeppner avatar Ammar Husain avatar T6 avatar Curtis Dunham avatar Oleh Marakhovskyi avatar  avatar George Brown avatar Juliana Dias avatar Daniel Simões avatar Saul Shanabrook avatar Oren Mittman avatar Jorge Hernández avatar Gabriel Camargo avatar Eloi Torrents avatar stackdump avatar Bruno Dias avatar Yazalde Filimone avatar Mikey avatar Shohei Shimomura avatar Jiamo avatar  avatar Krzysztof Wasielewski avatar Elliot avatar M4tr1xt4ng avatar  avatar master avatar Felipe Arthur avatar  avatar Rico avatar Hyeseong Kim avatar Zicklag avatar Lance Pollard avatar Raphael Guarilha avatar  avatar  avatar Alcides Fonseca avatar KlarkC avatar Joao Bortotti avatar

Watchers

Marc Laugharn avatar Saul Shanabrook avatar George Brown avatar Lane Biocini avatar Eric Landuyt avatar Caleb Jasik avatar  avatar Zicklag avatar  avatar Helder S Ribeiro avatar

interaction-type-theory's Issues

Status?

Wonderful ideas! What is the status of this project? If it is abandoned, could you please update the README with some comments as to why?
Best wishes,
August

Coherence ignores important checks

I believe Coherence may not be sufficient for our needs. The first issue is that it's still unclear how to check predicates. According to coherence, P x and P y will always be equal, with the arguments being ignored. Also, when we have kinds (like, x : P : *), coherence will ignore P and check as though it was x : *.

img0
img1

It seems what we actually need is to navigate the graph using the λ-calculus readback strategy. I'm not a huge fan of this, since ports 1 and 2 of the CON nodes are asymmetric (port 1 represents a variable, port 2 represents an application). However, this does make sense if our goal is to use nets to represent λ-calculus proofs. It's a bit underwhelming though, since coherence is exponentially faster than λ-calculus readback. For example, coherence checks equality for the church-encoded 2^N in linear time, rather than exponential time. Indeed, we can easily perform church-encoded equality in linear time on interaction combinators. As such, it makes sense that our type checker's definitional equality should be able to do the same. So, it still seems like something is missing. Perhaps there is a way to avoid exponential blowup on λ-calculus readback?

On a brighter side, this example made me realize that application nodes and arrow nodes are "overloaded", i.e., the same node that is an application (on the value level) can be represented as an arrow (on the type level). Specifically, the λP node is used as both the (f P) application, and as the (T -> (P -> P)) arrow. It also clarifies what to do when we reach an application node on its port 1; it is interpreted as a binder. This is a good aspect as it allows P == P to work, even if the left and right P come from different nodes (i.e., the -> binder and the actual λ). Basically, the process becomes a Bruijn index.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.