the next generation of the in-browser educational proof assistant
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add atom prelude functionality #2

open opened by joshcbrown.tngl.sh targeting main from joshcbrown.tngl.sh/holbert-ng: assoc-comm-atom

this is an mvp to show a way of adding special builtins with access to the internal structure of atoms. the immediate use case is providing a length function on strings, which evaluates to a Nat. this expands quite drastically the set of predicates we're able to describe, because previously there was no way to separate ground parts of a string given that epsilon can unify with anything.

it's nice in that there's no need to change any of the signatures, apart from the introduction of reduce--- Preludic.Atom simply has type t = anyValue and gives a dummy wrap definition. where a prelude function can be evaluated syntactically, this evaluation can take place in parse, which directly produces the right tag and anyValue.

where we need to defer evaluation of a prelude function until a concrete substitution has been chosen, we parse into a two-dimensional anyValue:

  length("$s")
        │
        │parse()
        │
        │
        ▼
┌───────────────┐ sub(0 -> [a b])┌───────────────┐ reduce()     ┌────────────┐
│   PreludeTag  ├───────────────►│  PreludeTag   ├─────────────►│ NatTag     │
└───────┬───────┘                └───────────────┘              └─────┬──────┘
        │                                │                            │
        │                                │                            │
        │                                │                            │
┌───────┴───────┐                ┌───────┴───────┐             ┌──────────────┐
│  LengthTag    │                │  LengthTag    │             │      2       │
└───────┬───────┘                └───────┬───────┘             └──────────────┘
        │                                │
        │                                │
        │                                │
┌───────┴───────┐                ┌───────┴───────┐
│[Var({idx: 0})]│                │ [ a, b]       │
└───────────────┘                └───────────────┘
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:2b3sedxepcp6u7s2najxr2zm/sh.tangled.repo.pull/3mke3eh2j2t22
Interdiff #0 #1
index.html

This file has not been changed.

src/AssocComm.res

This file has not been changed.

src/AtomDef.res

This file has not been changed.

src/Preludic.res

This file has not been changed.

src/SExp.res

This file has not been changed.

src/Scratch.res

This file has not been changed.

src/StringA.res

This file has not been changed.

src/Symbolic.res

This file has not been changed.

tests/PreludeTest.res

This file has not been changed.

History

2 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
add atom prelude functionality
no conflicts, ready to merge
expand 0 comments
1 commit
expand
add atom prelude functionality
expand 0 comments