Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ammkrn/nanoda
/ functions
Functions
297 in github.com/ammkrn/nanoda
⨍
Functions
297
◇
Types & classes
39
↓ 51 callers
Method
push
(&self, t : T)
src/utils.rs:174
↓ 39 callers
Method
as_ref
(&self)
src/name.rs:70
↓ 38 callers
Method
concat
(self, other : impl Into<Doc>)
src/pretty/components.rs:239
↓ 32 callers
Method
fold_apps
Note for non-rust users, IntoIterator is idempotent over Iterators; if we pass this something that's already an interator, nothing happens. But if we
src/expr.rs:468
↓ 29 callers
Method
instantiate
Similar shape to abstract; we traverse an expression, but this time we want to substitute variables for other expressions, stil carrying a cache and u
src/expr.rs:344
↓ 26 callers
Method
get
(&self, e : &Expr, offset : usize)
src/expr.rs:732
↓ 25 callers
Method
parens
(&self, new_priority : usize)
src/pretty/components.rs:294
↓ 21 callers
Method
as_ref
(&self)
src/expr.rs:693
↓ 19 callers
Method
group
(&self)
src/pretty/components.rs:136
↓ 18 callers
Method
as_ref
(&self)
src/pretty/components.rs:88
↓ 17 callers
Method
concat_plus
(self, rhs : impl Into<Doc>)
src/pretty/components.rs:248
↓ 17 callers
Method
pp_expr
(&self, e : &Expr)
src/pretty/pretty_printer.rs:341
↓ 16 callers
Function
mk_const
A constant; represents a reference to a declaration that has already been added to the environment.
src/expr.rs:140
↓ 16 callers
Method
swap_ty
(&self, other : Expr)
src/expr.rs:84
↓ 14 callers
Method
as_ref
(&self)
src/level.rs:321
↓ 14 callers
Method
insert
(&mut self, e1 : Expr, e2 : Expr, offset : usize)
src/expr.rs:738
↓ 13 callers
Method
get_expr
(&mut self, ws : &mut SplitWhitespace)
src/parser.rs:185
↓ 13 callers
Function
mk_local
A `Local` represents a free variable. All `Local` terms have a unique identifier (here we just use a monotonically increasing counter, with each local
src/expr.rs:181
↓ 13 callers
Method
var_bound
(&self)
src/expr.rs:213
↓ 12 callers
Method
fold_pis
Given a list of Local expressions [L_1, L_2, ... L_n] and a body `E : Expr`, use your favorite method (fold_right is nice) and the Pi constructor to m
src/expr.rs:547
↓ 11 callers
Method
as_local
(self)
src/expr.rs:78
↓ 11 callers
Method
concat_line
(self, other : impl Into<Doc>)
src/pretty/components.rs:243
↓ 11 callers
Method
has_locals
(&self)
src/expr.rs:205
↓ 11 callers
Method
infer
Main dispatch point for type inference. Attempts to return early by checking a cache of previously inferred terms. Some of the methods are fairly long
src/tc.rs:511
↓ 10 callers
Method
get_name
(&mut self, ws : &mut SplitWhitespace)
src/parser.rs:174
↓ 10 callers
Function
mk_app
Makes a node in the tree, joining two expressions as application.
src/expr.rs:124
↓ 10 callers
Method
nest
(&self, doc : Doc)
src/pretty/pretty_printer.rs:38
↓ 9 callers
Method
get_digest
(&self)
src/expr.rs:201
↓ 9 callers
Method
mk_arrow
This is the primitive joining of applying two expressions with the arrow constructor. Given some `e1` and `e2`, constructs `e1 → e2` by turning it int
src/expr.rs:263
↓ 9 callers
Function
mk_param
(n : impl Into<Name>)
src/level.rs:50
↓ 9 callers
Function
mk_sort
Represents a Sort/Level/Universe. You can read more about these in sources like Theorem Proving in Lean.
src/expr.rs:133
↓ 9 callers
Method
pp_name
(&self, n : &Name)
src/pretty/pretty_printer.rs:43
↓ 9 callers
Method
simplify
Brief simplification procedure mostly aimed at simplifying IMax terms (the rule about an IMax with a right hand side of Zero becoming Zero is enforced
src/level.rs:95
↓ 8 callers
Method
extend_str
Extend some hierarchical name with a string. IE `nat` => `nat.rec`
src/name.rs:37
↓ 8 callers
Method
infer_universe_of_type
(&mut self, term : &Expr)
src/tc.rs:580
↓ 8 callers
Method
map_tc
(&self, f : impl FnOnce(&mut TypeChecker) -> T)
src/inductive.rs:100
↓ 8 callers
Function
mk_imax_refs
(lhs : &Level, rhs : &Level)
src/level.rs:46
↓ 8 callers
Function
mk_max
(lhs : Level, rhs : Level)
src/level.rs:38
↓ 7 callers
Method
abstract_
The goal here is to traverse an expression, replacing `Local` terms with `Var` terms where possible, while caching terms we've already performed subst
src/expr.rs:282
↓ 7 callers
Function
mk_lambda
A lambda function.
src/expr.rs:148
↓ 7 callers
Function
mk_pi
A Pi (dependent function) type.
src/expr.rs:157
↓ 7 callers
Function
mk_zero
()
src/level.rs:34
↓ 7 callers
Method
unfold_apps_refs
From an already constructed tree, unfold all consecutive `App` constructors along their spine from right to left. ```pseudo `App` nodes, and the botto
src/expr.rs:492
↓ 7 callers
Method
whnf
Outward facing function/entry point for reduction to weak head normal form. Checks cache for a previous result, calling whnf_core on a cache miss.
src/tc.rs:155
↓ 7 callers
Function
word_wrap_val
(s : impl Iterator<Item = Doc>)
src/pretty/components.rs:255
↓ 6 callers
Method
get_level
(&mut self, ws : &mut SplitWhitespace)
src/parser.rs:180
↓ 6 callers
Method
lc_binding
!! Partial function !!
src/expr.rs:218
↓ 6 callers
Function
mk_succ
(l : Level)
src/level.rs:54
↓ 6 callers
Method
parse_usize
(&mut self, ws : &mut SplitWhitespace)
src/parser.rs:125
↓ 6 callers
Method
pop
(&self)
src/utils.rs:180
↓ 5 callers
Method
check_def_eq
Main entry point for checking definitional equality of two terms, which dispatches out into a number of different functions. 1. `check_def_eq_core` do
src/tc.rs:315
↓ 5 callers
Method
def_eq
(&mut self, a : &Expr, b : &Expr)
src/tc.rs:278
↓ 5 callers
Function
find_true_else_false
I'll fix these at some point; at the moment we're (very) fast and loose with the parsing, and parsing fails silently.
src/cli.rs:79
↓ 5 callers
Method
get_cache
(&self)
src/expr.rs:639
↓ 5 callers
Method
get_univ_params
(&self)
src/inductive.rs:117
↓ 5 callers
Method
insert_declaration
(&mut self, d : Declaration)
src/env.rs:191
↓ 4 callers
Method
has_vars
(&self)
src/expr.rs:209
↓ 4 callers
Method
instantiate_lvl
Given a `Level` `L`, and a mapping of `Level::Param |-> Level` `M`, traverse `L` and execute : for each node `n` in `L` if `n` is a Param, and `M` con
src/level.rs:115
↓ 4 callers
Method
is_forall
(&self)
src/pretty/pretty_printer.rs:540
↓ 4 callers
Method
is_proof
(&mut self, p: &Expr)
src/tc.rs:90
↓ 4 callers
Method
is_zero
There is no level strictly less than Zero, so for any level `L`, if `L` is less than or equal to Zero, it must be that L is equal to Zero. ```pseudo `
src/level.rs:263
↓ 4 callers
Method
leq_core
Essentially just a big analysis of different cases to determine (in the presence of variables and IMax's weirdness) whether the left hand side is less
src/level.rs:178
↓ 4 callers
Function
loop_check
Same as above. Constantly poll for new work, with Left(Compiled) indicating an item to be checked, `None` meaning 'try again later' and Right(..) mean
src/main.rs:198
↓ 4 callers
Function
mk_anon
()
src/name.rs:23
↓ 4 callers
Function
mk_imax
(lhs : Level, rhs : Level)
src/level.rs:42
↓ 4 callers
Function
mk_let
A let binding, IE `let (x : nat) := 5 in 2 * x`
src/expr.rs:166
↓ 4 callers
Function
mk_prop
special constructor for an Expr::Sort that corresponds to `Prop`
src/expr.rs:111
↓ 4 callers
Function
mk_var
Makes a variable expression which contains a [De Brujin index](https://en.wikipedia.org/wiki/De_Bruijn_index).
src/expr.rs:118
↓ 4 callers
Method
ref_anon
(&self)
src/parser.rs:67
↓ 4 callers
Method
should_check
(&self)
src/tc.rs:53
↓ 4 callers
Method
style
(&self)
src/pretty/pretty_printer.rs:548
↓ 4 callers
Function
take_while_slice
(s : &[T], f : impl Fn(&T) -> bool)
src/pretty/pretty_printer.rs:576
↓ 4 callers
Method
telescope
(&self, head : Option<Doc>, binders : &[ParsedBinder])
src/pretty/pretty_printer.rs:149
↓ 4 callers
Method
ty
(&self)
src/pretty/pretty_printer.rs:552
↓ 3 callers
Method
check_def_eq_core
(&mut self, e1_0 : &Expr, e2_0 : &Expr)
src/tc.rs:387
↓ 3 callers
Method
check_type
(&mut self, e : &Expr, ty : &Expr)
src/tc.rs:661
↓ 3 callers
Method
declaration_check
(&self, tc : &mut TypeChecker)
src/env.rs:123
↓ 3 callers
Function
export_file_parse_err
(loc : u32, err : T)
src/errors.rs:102
↓ 3 callers
Method
extend_num
Extend some hierarchical name with an integer. IE `prod` => `prod.3`
src/name.rs:42
↓ 3 callers
Method
get_indices
(&self)
src/inductive.rs:108
↓ 3 callers
Method
get_params
(&self)
src/inductive.rs:104
↓ 3 callers
Method
insert_reduction_rule
(&mut self, r : ReductionRule)
src/env.rs:195
↓ 3 callers
Method
is_param
(&self)
src/level.rs:66
↓ 3 callers
Method
make_notation
(&mut self, kind : &str, line : &str, ws : &mut SplitWhitespace)
src/parser.rs:251
↓ 3 callers
Method
mk_motive_app
(&self, e : &Expr, indices : &[Expr], motive : &Expr)
src/inductive.rs:159
↓ 3 callers
Method
normalize_pis
More aggressive version of `unfold_pis`. Given some term `E`, repeats `{ apply whnf(e), then unfold_pis(e) }` until that combination fails to strip an
src/tc.rs:109
↓ 3 callers
Method
parse_binders
(&self, e : &Expr)
src/pretty/pretty_printer.rs:487
↓ 3 callers
Method
pp_binders
(&self, binders : &[ParsedBinder], inner : Parenable)
src/pretty/pretty_printer.rs:195
↓ 3 callers
Method
pp_level
(&self, lvl : &Level)
src/pretty/pretty_printer.rs:47
↓ 3 callers
Method
pp_levels
(&self, lvls : &Vec<Level>)
src/pretty/pretty_printer.rs:139
↓ 3 callers
Method
reduce_hdtl
(&mut self, _fn : &Expr, apps : &[&Expr], flag : Option<Flag>)
src/tc.rs:234
↓ 3 callers
Method
render
(self, line_width : usize)
src/pretty/components.rs:185
↓ 3 callers
Method
restore_lc_names
(&self, binders : &Vec<ParsedBinder>)
src/pretty/pretty_printer.rs:365
↓ 3 callers
Function
safe_minus_one
(n : u16)
src/utils.rs:66
↓ 3 callers
Method
unfold_apps_special
Same as unfold_apps_refs, but returns owned values instead of references and returns the vector backwards. used a couple of times in inductive, and on
src/expr.rs:506
↓ 3 callers
Method
whnf_core
(&mut self, mut e : Expr, mut _flag : Option<Flag>)
src/tc.rs:166
↓ 3 callers
Function
write_elem_strict
FIXME add command-line flag for strict/non-strict export file parsing. Strict assumes that well-formed export files will not have 'holes' when filling
src/parser.rs:327
↓ 2 callers
Method
add_only
All this does is add the (as of yet unchecked) item to the environment. We then have to come back and check it later.
src/env.rs:276
↓ 2 callers
Method
already_used
(&self, n : &Name)
src/pretty/pretty_printer.rs:78
↓ 2 callers
Method
apps_eq
only used in `check_def_eq_patterns`. Broken out to prevent `patterns` from getting too big/hard to read.
src/tc.rs:289
next →
1–100 of 297, ranked by callers