Giter VIP home page Giter VIP logo

tactic-haskell's People

Contributors

totbwf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tactic-haskell's Issues

Implement Induction Tactic

induction is the last "major" tactic I would like to have done before writing a bit about this.
The general mechanism should be:

  1. Use reify to find the type info
  2. Generate goals for each of the constructors.

However, there may be some complications. For example, should I do a positivity check?

Consider using th-desugar

As it stands, quite a bit of the work involved in implementing new features is mucking around with odd TemplateHaskell representations. Using th-desugar could really cut down on a lot of the work required.

`apply` can't handle typeclass methods

For example apply '(+) yields the error:

    Tactic Error: lookupVarType: Variable Type ClassOpI GHC.Num.+ (ForallT [KindedTV 
a_6989586621679035072 StarT] [AppT (ConT GHC.Num.Num) (VarT a_6989586621679035072)] 
(AppT (AppT ArrowT (VarT a_6989586621679035072)) (AppT (AppT ArrowT (VarT 
a_6989586621679035072)) (VarT a_6989586621679035072)))) GHC.Num.Num isn't implemented yet

Solving this could be a bit tricky, as we would need to work in an understanding of typeclass instances into things...

`induction` doesn't properly handle polymorphic types

Take this example:

data List a = Nil | Cons a (List a)
  deriving (Show)

tactic "sum'" [t| List Int -> Int |] $ do
  intro "x"
  induction "x"

Gives the error:

    Tactic Error: Unsolved Subgoals
              ===============
              GHC.Types.Int

              ind :: a_0
              ind1 :: GHC.Types.Int
              ===============
              GHC.Types.Int

The issue here is that ind :: a_0 is not unifying with Int.

Optional Subgoal Labels

Sometimes, it helps to be able to label the subgoals, especially when handling inductive types like Bool.
Implementation-wise, this is as easy as adding a Maybe String field to Judgement, and modifying
? and UnsolvedGoals to properly print these labels.

As an aside, the printing of ? and UnsolvedGoals could probably be unified in some way.

The Tactic monad is non-associative

First, a quick example of the problem:

printTac :: String -> Tactic Judgement ()
printTac s = Tactic $ \j -> (T $ reportWarning s) >> return (pure ((), j))

tactic "pair1" [t| forall a b. a -> b -> (a,b) |] $ do
  forall
  intros_
  (split >> printTac "a") >> printTac "b"
  assumption


tactic "pair2" [t| forall a b. a -> b -> (a,b) |] $ do
  forall
  intros_
  split >> (printTac "a" >> printTac "b")
  assumption

Running the 1st tactic will print out "aabb", and running the 2nd will print out "abab".

The core of this issue is that ProofState is not a monad transformer. I'm not sure exactly how to fix this at this point.

Implement Extended Type Language

This has quite a few benefits.

  1. We can have a custom quasi-quoter, which helps us both from an ergonomics and tooling perspective.
    This would enable the syntax: tactic [thm| foo :: a -> b -> (a, b) |] $ do ..., as well as allow us to (potentially) use tactic-haskell as an editor tool.

  2. New types. This would open the door for actual dependent types, which would be a huge win. I'm not sure about the exact specifics of what the desugaring would look like in a few cases, but we could always limit the tricky bits to be only usable within the context of tactics.

`auto` should use `induction`

This should be pretty straightforward. However, it may be about time to figure out a good strategy for implementing the regular and hypothesis searching versions of each tactic.

Properly handle hypothesis name freshening

Right now the code for freshening hypothesis names doesn't take into account cases where someone freshens something that ends in a number. This could cause name overlap, but is of low priority, as it would be a pretty silly thing to do.

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.