Matija Pretnar

🇸🇮SL 🏴󠁧󠁢󠁳󠁣󠁴󠁿EN

Matija Pretnar

Fakulteta za matematiko in fiziko
Jadranska 21,
SI-1000 Ljubljana
tel: +386 1 4766 668
mail: matija.pretnar@fmf.uni-lj.si
GitHub: matijapretnar
ORCID iD: 0000-0001-7755-2303
Bibliografija: COBISS DBLP Scholar Scopus Sicris


Raziskovanje

Ukvarjam se s formalizacijo, implementacijo in semantiko programskih jezikov. Moje trenutne raziskave so usmerjene na algebrajske učinke in njihove prestreznike.

Poučevanje

Zaposlen sem na Fakulteti za matematiko in fiziko, kjer poučujem večinoma računalniške predmete.

Dejavnost

  1. 2024
  2. 📜
    Filip Koprivec, Matija Pretnar: Simplifying explicit subtyping coercions in a polymorphic calculus with effects.
  3. 📜
    Dongjun Youn, Wonho Shin, Jaehyun Lee, Sukyoung Ryu, Joachim Breitner, Philippa Gardner, Sam Lindley, Matija Pretnar, Xiaojia Rao, Conrad Watt, Andreas Rossberg: Bringing the WebAssembly Standard up to Speed with SpecTec.
    • Proc. ACM Program. Lang.
    • 2024
    • DOI
    • DBLP
  4. 🎤
    A case study in mathematically inspired language constructs
    • IFIP WG2.1 meeting #81
    • 05 Apr 2024
    • Neustadt
    • PDF
    • Keynote

    Even though the mathematical core of algebraic effect handlers has remained unchanged, they have evolved into a more useful programming construct since their introduction. In the talk, I will talk about steps (and one missed opportunity!) on the way to their discovery, initial considerations behind their design, and lessons learnt along the way.

  5. 🎤
    Effect handlers and mathematically inspired language constructs

    Effect handlers are a programming language construct able to express and combine diverse computational features such as backtracking, stream redirection, multiple scheduling strategies, or continuations. This flexibility comes as no surprise since handlers are based on even more versatile homomorphisms of algebraic theories. Even though the design of handlers witnessed multiple iterations and extensions, their mathematical core remained unchanged.

    In this seminar, I will discuss the discovery of effect handlers and initial considerations behind their design, in particular steps required when translating a mathematical concept into a useful programming tool. We shall also take a look at subsequent research on handlers, for example various effect systems or an efficient transpiler to OCaml, comparing features guided by mathematics and those with a more practical motivation.

  6. 🎤
    Simplifying explicit subtyping
    • IFIP WG2.1 meeting #80
    • 18 Jul 2024
    • Oxford
    • Notes

    Our recent work (Karachalias et al., OOPSLA 2021) has shown that code written using the full flexibility of handlers can be transformed into a pure one that matches the performance of a conventional handcrafted one. However, to do so, the compiler tracks effect information through explicit subtyping coercions, and for polymorphic functions, these need to be passed around as additional parameters. Since subtyping coercions are inferred automatically, their number grows with the size of the program, which drastically reduces the performance. To avoid this, all polymorphic functions need to be annotated with particular types, or monomorphised by the compiler, neither of which is a satisfactory solution. In the talk, I will describe a simple algorithm that drastically, yet soundly, reduces (and often completely eliminates) redundant coercion parameters, leading to a performance comparable to monomorphic code.

  7. 2023
  8. 📜
    Joachim Breitner, Philippa Gardner, Jaehyun Lee, Sam Lindley, Matija Pretnar, Xiaojia Rao, Andreas Rossberg, Sukyoung Ryu, Wonho Shin, Conrad Watt, Dongjun Youn: Wasm SpecTec: Engineering a Formal Language Standard.
  9. 📜
    Danel Ahman, Matija Pretnar: Higher-Order Asynchronous Effects.
  10. 📜
    Luna Phipps-Costin, Andreas Rossberg, Arjun Guha, Daan Leijen, Daniel Hillerström, KC Sivaramakrishnan, Matija Pretnar, Sam Lindley: Continuing WebAssembly with Effect Handlers.
  11. 🎤
    The state of Eff

    The talk describes the history and the current state of Eff, the first programming language with native support of algebraic effect handlers. The first version of Eff was developed by Andrej Bauer and myself and appeared in 2010. It was untyped and had a syntax similar to Python. In the next version in 2011, we introduced the more commonly known ML-like syntax and dynamic generation of effect instances that worked analogously to references in OCaml. After that, the versions are a bit harder to reconstruct, but the main improvement was a subtyping-based effect system.

    Building on the effect system, the next goal for Eff was an optimizing compiler, on which I worked together with Tom Schrijvers and his students. The compiler would produce efficient code by inlining handlers as much as possible, and monadically embed the rest in OCaml. It soon became obvious that the effect system has to be more robust, which was achieved by using coercions as explicit witnesses of subtyping. Currently, Filip Koprivec, my PhD student, focuses on simplifying those witnesses in the polymorphic setting, as otherwise each coercion needs to be passed around as an additional parameter at runtime. In parallel to the optimizing compiler project, Žiga Lukšič developed EEff, a variant of Eff that tracks algebraic equations between operations that have to be respected by the handlers. Currently, EEff only prints out the obligations, though one could envision sending them to an SMT solver or producing specifications for a proof assistant.

    Finally, the talk mentions Millet, a language one can use as a basis when developing a prototype language exploring an interesting novel idea. Millet implements all the boring and expected components of a programming language (parsing, algebraic datatypes, simple type-checking, interactive toplevel, compilation pipeline, …), and any fork just needs to extend all the components with the support for the additional features. Then, any later change to Millet (right now, a module system, a Wasm backend, and LSP support are in the works) should be orthogonal and can hopefully be merged into forks with not too much additional work.

  12. 🎤
    Asynchronous Effects
    • Scottish Programming Languages Seminar
    • 07 Jun 2023
    • University of the West of Scotland, Paisley
    • PDF
    • Keynote
    • SPLS

    In the standard algebraic approach to effects, once an operation is called, the evaluation of the continuation stalls until it gets a result (either from a built-in primitive effect or through a handler). But we often desire asynchronous behaviour, when the continuation may proceed with the evaluation and suitably incorporates the result once it arrives. I will describe a small calculus with primitives for sending such signals and receiving corresponding interrupts, and show a small prototype in which one can express promises, preemptive multi-threading and remote function calls.

    Joint work with Danel Ahman.

  13. 2022
  14. 2021
  15. 📜
    Danel Ahman, Matija Pretnar, Radešček, Janez: (Higher-order) asynchronous effects
    • Scalable handling of effects : Report from Dagstuhl Seminar 21292
  16. 📜
    Danel Ahman, Matija Pretnar: Asynchronous effects
    • Proceedings of the ACM on Programming Languages
    • 2021
    • DOI
    • DBLP
  17. 📜
    Georgios Karachalias, Filip Koprivec, Matija Pretnar, Tom Schrijvers: Efficient compilation of algebraic effect handlers
    • Proceedings of the ACM on Programming Languages
    • 2021
    • DOI
    • DBLP
  18. 🎤
    Spletna storitev za generiranje nalog
    • FMF seminar za učitelje matematike, Fakulteta za matematiko in fiziko
    • 25 Sep 2021
    • Ljubljana
  19. 🎤
    Efficient compilation of algebraic effect handlers
    • Dagstuhl Seminar 21292
    • 21 Jul 2021
    • Dagstuhl (remotely)
    • PDF
    • Keynote

    The popularity of algebraic effect handlers as a programming language feature for user-defined computational effects is steadily growing. Yet, even though efficient runtime representations have already been studied, most handler-based programs are still much slower than hand-written code.

    This paper shows that the performance gap can be drastically narrowed (in some cases even closed) by means of type-and-effect directed optimising compilation. Our approach consists of source-to-source transformations in two phases of the compilation pipeline. Firstly, elementary rewrites, aided by judicious function specialisation, exploit the explicit type and effect information of the compiler’s core language to aggressively reduce handler applications. Secondly, after erasing the effect information further rewrites in the backend of the compiler emit tight code.

    This work comes with a practical implementation: an optimizing compiler from Eff, an ML style language with algebraic effect handlers, to OCaml. Experimental evaluation with this implementation demonstrates that in a number of benchmarks, our approach eliminates much of the overhead of handlers, outperforms capability-passing style compilation and yields competitive performance compared to hand-written OCaml code as well Multicore OCaml’s dedicated runtime support.

  20. 🎤
    Introduction to Quantum Computing

    We often read in the media that quantum computers are fast because quantum superposition allows them to be in multiple states at once, enabling them to explore all the possible solutions in a single step.

    As we shall see, things are not that simple because, in the end, we can observe only one randomly chosen result, which is likely not going to be the one we need. After all, with all the possible solutions out there, what’s the guarantee that the one we want is the one randomly chosen by the quantum computer? So we want to be able to increase the probability of getting the solution we want from among all the possible paths.

    What can be done is to use interference to cancel out all the undesirable paths and unwanted solutions. Although we still end up with a randomly chosen path, it is a path chosen from among the ones we want.

  21. 2020
  22. 📜
    Georgios Karachalias, Matija Pretnar, Amr Hany Shehata Saleh, Stien Vanderhallen, Tom Schrijvers: Explicit effect subtyping.
    • Journal of functional programming
    • 2020
    • DOI
    • DBLP
  23. 📜
    Žiga Lukšič, Matija Pretnar: Local algebraic effect theories.
    • Journal of functional programming
    • 2020
    • DOI
    • DBLP
  24. 🎤
    Kvantno računalništvo
    • Gimnazija Bežigrad
    • 23 Jan 2020
    • Ljubljana
    • PDF
    • Keynote
  25. 🎤
    Asynchronous operations
    • IFIP WG2.1 meeting #79
    • 08 Jan 2020
    • Otterlo
    • PDF
    • Keynote

    In the standard algebraic approach to effects, once an operation is called, the evaluation of the continuation stalls until it gets a result (either from a built-in primitive effect or through a handler). But we often desire asynchronous behaviour, when the continuation may proceed with the evaluation and suitably incorporates the result once it arrives. I will describe a small calculus with primitives for sending and receiving such signals.

    Joint work with Danel Ahman

  26. 2019
  27. 📜
    Yannick Forster, Ohad Kammar, Sam Lindley, Matija Pretnar: On the expressive power of user-defined effects: effect handlers, monadic reflection, delimited control
    • Journal of functional programming
    • 2019
    • DOI
    • DBLP
  28. 🎤
    Projekt Tomo
    • Maps ∩ Configurations ∩ Polytopes ∩ Molecules ⊆ Graphs: The mathematics of Tomaž Pisanski on the occasion of his 70th birthday
    • 23 May 2019
    • Ljubljana
    • PDF
    • Keynote

    Projekt Tomo is a web service for teaching programming that works by providing students immediate and low-overhead automated feedback on the correctness of the submitted solutions. In the talk, I will describe the basic principles of the service, its history and how its eponym helped shape it.

  29. 🎤
    Bringing equations back to algebraic effect handlers

    Algebraic effects are computational effects that can be described with a set of basic operations and equations between them. As many interesting effect handlers do not respect these equations, most approaches assume a trivial theory, sacrificing both reasoning power and safety. I will present an alternative approach where the effect system tracks equations that are observed in subparts of the program, yielding a sound and flexible logic, and paving a way for practical optimizations and reasoning tools.

    Joint work with Žiga Lukšič

  30. 🎤
    Local algebraic effect theories

    Algebraic effects are computational effects that can be described with a set of basic operations and equations between them. As many interesting effect handlers do not respect these equations, most approaches assume a trivial theory, sacrificing both reasoning power and safety.

    We present an alternative approach where the type system tracks equations thar are observed in subparts of the program, yielding a sound and flexible logic, and paving a way for practical optimizations and reasoning tools.

    Joint work with Žiga Lukšič

  31. 2018
  32. 📜
    Andrej Bauer, Gaëtan Gilbert, Philipp Georg Haselwarter, Matija Pretnar, Christopher A Stone: Design and implementation of the Andromeda proof assistant
    • 22nd International Conference on Types for Proofs and Programs : TYPES 2016
    • DOI
    • DBLP
  33. 📜
    Amr Hany Shehata Saleh, Georgios Karachalias, Matija Pretnar, Tom Schrijvers: Explicit effect subtyping.
    • 27th European Symposium on Programming, ESOP 2018
    • DOI
    • DBLP
  34. 🎤
    Putting reason back into handlers
    • IFIP WG2.1 meeting #77
    • 03 Jul 2018
    • Brandenburg
    • PDF
    • Keynote

    The main premise of algebraic effects is that effects can be described with an equational theory consisting of a set of operations and equations between them. However, many computationally interesting algebraic effect handlers do not respect these equations, which most approaches nowadays reconcile by assuming a trivial equational theory. I will present an approach in which the expected equations may be encoded in computation types.

    Joint work with Žiga Lukšič

  35. 2017
  36. 📜
    Tanja Knific, Tadej Malovrh, Marko Potočnik, Matija Pretnar, Milica Krković, Aljoša Vodopija, Jasna Prezelj-Perman: Modelling the spread of bluetongue in Slovenia.
    • ModAH, Nantes, 14 - 16. June 2017
  37. 📜
    Ohad Kammar, Matija Pretnar: No value restriction is needed for algebraic effects and handlers.
    • Journal of functional programming
    • 2017
    • DOI
    • DBLP
  38. 📜
    Yannick Forster, Ohad Kammar, Sam Lindley, Matija Pretnar: On the expressive power of user-defined effects: effect handlers, monadic reflection, delimited control
    • Proceedings of the ACM on Programming Languages
    • 2017
    • DOI
    • DBLP
  39. 🎤
    Explicit effects subtyping
    • IFIP WG2.1 meeting #76
    • 18 Oct 2017
    • Lesbos
    • HTML

    To inform the programmer about the effects of a given program, a bottom up inference algorithm that Eff provides is sufficient. However, for an optimizing compiler, we need access to effects of all subterms. It turned out that adapting the current algorithm is overly error-prone as the core language is implicitly typed and subtyping-based.

    In hope of remedying the situation, we present an explicitly-typed polymorphic core calculus, which reifies appeals to subtyping in explicit casts with coercions that witness the subtyping proof. We provide a constraint-based inference algorithm that turns an implicitly-typed term into our calculus, and effect erasure, which allows us to targets an ML-like language with or without support for algebraic effects.

    The talk will include a brief introduction to algebraic effect handlers.

    Joint work with Amr Hany Saleh, George Karachalias and Tom Schrijvers

  40. 2016
  41. 📜
    Matija Pretnar: Capturing algebraic equations in an effect system.
    • From theory to practice of algebraic effects and handlers : Report from Dagstuhl Seminar 16112
  42. 📜
    Matija Pretnar, Amr Hany Shehata Saleh, Tom Schrijvers: Compiling Eff to OCaml.
    • From theory to practice of algebraic effects and handlers : Report from Dagstuhl Seminar 16112
  43. 📜
    Ohad Kammar, Sean Moss, Matija Pretnar: No value restriction is needed for algebraic effects and handlers.
    • From theory to practice of algebraic effects and handlers : Report from Dagstuhl Seminar 16112
    • DBLP
  44. 📜
    Matija Pretnar, Stephen Dolan, KC Sivaramakrishnan, Leo White: Towards an effect system for OCaml.
    • From theory to practice of algebraic effects and handlers : Report from Dagstuhl Seminar
  45. 📜
    Matija Pretnar: A tutorial on algebraic effects and handlers.
    • From theory to practice of algebraic effects and handlers : Report from Dagstuhl Seminar
  46. 📜
    Andrej Bauer, Martin Hofmann, Matija Pretnar, Jeremy Yallop: Executive summary.
    • From theory to practice of algebraic effects and handlers : Report from Dagstuhl Seminar 16112
  47. 📜
    Andrej Bauer, Gaëtan Gilbert, Philipp Georg Haselwarter, Matija Pretnar, Christopher A Stone: Design and implementation of the Andromeda proof assistant
    • TYPES 2016 : book of abstracts
    • DBLP
  48. 📜
    Ohad Kammar, Sean Moss, Matija Pretnar: No value restriction is needed for algebraic effects and handlers
    • TYPES 2016 : book of abstracts
    • DBLP
  49. 🎤
    Hekerski pristop k statistiki
    • FMF seminar za učitelje matematike
    • 01 Oct 2016
    • Ljubljana
    • PDF
    • Keynote

    Recimo, da so učenci 3. b razreda pri testu iz matematike dosegli povprečno 63%, učenci 3. c razreda pa 70%. Ali so učenci 3. c res bolj razumeli snov ali pa je razlika le posledica zunanjih dejavnikov in bi bil kakšen drug dan rezultat ravno obraten? Kaj pa, če se enaka razlika pojavi še pri naslednjem testu? S kakšno gotovostjo lahko rečemo, da ni šlo za naključje? Statistika nam na taka vprašanja zna odgovoriti, vendar so odgovori dostikrat precej zapleteni. Na seminarju si bomo zato ogledali alternativen pristop, pri katerem iskano gotovost ocenimo s pomočjo računalniških simulacij.

  50. 📜
    Tanja Knific, Tadej Malovrh, Marko Potočnik, Matija Pretnar, Milica Krković, Aljoša Vodopija, Jasna Prezelj-Perman: Modeliranje širjenja kužnih bolezni: primer bolezni modrikastega jezika v Sloveniji
    • 6. Slovenski veterinarski kongres 2016
  51. 2015
  52. 🎤
    A low overhead automated service for teaching programming

    Programming is a skill that often demands that students engage in a significantly high amount of individual practice and experimentation in order to acquire basic competence. Teachers are required to both encourage students by exposing them to numerous problems and supervise the students’ attempts to solve them.

    To support this teaching approach we developed a web service called Projekt Tomo, presented in the article. The service is designed in such a way that it requires little or no additional work from students and teachers, enabling them to focus on the content. Furthermore, the service can be used in almost all teaching environments, as it can be adapted to most programming languages and has minor technical requirements.

    Joint work with Matija Lokar

  53. 📜
    Matija Lokar, Matija Pretnar: A low overhead automated service for teaching programming.
    • 15th Koli Calling Conference on Computing Education Research, November 19-22, 2015
    • DOI
  54. 📜
    Matija Pretnar: An introduction to algebraic effects and handlers. Invited tutorial paper.
    • The 31st Conference on the Mathematical Foundations of Programming Semantics (MFPS XXXI)
    • DOI
  55. 🎤
    An Introduction to Algebraic Effects and Handlers
  56. 📜
    Gregor Jerše, Sonja Jerše, Matija Lokar, Matija Pretnar: Preparing programming exercises with efficient automated validation tests.
    • International Conference on Informatics in Schools - ISSEP 2015
  57. 📜
    Andrej Bauer, Matija Pretnar: Programming with algebraic effects and handlers.
    • Journal of logical and algebraic methods in programming
    • 2015
    • DOI
    • DBLP
  58. 📜
    Gregor Jerše, Sonja Jerše, Matija Lokar, Matija Pretnar: A web service for teaching programming.
    • International Conference on Informatics in Schools - ISSEP 2015, September 28- October 1, Ljubljana, Slovenia
  59. 📜
    Gregor Jerše, Sonja Jerše, Matija Lokar, Matija Pretnar: YASAAPE - Yet Another System for Automatic Assessment of Programming Exercises.
    • International Conference on Informatics in Schools - ISSEP 2015, September 28- October 1, Ljubljana, Slovenia
  60. 2014
  61. 📜
    Andrej Bauer, Matija Pretnar: An effect system for algebraic effects and handlers.
    • Logical methods in computer science
    • 2014
    • DOI
    • DBLP
  62. 📜
    Matija Pretnar: Inferring algebraic effects
    • Logical methods in computer science
    • 2014
    • DOI
    • DBLP
  63. 📜
    Matija Pretnar: Osnove kvantnega računalništva, 2. del
    • Obzornik za matematiko in fiziko
    • 2014
  64. 📜
    Matija Pretnar: Spletna storitev za poučevanje programiranja.
    • Vzgoja in izobraževanje v informacijski družbi - VIVID 2014
  65. 2013
  66. 📜
    Andrej Bauer, Matija Pretnar: An effect system for algebraic effects and handlers.
    • 5th Conference on Algebra and Coalgebra in Computer Science, CALCO 2013
    • DOI
    • DBLP
  67. 📜
    Gordon Plotkin, Matija Pretnar: Handling algebraic effects.
    • Logical methods in computer science
    • 2013
    • DOI
    • DBLP
  68. 📜
    Matija Pretnar: Osnove kvantnega računalništva, 1. del.
    • Obzornik za matematiko in fiziko
    • 2013
  69. 2012
  70. 2011
  71. 🎤
    The f-calculus

    To see how useful Plotkin and Power’s algebraic effects are in programming, Andrej Bauer and I have developed a language called eff, based on such an approach. As it turns out, eff is very suitable for writing programs that use nondeterminism, rollback, delimited continuations, scheduling, and many other effects. In the talk, I will present the f-calculus, which formalizes eff’s core, its type system, and its semantics.

  72. 2010
  73. 2009
  74. 📜
    Gordon Plotkin, Matija Pretnar: Handlers of algebraic effects.
    • 18th European Symposium on Programming, ESOP 2009
    • DOI
  75. 2008
  76. 📜
    Gordon Plotkin, Matija Pretnar: A logic for algebraic effects.
    • Twenty-third Annual IEEE Symposium on Logic in Computer Science, LICS 2008
    • DOI