Commit graph

45 commits

Author SHA1 Message Date
Leonardo de Moura
7aaac31e35 chore(library/init/data/nat): remove dependency 2018-04-10 15:48:13 -07:00
Leonardo de Moura
169cd87dbe feat(library/system/io): add io.run_tactic
@nunoplopes @aqjune
I had to add a new primitive to allow you to execute a tactic from the
`main` function. The `main` function is in the `io` monad. The new
primitive has type:
```
meta constant io.run_tactic {α : Type} (a : tactic α) : io α
```
I also added a new test that shows how to use it.
The test displays all declarations that have the `nat` prefix.

cc @kha
2018-03-07 12:15:26 -08:00
Nuno Lopes
f6a5c26a1f fix(io.cmd): close stdout pipe 2018-02-27 10:43:09 -08:00
Leonardo de Moura
e023b1001a fix(library/system/random): bug at rand_nat 2018-02-16 11:20:43 -08:00
Leonardo de Moura
ac13f8b0f9 feat(library/system/io): add random number generator support in the io monad
@aqjune @nunoplopes: See new tests at tests/lean/run/random.lean

We have two actions in `io`. By default, `io` uses the C++
random number generator, but we can force it to use a `std_gen` with
the action `set_rand_gen`.

def rand (lo : nat := std_range.1) (hi : nat := std_range.2) : io nat
def set_rand_gen : std_gen → io unit
2018-02-15 16:12:08 -08:00
Leonardo de Moura
f786d21b0f feat(library/system): basic support for random numbers
@aqjune @nunoplopes: This commit adds basic support for random numbers.
It defines a random number generator interface, and an basic
implementation based on the Haskell one.
We can add more implementations in the future if neeeded.
The new test program has a few examples.

BTW, this is a pure Lean implementation.
If we need more performance we can provide an implementation
using C++.
2018-02-15 14:36:28 -08:00
Sebastian Ullrich
b3262d53b4 feat(frontends/lean/elaborator): structure notation: fall back to inferring superclasses 2018-02-02 08:58:53 -08:00
Leonardo de Moura
d4e1a4a50a chore(library/system/io): tactic.run_io ==> tactic.unsafe_run_io 2018-01-24 10:32:32 -08:00
Leonardo de Moura
0ad5497462 refactor(library/io): make io easier to extend and use 2018-01-23 15:03:31 -08:00
Sebastian Ullrich
2586f5b6f2 feat(system/io): get_cwd/set_cwd 2017-12-30 19:31:55 +01:00
Leonardo de Moura
52d6adc19c chore(library): use new structure update notation in the core lib 2017-11-17 16:57:54 -08:00
Leonardo de Moura
8b88f21c91 refactor(library): add has_to_string back (but it produces unquoted values)
See issue #1664
2017-06-18 18:30:10 -07:00
Leonardo de Moura
dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00
Sebastian Ullrich
5f3e0a1cc4 feat(frontends/lean/decl_cmds): allow implicit locals in constants & axioms 2017-05-17 10:38:12 -07:00
Gabriel Ebner
4b22e2309c refactor(system/io): use spawn_args structure in all process functions 2017-05-04 16:41:11 -07:00
Gabriel Ebner
f0d22ed3e5 feat(library/process,system/io): set environment variables for spawned processes 2017-05-04 16:41:11 -07:00
Gabriel Ebner
c4aef89296 feat(system/io): add finally combinator 2017-05-04 16:41:11 -07:00
Gabriel Ebner
1b8533130b feat(system/io): add function to get environment variables 2017-05-04 16:41:11 -07:00
Gabriel Ebner
ed9e7d9066 feat(leanpkg): make add command more awesome 2017-05-01 14:11:39 -07:00
Jared Roesch
4704b68035 chore(*): remove smt2 bindings from standard libary 2017-04-23 11:32:11 -07:00
Gabriel Ebner
66cd4c57cf feat(library/system/io): alternative instance for io 2017-04-11 16:42:17 -07:00
Gabriel Ebner
cefc26d9cb refactor(library/system/process): add exit status and working directory 2017-04-11 16:42:17 -07:00
Gabriel Ebner
e2fa363423 feat(library/system/io,shell/lean): add --run switch 2017-04-11 16:41:30 -07:00
Leonardo de Moura
6c68aeee01 feat(library/system/io): add io.iterate primitive 2017-03-31 11:34:09 -07:00
Leonardo de Moura
0fe3e3e88f chore(library): use . notation 2017-03-28 18:42:32 -07:00
Jared Roesch
dc4086d0ed feat(library/vm/process): add basic process support 2017-03-28 18:08:06 -07:00
Leonardo de Moura
6183c7676e feat(frontends/lean): use . for field access 2017-03-28 15:29:54 -07:00
Sebastian Ullrich
c7b47c7b7f fix(system/io): try to fix io monad 2017-03-27 13:42:08 -07:00
Leonardo de Moura
8cf43e1b30 feat(library/tactic/tactic_state): add tactic.run_io 2017-03-23 18:17:53 -07:00
Leonardo de Moura
fe3875a103 feat(library/system/io): add stdin, stdout and stderr 2017-03-23 16:49:39 -07:00
Leonardo de Moura
82748a61b7 feat(library/system/io): basic file system API 2017-03-23 16:30:16 -07:00
Leonardo de Moura
527c8851a8 refactor(library/system/io): use type classes 2017-03-23 14:29:07 -07:00
Leonardo de Moura
60dd85719c feat(library/system/io): system.io without axioms 2017-03-22 23:36:05 -07:00
Sebastian Ullrich
763097dbd2 refactor(library): revise the monadic hierarchy 2017-03-09 20:30:03 -08:00
Leonardo de Moura
839645c489 feat(library/system/io): replace io.monad with io.bind, io.return and io.map 2017-03-07 16:10:47 -08:00
Jared Roesch
e65d90ac79 feat(*): C++ code generator
in progress move of Lean.native to init
2016-12-05 16:11:41 -08:00
Leonardo de Moura
c816b80855 chore(*): don't use upper case letter for type variables, and camelCase for declarations 2016-11-17 14:54:08 -08:00
Leonardo de Moura
e16e9880f7 chore(library/system): enforce Lean naming conventions IO ==> io 2016-11-17 11:27:37 -08:00
Leonardo de Moura
148da46481 feat(frontends/lean): 'mutual' and 'meta' are now keywords 2016-09-24 10:44:40 -07:00
Leonardo de Moura
6c84a0a7b1 feat(frontends/lean): use new notation for declaring universes in constant and structure decls 2016-09-13 21:45:16 -07:00
Leonardo de Moura
20cce8a0f6 feat(frontends/lean/parser): nicer notation for providing universes 2016-09-13 20:41:00 -07:00
Leonardo de Moura
414bdc1abb refactor(library): move 'meta' to 'init' folder
Motivation: tactic framework should be always available.
2016-06-06 19:08:07 -07:00
Leonardo de Moura
6eb377033b chore(library/system/IO): suppress unnecessary universe 2016-05-26 11:41:41 -07:00
Leonardo de Moura
2a16b58324 test(tests/lean/run): add another IO test 2016-05-25 14:23:57 -07:00
Leonardo de Moura
e40c54013a feat(library/vm): add basic support for IO monad 2016-05-24 17:52:22 -07:00