Skip to content

Commit

Permalink
Add an encoding of Leibniz equality as an example
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed Jul 27, 2020
1 parent 00d4c3c commit 34c712c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/leibniz.1ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
local import "prelude"

type t a b = wrap (type p _) -> p a -> p b

id (type p _) = Fun.id
((bc: t _ _) << (ab: t _ _)) (type p _) x = bc p (ab p x)
invert (eq: t _ _) (type p _) = eq (type fun b => wrap p b -> p _) Fun.id

to (eq: t _ _) = eq (type fun x => x)
from eq = to (invert eq)
10 changes: 10 additions & 0 deletions examples/leibniz.1mls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type t a b

type a ~ b = t a b

id 'a: a ~ a ;; Reflexivity
(<<) 'a 'b 'c: b ~ c -> a ~ b -> a ~ c ;; Transitivity
invert 'a 'b: a ~ b -> b ~ a ;; Symmetry

to 'a 'b: a ~ b -> a -> b
from 'a 'b: a ~ b -> b -> a

0 comments on commit 34c712c

Please sign in to comment.