FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/Declarative_programming

Declarative programming

Contents
    Constraint programming
    Modeling
    Answer set programming
See also
References
External links

In a pure functional language, such as Haskell, all functions are without side effects, and state changes are only represented as functions that transform the state, which is explicitly represented as a first-class object in the program. Although pure functional languages are non-imperative, they often provide a facility for describing the effect of a function as a series of steps.

Constraint programming

edit

Logic programming languages are characterized by a mostly declarative programming style. In logic programming, programs consist of sentences expressed in logical form, and computation uses those sentences to solve problems, which are also expressed in logical form.

Logic programming languages, such as Prolog, Datalog and answer set programming, compute by proving that a goal is a logical consequence of the program, or by showing that the goal is true in a model defined by the program. Prolog computes by reducing goals to subgoals, top-down using backward reasoning, whereas most Datalog systems compute bottom-up using forward reasoning. Answer set programs typically use SAT solvers to generate a model of the program.

Modeling

edit
cat(tom). % tom is a cat mouse(jerry). % jerry is a mouse animal(X) :- cat(X). % each cat is an animal animal(X) :- mouse(X). % each mouse is an animal big(X) :- cat(X). % each cat is big small(X) :- mouse(X). % each mouse is small eat(X,Y) :- mouse(X), cheese(Y). % each mouse eats each cheese eat(X,Y) :- big(X), small(Y). % each big being eats each small being

Given this program, the query eat(X,jerry) succeeds with the answer substitution big(X) holds and then of showing that

Datalog has been applied to such problems as data integration, information extraction, networking, security, cloud computing and machine learning.

Answer set programming

edit

Answer set programming (ASP) evolved in the late 1990s, based on the stable model (answer set) semantics of logic programming. Like Datalog, it is a subset of Prolog; and, because it lacks compound terms, it is not Turing-complete.

Most implementations of ASP execute a program by first grounding the program, replacing all variables in rules by constants in all possible ways, and then using a propositional SAT solver, such as the DPLL algorithm to generate one or more models of the program.

Its applications are oriented towards solving difficult search problems and knowledge representation.

See also

edit

References

edit
"Imperative programming: Overview of the oldest programming paradigm". IONOS Digital Guide. 2021-05-21. Archived from the original on 2022-05-03. Retrieved 2023-05-23.
  • ↑ Chakravarty, Manuel M. T. (14 February 1997). On the Massively Parallel Execution of Declarative Programs (Doctoral dissertation). Technische Universität Berlin. Archived from the original on 23 September 2015. Retrieved 26 February 2015. In this context, the criterion for calling a programming language declarative is the existence of a clear, mathematically established correspondence between the language and mathematical logic such that a declarative semantics for the language can be based on the model or the proof theory (or both) of the logic.
  • ↑ "Birth of Prolog" (PDF). November 1992. Archived (PDF) from the original on 2015-04-02. Retrieved 2022-05-25.
  • ↑ Huang, Shan Shan; Green, Todd J.; Loo, Boon Thau (June 12–16, 2011). Datalog and Emerging applications (PDF). SIGMOD 2011. Athens, Greece: Association for Computing Machinery. ISBN 978-1-4503-0661-4. Archived (PDF) from the original on 2020-10-22. Retrieved 2023-08-13.
  • ↑ Gelfond, Michael (2008). "Answer sets". In van Harmelen, Frank; Lifschitz, Vladimir; Porter, Bruce (eds.). Handbook of Knowledge Representation. Elsevier. pp. 285–316. ISBN 978-0-08-055702-1. as PDF Archived 2016-03-03 at the Wayback Machine
  • External links

    edit
    Programming paradigms
    Imperative
    Structured
    Object-oriented
    Declarative
    Functional
    Dataflow
    Logic
    Domain-
    specific
    language

    (DSL)
    Concurrent,
    parallel
    Metaprogramming
    Separation
    of concerns
    Comparisons/Lists
    Comparison (multi-paradigm, object-oriented, functional), List (OO, by type)
    Types of programming languages
    Level
    Generation
    International
    National
    Other

    View original on Wikipedia | Back | FazBrowse Home