On this page:
state-of-matter?
solid
liquid
gas
melt
freeze
evaporate
condense
sublime
deposit
partially-melt
partially-freeze
partially-evaporate
partially-condense
partially-sublime
partially-deposit
8.12

5 Phase Transitions🔗ℹ

 (require planning/examples/phase-transition)
  package: planning

In chemistry, a phase transition is a change from one state of matter to another. Matter can exist in multiple phases — consider a glass of water with an ice cube in it. Therefore, phase transitions can be modeled as set actions that act on the set of phases that a collection of matter is currently in. This is not practically useful on its own, but it serves as an illustrative example of how to use the set state representation.

procedure

(state-of-matter? v)  boolean?

  v : any/c
A predicate for the states of matter. Returns true if v is one of the constants representing the three states of matter: solid, liquid, and gas.

Three basic states of matter. Other, more exotic states of matter exist, but we omit them to keep the examples simple.

Total phase transitions between the three basic states of matter. Each transition requires some matter to exist in a specific state, then once it is applied that matter is transformed into a different state.

Examples:
> (set-act (set liquid) freeze)

(set #<state-of-matter:solid>)

> (set-act (set solid) evaporate)

set-act: contract violation;

 The action must be applicable to the set.

      set: (set #<state-of-matter:solid>)

      action: (set-action #:additions (set

#<state-of-matter:gas>) #:cost 1 #:deletions (set

#<state-of-matter:liquid>) #:obstructions (set)

#:requirements (set #<state-of-matter:liquid>))

  in: (->i

       ((set set?) (action set-action?))

       #:pre/name

       (set action)

       "The action must be applicable to the set."

       (set-action-applicable? action set)

       (_ set?))

  contract from:

      <pkgs>/planning/set/action.rkt

  blaming: top-level

   (assuming the contract is correct)

  at: <pkgs>/planning/set/action.rkt:7:3

Partial phase transitions between the basic states of matter, in which some — but not all — of the matter is changed from one phase to another.

Example:
> (set-act (set solid) partially-melt)

(set #<state-of-matter:liquid> #<state-of-matter:solid>)