OpenMath Content Dictionary: patterns

Canonical URL:
http://www.openmath.org/cd/patterns.ocd
CD Base:
http://www.openmath.org/cd
CD File:
patterns.ocd
CD as XML Encoded OpenMath:
patterns.omcd
Defines:
all_of, any, any_of, argument, descendant, none_of, root, self_or_descendant
Date:
2019-09-23
Version:
1
Review Date:
Status:
experimental

    This document is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    The copyright holder grants you permission to redistribute this 
    document freely as a verbatim copy. Furthermore, the copyright
    holder permits you to develop any derived work from this document
    provided that the following conditions are met.
      a) The derived work acknowledges the fact that it is derived from
         this document, and maintains a prominent reference in the 
         work to the original source.
      b) The fact that the derived work is not the original OpenMath 
         document is stated prominently in the derived work.  Moreover if
         both this document and the derived work are Content Dictionaries
         then the derived work must include a different CDName element,
         chosen so that it cannot be confused with any works adopted by
         the OpenMath Society.  In particular, if there is a Content 
         Dictionary Group whose name is, for example, `math' containing
         Content Dictionaries named `math1', `math2' etc., then you should 
         not name a derived Content Dictionary `mathN' where N is an integer.
         However you are free to name it `private_mathN' or some such.  This
         is because the names `mathN' may be used by the OpenMath Society
         for future extensions.
      c) The derived work is distributed under terms that allow the
         compilation of derived works, but keep paragraphs a) and b)
         intact.  The simplest way to do this is to distribute the derived
         work under the OpenMath license, but this is not a requirement.
    If you have questions about this license please contact the OpenMath
    society at http://www.openmath.org.

This CD defines symbols for the representation of patterns that can be matched against mathematical expressions. Possible applications of such patterns can be formula search or the rule-based transformation of expressions. Author: Ken Wenzel, Fraunhofer IWU


all_of

Role:
application
Description:

This symbol represents a pattern constructor for matching the conjunction of one or more patterns. The operator is most useful for reusing multiple existing patterns.

Example:
An example for matching a set with exactly two elements.
all_of ( { } , any ( any , any ) )
Signatures:
sts


[Next: any] [Last: self_or_descendant] [Top]

any

Role:
constant
Description:

This symbol represents a wild card for matching any expression.

Example:
An example for matching a lambda expression with parameter $y and any body.
λ y . any
Example:
An example for matching lambda expressions with two parameters and any body. In addition to the "any" symbol as defined by this CD the example also uses a special variable named "_" as a placeholder for any variable. This is required for matching variables within <OMBVAR> that only allows variables as child elements.
λ _ , _ . any
Signatures:
sts


[Next: any_of] [Previous: all_of] [Top]

any_of

Role:
application
Description:

This symbol represents a pattern constructor for matching the disjunction of the given arguments.

Example:
An example for matching function applications of either sine or cosine.
any_of ( sin ( ) , cos ( ) )
Signatures:
sts


[Next: argument] [Previous: any] [Top]

argument

Role:
application
Description:

This symbol represents a pattern constructor for the order-independent matching of multiple function arguments.

Example:
An example that matches the plus function applied to the variables $a and $b without considering their order.
argument ( a , b )
Signatures:
sts


[Next: none_of] [Previous: any_of] [Top]

none_of

Role:
application
Description:

This symbol represents a pattern constructor for matching the complement of its arguments.

Example:
An example for matching any sine function unless it is applied to the variables $x or $z.
sin ( none_of ( x , z ) )
Signatures:
sts


[Next: root] [Previous: argument] [Top]

root

Role:
application
Description:

This symbol represents a pattern constructor for matching the root element of an expression.

Example:
An example for matching any sine function application that is the root of an expression.
root ( sin ( ) )
Signatures:
sts


[Next: descendant] [Previous: none_of] [Top]

descendant

Role:
application
Description:

This symbol represents a pattern constructor for matching any descendant of the current element.

Example:
An example for matching sum applications that contain the Pochhammer symbol.
any descendant ( pochhammer ( ) )
Signatures:
sts


[Next: self_or_descendant] [Previous: root] [Top]

self_or_descendant

Role:
application
Description:

This symbol represents a pattern constructor for matching the current element itself or any of its descendants.

Example:
An example for matching a sum application itself or any expression that contains a sum application.
self_or_descendant ( any any )
Signatures:
sts


[First: all_of] [Previous: descendant] [Top]